✨ Derive the qubit and tensor correspondence of a call from its callee - #2194
Conversation
bc62f9f to
a301483
Compare
a301483 to
5472710
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
b6801d6 to
cddcdbc
Compare
a02e180 to
a638b30
Compare
a638b30 to
06fdb61
Compare
58c8204 to
c7d82fe
Compare
c7d82fe to
56a017d
Compare
c7d82fe to
979bd40
Compare
979bd40 to
79d8ea2
Compare
79d8ea2 to
b52f2e6
Compare
burgholzer
left a comment
There was a problem hiding this comment.
@DRovara Thanks for your work on this!
I took this for a couple of spins and rebased it on the latest main.
Could you please go through the PR once more and check whether this makes sense? If it does, please feel free to merge!
I already partly reviewed and iterated the next PR in the stack 😌
|
Moved this one to the 4.1.0 milestone because I think it is unrealistic to get the entire PR stack merged before the 4.0 release and I'd rather get this into the next minor release or the one after that. |
From a first glance, your changes seem only minimal, and with all the tests still passing I'm confident this is correct. I'm resolving the conflicts and then merging the PR |
b52f2e6 to
93253e9
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
Record the rebase, simplification, validation, and publication procedure for the interprocedural optimization stack. Assisted-by: Codex
93253e9 to
3bd74e3
Compare
🤖 AI text below 🤖
Description
Second of a stack replacing #1970. Builds on #2193.
WireIteratornow traversesfunc.callin both directions.atWireStart()distinguishes a call result created by the callee from one continuing an
operand's wire.
CallQubitMappingandCallTensorMappingderive operand/result correspondenceby threading linear arguments through the callee body instead of assuming
positional pairing. Reordered, kept, and created values are therefore tracked
according to the callee's behavior. Declarations, recursion, incomplete
functions, and non-straight-line bodies fail closed because they do not prove a
safe correspondence.
CallQubitMapping::invalidate()remains because #2199 mutates callees whilereusing the mapping. No reverse-mapping or tensor-invalidation API is exposed
because the stack has no production consumer for it.
This also fixes two defects exposed by call-aware traversal:
qtensor.from_elementswas not treated as a qubit-wire sink even though itconsumes qubits into a tensor.
Simplification audit
The Ponytail review removed duplicate pass-through, foreign-value, classical,
and invalid-input cases. The retained tests cover the distinct contracts:
nested reordered correspondence, kept/created values, bidirectional traversal,
and fail-closed declarations and recursion.
Testing
one expected skip.
uvx nox -s cpp-lintanduvx nox -s lintpass.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).