Secret dialect #96
Replies: 2 comments
-
This looks good to me as it look like we can express anything with it and at the same time keep high level information (here the library_name, btw I don't like "library_name" maybe "op_name" or something like that may fit more what we want to express but it's a detail). I'm ok with @AlexanderViand it look like difficult at this level to make useful optimization, but I guess is not the purpose of this dialect as it should be designed to be the most generic one in order to be lowered to scheme specific dialect. Maybe we could have a collection of transformation at this level to offer basic transformation, like eliminate addition with 0, multiplication by 0/1, merge consecutive table lookup etc... About the implementation of such simplification I'm not sure it should be folder/canonicalizer or separate rewrite patterns, as maybe some simplification could be suboptimal for a specific scheme, thus this would be the responsability of compilers to select patterns that make sense for it specific scheme? I think we should also have a collection of non-generic operators that make codegen from frontend more easy to do, and a pass that convert non-generic operator into secret.generic operator (just like linalg named ops). One of the question that raise is where is the boundary of the secret named operator? To take as example on Concrete compiler we have very high level fhe operators that works on tensors with a broadcasting semantics that is usefull for our frontend codegen, but is that make sense to have this operator in common? Should we have a way to express that a secret is under a certain key (maybe something optional ?), if yes is that means we should also have a kind of keyswitch operator at this level? And what about public encryption, threshold decryption? |
Beta Was this translation helpful? Give feedback.
-
So all the usual MLIR passes should work inside secret.generic at this level without us doing anything, so long as the ops being optimized are inside a single region. So I think the initial passes would be something like this:
In this sense, I think But to your last point, |
Beta Was this translation helpful? Give feedback.
-
Putting aside a separate thread (from #53 (reply in thread)) to discuss aspects of a high-level secret dialect (even higher level than something like "encrypted arith").
A draft PR showing the basic structure is #78
Some example MLIR might look like
The motivation behind this dialect is:
The central op here is
secret.generic
which lifts a plaintext computation to operate on one or more secrets, withsecret.secret
being a wrapper type around an arbitrary MLIR type.In the last MLIR meeting @AlexanderViand-Intel expressed that it would be too difficult to make useful optimization decisions at this level, requiring original research to develop a good cost model at least. I think it would still have value as an easy front-end to target, and doesn't prevent users from targeting lower-level dialects like encrypted_arith/math/linalg if they prefer.
Beta Was this translation helpful? Give feedback.
All reactions