Provide global toggles for static control flow folding#2912
Open
dime10 wants to merge 10 commits into
Open
Conversation
A static conditional can be evaluated trivially at trace time since it doesn't really have a reason to exist. Static loops still serve the purpose of compacting the program, but will introduce additional dynamic variables. In some conditions resolving these at trace time can be desirable. The toggle is global because in the context where the decision is made we don't have access to QJIT-instance specific compilation options. This is the simplest way forward, although alternatives could expand the EvaluationContext with a QJIT's CompileOptions for example.
rniczh
approved these changes
Jun 4, 2026
paul0403
approved these changes
Jun 5, 2026
isaacdevlugt
reviewed
Jun 5, 2026
Contributor
isaacdevlugt
left a comment
There was a problem hiding this comment.
Nice! Just added some docs suggestions :)
Co-authored-by: Isaac De Vlugt <34751083+isaacdevlugt@users.noreply.github.com>
isaacdevlugt
reviewed
Jun 5, 2026
Comment on lines
+64
to
+65
| For example, consider the following circuit with a statically defined `for` loop bound. | ||
|
|
Contributor
Author
There was a problem hiding this comment.
Huh, I just used the apply suggestion button, weird 😅
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2912 +/- ##
=======================================
Coverage 96.90% 96.90%
=======================================
Files 166 165 -1
Lines 19012 19014 +2
Branches 1760 1763 +3
=======================================
+ Hits 18424 18426 +2
Misses 433 433
Partials 155 155 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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 static conditional can be evaluated trivially at trace time since it doesn't really have a reason to exist. Static loops still serve the purpose of compacting the program, but will introduce additional dynamic variables. In some conditions resolving these at trace time can also be desirable.
The toggle is global because in the context where the decision is made we don't have access to QJIT-instance specific compilation options. This is the simplest way forward, although alternatives could expand the EvaluationContext with a reference to the currently active
CompileOptionsin the future (for example).[sc-121161]