Open
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified Files
|
Contributor
|
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
A (looser) form of this optimization exists in QuEraComputing/bloqade-circuit#736. The idea is to stop constprop from iterating through a loop if
loop_varshas converged, preventing a bunch of unnecessary future iterations.Claude pointed out to me that if there's some dependency on the iteration variable triggering an impure operation in the loop body, the original fix without the guard you currently see would improperly denote the loop as entirely pure.
I already check for no iteration variable dependency in the bloqade-circuit stuff I'm working on but I don't see the harm in having it duplicated here.
@Roger-luo agreed this optimization is worth including in Kirin, with kudos to @weinbe58 and @jasonhan3 for pointing this optimization out to me.
Some benchmarks can be seen here, running against a trivial:
From
range(10)torange(30_000):