google / heir

A compiler for homomorphic encryption
https://heir.dev/
Apache License 2.0
237 stars 34 forks source link

bgv: add lowering to openfhe #391

Closed Maokami closed 4 weeks ago

Maokami commented 5 months ago

BGV to Openfhe

The BGV dialect will be pretty close to Openfhe, but since it will lower to other library dialects, we would ideally want to know the least common denominator of BGV library APIs. I don't know exactly what that is, but I am also comfortable with that boundary evolving as we add more libraries.

Originally posted by @j2kun in https://github.com/google/heir/issues/328#issuecomment-1898975618

AlexanderViand-Intel commented 5 months ago

The major challenge with different flavors of BGV will probably be the noise management, which is quite different between different implementations. HElib has some kind of "dynamic noise estimate" going on, and I think the BGV implementation in SEAL uses the same approach. OpenFHE, on the other hand, supports (potentially in addition to the dynamic approach) an easier-to-use version of BGV where all you need to know is depth + max number of additions/etc between multiplications.

However, I guess this isn't actually a major concern for the BGV-> library lowerings, as we can just assume that if someone lowers something using them, they already ensured that the BGV instructions are "valid" w.r.t noise as implemented in the library.