google / google/heir

Split `--<scheme>-to-lwe` into "trivial/common" and "real" lowering parts

Open
#1,193 2 comments 1 reaction 0 assignees View on GitHub
dialect: bgv dialect: ckks dialect: lwe
Dominant language
MLIR
Stars
906
Forks
171
Avg merge
4d 12h
Merged PRs (30d)
32

Description

In my `---to-openfhe` to `--lwe-to-openfhe` merger (PR #1196), I'm using `---to-lwe` in its current form to lower only the "common" operations we already have in the `lwe` dialect (e.g., add, mul, etc.) to reduce the amount of scheme specific ops that the openFHE pipeline needs to deal with. The current form of this pass leaves many operations (e.g., `.rotate`, `bgv.mod_switch`, etc) unmodified, which is fine for the OpenFHE pipeline.

However, we will eventually want to extend `---to-lwe` to declare all `` ops illegal and lower such operations to `lwe` (necessary for lowering to `polynomial`). There's a good chance that this lowering will be directly to "building blocks", e.g., a `rotate` might lower to an explicit permutation/automorphism + keyswitch operation, rather than `lwe.rotate`. As a result, the output of this extended pass would no longer be suitable for the OpenFHE piepeline.

This issue exists as a reminder to turn `---to-lwe` into a pipeline with two passes: first, a `---common-to-lwe` pass with the current behavior that lowers only trivial/common ops, and a `---specific-to-lwe` pass that lowers the remaining ops, potentially "below" the library backend abstraction level.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.