✨ Derive the qubit and tensor correspondence of a call from its callee - #2194
Open
DRovara wants to merge 2 commits into
Open
✨ Derive the qubit and tensor correspondence of a call from its callee#2194DRovara wants to merge 2 commits into
DRovara wants to merge 2 commits into
Conversation
DRovara
force-pushed
the
mlir/call-aware-iterators
branch
from
August 20, 2026 15:41
bc62f9f to
a301483
Compare
12 tasks
DRovara
force-pushed
the
mlir/call-aware-iterators
branch
from
August 20, 2026 18:33
a301483 to
5472710
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
DRovara
force-pushed
the
mlir/call-aware-iterators
branch
3 times, most recently
from
August 25, 2026 07:50
b6801d6 to
cddcdbc
Compare
burgholzer
force-pushed
the
mlir/call-aware-iterators
branch
from
August 25, 2026 21:44
a02e180 to
a638b30
Compare
DRovara
force-pushed
the
mlir/call-aware-iterators
branch
from
August 26, 2026 14:08
a638b30 to
06fdb61
Compare
DRovara
marked this pull request as ready for review
August 26, 2026 14:36
DRovara
force-pushed
the
mlir/call-aware-iterators
branch
from
August 27, 2026 11:40
58c8204 to
c7d82fe
Compare
DRovara
force-pushed
the
mlir/call-aware-iterators
branch
from
August 27, 2026 13:16
c7d82fe to
56a017d
Compare
DRovara
force-pushed
the
mlir/call-aware-iterators
branch
2 times, most recently
from
August 28, 2026 08:11
c7d82fe to
979bd40
Compare
Thread qubit and tensor arguments through supported callees and fail closed when their correspondence cannot be derived. Assisted-by: Claude Opus 5 <noreply@anthropic.com> Assisted-by: Codex
Exercise reordered, nested, kept, declared, and recursive call mappings together with iterator traversal in both directions. Assisted-by: Claude Opus 5 <noreply@anthropic.com> Assisted-by: Codex
burgholzer
force-pushed
the
mlir/call-aware-iterators
branch
from
August 28, 2026 12:30
979bd40 to
79d8ea2
Compare
12 tasks
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.
🤖 AI text below 🤖
Description
Second of a stack replacing #1970. Builds on #2193.
WireIteratortraversesfunc.callin both directions instead of stopping there, andatWireStart()reports whether a wire begins at the current operation — which a call result does only when the callee creates the qubit.Which result continues which operand is derived by threading the callee's arguments through its body rather than assumed to be positional, so a callee handing its qubits back in a different order is followed correctly. The derivation is cached per callee by
CallQubitMapping, withCallTensorMappingproviding the same for qubit tensors. Declarations, recursive functions, and bodies that are incomplete or not a single straight-line block now fail explicitly instead of guessing a positional pairing.Two defects this surfaced, fixed here:
qtensor.from_elementswas not treated as a wire sink even though it consumes qubits into a tensor exactly likeqtensor.insert, so any wire reaching it aborted the process.Testing
The QCO and QTensor utility suites cover threading, consuming, producing, reordering, nested calls, cache invalidation, declarations, and recursion. The affected suites pass with 125 QCO-utils tests, 10 QTensor-utils tests, 501 QCO-IR tests, and 246 optimization tests.
AI assistance
Code and this description were produced with Claude Code (Opus 5) and Codex, acting on my instructions and within the scope I authorized.
Checklist
If PR contains AI-assisted content:
🤖 *AI text below* 🤖(titles are exempt).