Skip to content

Provide global toggles for static control flow folding#2912

Open
dime10 wants to merge 10 commits into
mainfrom
trace-time-unrolling
Open

Provide global toggles for static control flow folding#2912
dime10 wants to merge 10 commits into
mainfrom
trace-time-unrolling

Conversation

@dime10
Copy link
Copy Markdown
Contributor

@dime10 dime10 commented Jun 3, 2026

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 CompileOptions in the future (for example).

[sc-121161]

dime10 added 3 commits June 3, 2026 13:36
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.
@dime10 dime10 requested review from a team and isaacdevlugt June 3, 2026 18:23
Copy link
Copy Markdown
Contributor

@isaacdevlugt isaacdevlugt left a comment

Choose a reason for hiding this comment

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

Nice! Just added some docs suggestions :)

Comment thread doc/releases/changelog-dev.md
Comment thread doc/releases/changelog-dev.md
Comment thread frontend/catalyst/__init__.py Outdated
Comment thread frontend/catalyst/__init__.py Outdated
Comment thread frontend/catalyst/__init__.py Outdated
Co-authored-by: Isaac De Vlugt <34751083+isaacdevlugt@users.noreply.github.com>
Comment thread doc/releases/changelog-dev.md Outdated
Comment on lines +64 to +65
For example, consider the following circuit with a statically defined `for` loop bound.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Huh, I just used the apply suggestion button, weird 😅

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.90%. Comparing base (6ace49f) to head (74a919d).
⚠️ Report is 3 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

4 participants