Skip to content

Implement early bootstrap placement in HEIR - #3326

Merged
copybara-service[bot] merged 1 commit into
mainfrom
test_961276281
Aug 11, 2026
Merged

Implement early bootstrap placement in HEIR#3326
copybara-service[bot] merged 1 commit into
mainfrom
test_961276281

Conversation

@copybara-service

@copybara-service copybara-service Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Implement early bootstrap placement in HEIR

This adds a new pass EarlyBootstrapPlacement pass, specific to the torch pipeline, that does early greedy bootstrap insertion while linalg and chebyshev ops are still a single operation.

This prevents SecretInsertMgmt from inserting bootstraps inside loops or in bulk on loop outputs, resolving some performance issues we saw with the hotword model.

It's also a bit of a cop out for the ineptitude of the greedy bootstrap pass to handle loops, which I feel is later going to be resolved by switching to Edward's ILP-based mgmt solver.

This change also includes some of the hoisting logic from my attempts to get the SecretInsertMgmt to move unnecessary bootstraps out of loops, and I feel that for the timing with the upcoming blog post, I'd like to just merge this as techdebt and worry about cleaning it up later (or not, if we switch to the ILP solver).

@copybara-service copybara-service Bot changed the title Hoist bootstraps early and fix loop level-invariance for CKKS Implement early bootstrap placement in HEIR Aug 10, 2026
@j2kun
j2kun requested a review from mdgrs August 10, 2026 18:15
@copybara-service
copybara-service Bot force-pushed the test_961276281 branch 2 times, most recently from a5455b8 to fa93ea1 Compare August 10, 2026 19:11

@mdgrs mdgrs left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not very familiar with this part of the code, so I tried to flag a few things that seemed suspicious.

Comment thread lib/Transforms/SecretInsertMgmt/Pipeline.cpp
Comment thread lib/Pipelines/ArithmeticPipelineRegistration.cpp
Comment thread lib/Transforms/Halo/Patterns.cpp Outdated
}

for (Value leaf : leafTargets) {
Operation* leafDefOp = leaf.getDefiningOp();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks very similar to tryHoistBootstrap. Maybe add a comment that they should be refactored together?

@copybara-service
copybara-service Bot force-pushed the test_961276281 branch 4 times, most recently from 2df87fb to 6883c0f Compare August 11, 2026 00:13
This adds a new pass `EarlyBootstrapPlacement` pass, specific to the torch pipeline, that does early greedy bootstrap insertion while linalg and chebyshev ops are still a single operation.

This prevents `SecretInsertMgmt` from inserting bootstraps inside loops or in bulk on loop outputs, resolving some performance issues we saw with the hotword model.

It's also a bit of a cop out for the ineptitude of the greedy bootstrap pass to handle loops, which I feel is later going to be resolved by switching to Edward's ILP-based mgmt solver.

This change also includes some of the hoisting logic from my attempts to get the `SecretInsertMgmt` to move unnecessary bootstraps out of loops, and I feel that for the timing with the upcoming blog post, I'd like to just merge this as techdebt and worry about cleaning it up later (or not, if we switch to the ILP solver).

PiperOrigin-RevId: 962470276
@copybara-service copybara-service Bot closed this Aug 11, 2026
@copybara-service
copybara-service Bot deleted the test_961276281 branch August 11, 2026 00:57
@copybara-service
copybara-service Bot merged commit eb1161f into main Aug 11, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants