🐛 Propagate correct mappings to parent of scf::IfOp branches#1904
Conversation
|
@coderabbitai full review |
✅ Action performedFull review finished. |
📝 WalkthroughWalkthroughQCO mapping updates add layout equality, correct additional-qubit ChangesQCO mapping behavior
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant dispatch
participant converge
participant IfOp
participant Layout
dispatch->>IfOp: Route then and else regions
dispatch->>converge: Converge branch layouts
converge->>Layout: Return converged layout
dispatch->>IfOp: Insert branch SWAPs
dispatch->>IfOp: Reorder yielded qubits in Hot mode
dispatch->>Layout: Update parent layout and wire information
Possibly related PRs
Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
…-quantum-toolkit/core into bug/wires-after-if-op-map
Description
Currently, the mapping pass has the following critical issues:
qco::IfOp, thedispatchfunction does not properly propagate the updated mappings (layout, wire-infos) to its parent operation.qco::Yieldoperation in each branch does not guarantee that the same hardware qubits, in the same order, are returned. However, this property must be enforced for proper linear typing. Semantically, any SCF-op must act as a black-box consuming and producingNhardware qubits in the same order. However, contrary to thescf::ForOpwhere we restore the layout, theqco::IfOpacts like a permutation network, where the return hardware qubits might "house" different program qubits.This pull request fixes these issues. I've also tried to improve the documentation (the comments) and code quality along the way for both the mapping pass and its tests.
Checklist
If PR contains AI-assisted content:
Assisted-by: [Model Name] via [Tool Name]footer.