Skip to content

Add loop emission to Adaptive_RIFLA#3038

Open
swernli wants to merge 2 commits intomainfrom
swernli/rifla-loops
Open

Add loop emission to Adaptive_RIFLA#3038
swernli wants to merge 2 commits intomainfrom
swernli/rifla-loops

Conversation

@swernli
Copy link
Copy Markdown
Collaborator

@swernli swernli commented Mar 20, 2026

This change adds logic to support emission of loops into QIR when use the Adaptive_RIFLA profile. The strategy employed uses changes to both RCA and Partial Evaluation to accomplish this.

In RCA, we add a new check that identifies loops whose condition is marked as static and speculatively marks them as dynamic to compute what capabilities they would require at runtime. If the resulting capabilities are compatible with the current target, the loop remains dynamic, otherwise the RCA state is reset and the loop is marked as the originally analyzed static.

In Partial Evaluation, new support for dynamic loops is added, where a loop marked as dynamic is emitted as a sequence of blocks with appropriate backward branches to capture the while-loop structure.

This change includes new unit tests to verify analysis and emission of loop structures into RIR and new integration tests to verify the whole program structure and execution of QIR v2 with loops via qir-runner.

@swernli swernli force-pushed the swernli/rifla-loops branch 3 times, most recently from 7f70902 to d8601a4 Compare March 24, 2026 22:25
@swernli swernli force-pushed the swernli/rifla-loops branch 3 times, most recently from 19706c7 to eacf966 Compare April 1, 2026 05:24
This change adds logic to support emission of loops into QIR when use the `Adaptive_RIFLA` profile. The strategy employed uses changes to both RCA and Partial Evaluation to accomplish this.

In RCA, we add a new check that identifies loops whose condition is marked as static and speculatively marks them as dynamic to compute what capabilities they would require at runtime. If the resulting capabilities are compatible with the current target, the loop remains dynamic, otherwise the RCA state is reset and the loop is marked as the originally analyzed static.

In Partial Evaluation, new support for dynamic loops is added, where a loop marked as dynamic is emitted as a sequence of blocks with appropriate backward branches to capture the while-loop structure.

This change includes new unit tests to verify analysis and emission of loop structures into RIR and new integration tests to verify the whole program stucture and execution of QIR v2 with loops via qir-runner.
@swernli swernli force-pushed the swernli/rifla-loops branch from eacf966 to 0dcb9de Compare April 1, 2026 18:43
@swernli swernli marked this pull request as ready for review April 1, 2026 18:48
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.

1 participant