-
Notifications
You must be signed in to change notification settings - Fork 53
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
Use tensor_ext::ExtractOp for extracting an element out of a slot of a single ciphertext #1174
Comments
I'm not sure a duplicate extract op is the right way forward. While it solves this specific issue, the underlying problem is a bit more general: because our arithmetization pipeline ( My suggestion would be to drastically reduce the scope of the This would mean moving the "SIMD slot extract" pattern to the arithmetization pipeline and actually replacing such EDIT: I now think we should still introduce a Thoughts on this? It seems sensible to me now, but so did the previous three suggestions I wrote but deleted before posting because I realized they were dumb/broken/inelegant 😉 |
I agree. Packing should be decided way earlier.
I'd agree that bgv.extract/ckks.extract should not be a scheme basic op, but the technical issue is that down below there are I'd favor EDIT: even more, I actually think replaing tensor::extract as a |
Ohh, I think that highlights that there's actually many possible semantics for a
|
This issue has 6 outstanding TODOs:
This comment was autogenerated by todo-backlinks |
Related to #913
In the secretized IR, there are two semantics of tensor::ExtractOp
And this depends on the vectorizer to decide a tensor::ExtractOp bears which semantic. We can also check the lowering code on how to decide which semantic one tensor::ExtractOp is.
For example, in matmul, tensor::extract is decided to be extracting from tensor of ciphertext
yet in dot_product, either from input IR or the output IR, tensor::ExtractOp is meant to be extracting slot from simd ciphertext
When lowering, this translates to different ops. For the former, tensor::ExtractOp is preserved while the later lowers to scheme::Extract op like
bgv::ExtractOp
/ckks::ExtractOp
, then lowers toopenfhe.mulplain + rotate + lwe.interpret_underlying_type
.This makes it difficult for level analysis as it can not decide which tensor::ExtractOp is an actual unpacking thus has effect on the level result.
This was found during migrating secret-to-ckks to RNS scheme, which found many tensor::Extract that is actually extracting ciphertext from tensor ciphertext and did the wrong analysis.
Note that at the level of secret-insert-mgmt-ckks, it can not know an indivitual tensor extract bears which semantic as all it can see is
tensor<shapexf32>
The text was updated successfully, but these errors were encountered: