[qref 2.5] Subroutines take in extracted quantum.bit values during semantics conversion#2642
Merged
[qref 2.5] Subroutines take in extracted quantum.bit values during semantics conversion#2642
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2642 +/- ##
==========================================
- Coverage 97.15% 97.12% -0.04%
==========================================
Files 36 157 +121
Lines 4295 17920 +13625
Branches 0 1709 +1709
==========================================
+ Hits 4173 17405 +13232
- Misses 122 378 +256
- Partials 0 137 +137 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
rniczh
approved these changes
Apr 7, 2026
dime10
reviewed
Apr 10, 2026
mehrdad2m
approved these changes
Apr 13, 2026
dime10
approved these changes
Apr 14, 2026
Contributor
dime10
left a comment
There was a problem hiding this comment.
I'm a bit confused about the organization of the code into the two headers and the source file (i.e. why code is one place or another), but C++ can be confusing that way I suppose 😅
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:
When converting subroutines from reference semantics to value semantics, currently we take in whole registers as-is:
However, this is obviously not optimal, since the subroutine call, although only on a subset of qubits, will interject into the data flow of all qubit values in that register.
If we can statically know which qubits the subroutine needs, we can just extract before the call:
Description of the Change:
Extract qubits from static indices before the callsites of the subroutine, and use the extracted qubits instead.
Benefits:
More optimized quantum dataflow; unified treatment of how we handle subroutines vs other regions (control flow and adjoint) during the qref-to-quantum semantics conversion.
Possible Drawbacks:
None
Related GitHub Issues:
[sc-115119]