Adjoint lowering pass can handle control flow with arbitrary quantum operands#2868
Merged
Conversation
rniczh
approved these changes
May 22, 2026
Member
rniczh
left a comment
There was a problem hiding this comment.
Nice work 💯 ! Would you have a chance to add a test for this improvement?
paul0403
commented
May 22, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2868 +/- ##
=======================================
Coverage 97.01% 97.01%
=======================================
Files 167 167
Lines 18807 18807
Branches 1768 1768
=======================================
Hits 18245 18245
Misses 417 417
Partials 145 145 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…ring_arbitrary_qargs
mehrdad2m
approved these changes
May 25, 2026
Contributor
mehrdad2m
left a comment
There was a problem hiding this comment.
Looks good! just a minor comment.
…ring_arbitrary_qargs
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.
Context:
Recently we extended the
quantum.adjointoperation to handle arbitrary quantum operand structures (as opposed to being restricted to have a single qreg arg) #2590In adjoint lowering pass, when the adjoint region contains other control flow regions, the code is still assuming the control flow regions have a single qreg argument (at index
0).Description of the Change:
Update adjoint lowering pass's control flow part to deal with arbitrary quantum operand structure.
Benefits:
Adjoint lowering pass works with more general programs.
In particular, those generated by the ref-to-value semantics conversion will in general have unconstrained quantum operand structures on control flow ops.