Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tensor_ext.combine and an associated pattern to replace collapse-insertion-chains #512

Open
j2kun opened this issue Mar 11, 2024 · 2 comments
Labels
dialect: tensor_ext Issues concerning the tensor_ext dialect enhancement New feature or request

Comments

@j2kun
Copy link
Collaborator

j2kun commented Mar 11, 2024

From the review on #471

In HECO, "left-over" insert/extract ops instead get mapped to the combine op which lets you merge two tensors. The combine op essentially models the "masked addition" you sometimes get in batched FHE code: given a (plaintext) mask m, you do a * m + b * !m, letting you pick independently for each index whether it comes from a or b. While there's of course a canonicalization to handle the "full replacement" case that this pass handles, not all programs batch that nicely (of course, in the HECO examples, we focused on those that do 😉). Because an insert/extract generally costs one (ptxt-ctxt) mask multiplication and one (much, much more expensive) rotation, mapping things to combine instead gives much better performance for those programs that don't batch perfectly. In addition, the combine op is pretty useful in itself to express batched FHE programs, so it'd be nice to add to tensor_ext. Unfortunately, the HECO implementation of combine has a rather messsy parser/printer and canonicalizer (though it gets the job done).

@j2kun j2kun self-assigned this Mar 11, 2024
@j2kun j2kun added enhancement New feature or request dialect: tensor_ext Issues concerning the tensor_ext dialect labels Mar 11, 2024
@j2kun j2kun removed their assignment Mar 11, 2024
Copy link

github-actions bot commented Mar 11, 2024

This issue has 1 outstanding TODOs:

This comment was autogenerated by todo-backlinks

@j2kun
Copy link
Collaborator Author

j2kun commented Mar 11, 2024

Part of #475

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dialect: tensor_ext Issues concerning the tensor_ext dialect enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant