Implement early bootstrap placement in HEIR - #3326
Merged
Merged
Conversation
copybara-service
Bot
force-pushed
the
test_961276281
branch
from
August 10, 2026 17:39
0ebfb5b to
1578074
Compare
copybara-service
Bot
force-pushed
the
test_961276281
branch
from
August 10, 2026 18:08
1578074 to
2f74bf6
Compare
copybara-service
Bot
force-pushed
the
test_961276281
branch
2 times, most recently
from
August 10, 2026 19:11
a5455b8 to
fa93ea1
Compare
mdgrs
reviewed
Aug 10, 2026
mdgrs
left a comment
Collaborator
There was a problem hiding this comment.
I am not very familiar with this part of the code, so I tried to flag a few things that seemed suspicious.
| } | ||
|
|
||
| for (Value leaf : leafTargets) { | ||
| Operation* leafDefOp = leaf.getDefiningOp(); |
Collaborator
There was a problem hiding this comment.
This looks very similar to tryHoistBootstrap. Maybe add a comment that they should be refactored together?
copybara-service
Bot
force-pushed
the
test_961276281
branch
4 times, most recently
from
August 11, 2026 00:13
2df87fb to
6883c0f
Compare
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
Bot
force-pushed
the
test_961276281
branch
from
August 11, 2026 00:57
6883c0f to
eb1161f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement early bootstrap placement in HEIR
This adds a new pass
EarlyBootstrapPlacementpass, specific to the torch pipeline, that does early greedy bootstrap insertion while linalg and chebyshev ops are still a single operation.This prevents
SecretInsertMgmtfrom 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
SecretInsertMgmtto 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).