Add extended basis rotation passes for OpenFHE (ConvertToExtendedBasis + HoistKeySwitchDown)#2624
Conversation
a9ac151 to
a9a1ecf
Compare
|
Hi @asraa, I'd appreciate your review of these changes when you have time. Should I also add interpreter benchmarks comparing performance with and without these passes? |
|
@AlexanderViand Asra and I are a bit strapped for time these days. Do you think you'd have time to review this PR? |
j2kun
left a comment
There was a problem hiding this comment.
LGTM! Some minor changes suggested. In my view the next step would be to add these two passes to the openfhe pipeline, and run them with something like a matvec op that lowers to an IR with lots of rotations and summations, which should be able to take advantage of these patterns.
|
Also when you're ready, please squash your commits into one, as per https://heir.dev/docs/development/#pull-request-review-flow |
a9a1ecf to
561d04a
Compare
|
Thank you @toprakmurat! |
Summary
Continuation of #2574, related to #2519.
Adds two new passes for optimizing rotation-heavy FHE programs by deferring expensive key-switch operations:
--openfhe-convert-to-extended-basis- Convertsfast_rotation→fast_rotation_ext+key_switch_down--openfhe-hoist-key-switch-downChanges
Pass 1: ConvertToExtendedBasis
openfhe.fast_rotationtoopenfhe.fast_rotation_ext+openfhe.key_switch_downPass 2: HoistKeySwitchDown
key_switch_downoperations later in the IR to reduce key-switch count.Add,AddInPlace, andMuloperations.key_switch_down(with single use), the pass swaps:to:
and,
to:
Through greedy iteration, this reduces multiple key-switches in chained operations to a single final key-switch.