✨ Preserve classical control through target mapping - #2179
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
fea3035 to
0569b67
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Team Run ID: 📒 Files selected for processing (5)
Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review. Important Approval pendingCodeRabbit has no unresolved comments, but it has not reviewed the latest commit. Use the checkbox below to review the latest commit. CodeRabbit will approve the changes if it finds no blocking issues.
📝 SummarySummary by CodeRabbit
WalkthroughThe change adds QTensor scalarization for eligible ChangesQCO compiler updates
Estimated code review effort: 4 (Complex) | ~45 minutes Merge Risk: 🔵 Low · up to The PR improves preservation of structured classical control during compile-time mapping and is mergeable with owner awareness. A late mapping failure may leave partially transformed compiler state if the failed pipeline result is reused, so failure-state handling should be explicitly verified or documented. Sequence Diagram(s)sequenceDiagram
participant CleanupPipeline
participant ScalarizeQTensorInputs
participant QCOIfOp
participant QTensorOps
CleanupPipeline->>ScalarizeQTensorInputs: apply canonicalization
ScalarizeQTensorInputs->>QCOIfOp: analyze constant-index branches
ScalarizeQTensorInputs->>QCOIfOp: create scalar qubit operands and results
QCOIfOp->>QTensorOps: extract and reinsert QTensor elements
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Description checkExplanation The description provides a clear summary, motivation, scope, preserved history, testing results, AI disclosure, and a completed checklist. It does not include an explicit issue reference or dependency statement, but these omissions are non-critical because no issue or dependency is identified. Full details: Docstring CoverageExplanation Docstring coverage is 27.59% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 29 functions across 4 files. (1 skipped: 1 unsupported.) 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 |
|
🤖 AI text below 🤖 pre-commit.ci run |
|
This PR now somehow includes an old state of #2162. |
|
Hm. I wanted to disentangle the series from here on out from the lower chain. Might be that something went wrong with that. I'll try to fix that up once the main PR series gets closer to mergable. |
0569b67 to
9f7a0eb
Compare
denialhaag
left a comment
There was a problem hiding this comment.
I admittedly didn't go through all of the logic, but this generally LGTM. I just have a few comments, none of which should be a major blocker.
burgholzer
left a comment
There was a problem hiding this comment.
Might have been a bit premature to declare this as ready for review. This still has quite a few dependencies on other open PRs it seems.
Might be worth getting those in first before handing this one back to Codex with all the feedback.
61c8177 to
454cef9
Compare
Scalarize supported qco.if QTensor inputs and keep structured-control boundaries intact while mapping advances independent wires. Assisted-by: Codex Signed-off-by: Simon Hofmann <simon.t.hofmann@tum.de>
454cef9 to
79c7688
Compare
|
@coderabbitai full review |
✅ Action performedFull review finished. |
denialhaag
left a comment
There was a problem hiding this comment.
Thanks a lot for addressing all of my comments, @simon1hofmann! I only cross-checked that they are all resolved now, but I didn't check the full PR again. I'm approving now so this doesn't get help up. If you want me to have another look, I'm happy to do so tomorrow morning! 🙂
Reuse LLVM and MLIR helpers in QTensor scalarization and boundary handling. Keep the same regression coverage with smaller test inputs. Assisted-by: Codex
burgholzer
left a comment
There was a problem hiding this comment.
Simplified this a bit further. But otherwise this also looks good to me now and ready to go in. We may want to eliminate that one check that is true by design.
Replace an unreachable match failure with an assertion of the verifier-owned one-use invariant. Assisted-by: Codex Signed-off-by: Simon Hofmann <simon.t.hofmann@tum.de>
burgholzer
left a comment
There was a problem hiding this comment.
Looks reasonable to me for now!
Let's get this in! ![]()
🤖 AI text below 🤖
Description
This PR makes target mapping preserve structured classical control without
defining target capability policy:
qco.if.values that actually cross those boundaries.
observable CBit and memref access order.
classical-memory dependencies contain a cycle.
This is the focused MQT Core 4.0 scope. It intentionally does not add
CompilerTarget::ClassicalControl, target-capability legality validation,complete-topology identity placement, zero-SWAP preview optimizations, or
payload/QDMI 1.4 work. Target acceptance policy can therefore evolve separately
from the mapper's semantic-correctness guarantees.
Preserved history
Before rewriting the PR branch, the full prior stack was preserved exactly:
25b7eb8ef50db57abe0de94044821a160f384b899f7a0eb08bb410f67312c802f212b544e0f2a547archive/pr-2179-full-classical-control-2026-09-01, verified at the original head aboveThe range-diff drops the target-capability, complete-topology, and target-check
alignment commits and rewrites only the structured-control preservation commit
onto current
main. The archive retains those deferred changes for futureextraction without keeping them in the Core 4.0 critical path.
Testing
uvx nox -s lint: passed.git diff --check: passed.AI assistance: Codex assisted with the rescope, implementation review, testing,
and this description. The original human contribution and commit authorship
remain attributed to Simon Hofmann.
Checklist
If PR contains AI-assisted content:
🤖 *AI text below* 🤖(titles are exempt).