✨ Add DD buildFunctionality/simulate for static QCO funcs#1915
✨ Add DD buildFunctionality/simulate for static QCO funcs#1915simon1hofmann wants to merge 11 commits into
buildFunctionality/simulate for static QCO funcs#1915Conversation
…ulate` for static unitary QCO `func.func` programs
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
@coderabbitai full review |
✅ Action performedFull review finished. |
📝 WalkthroughWalkthroughThe PR adds DD-based construction and simulation for supported MLIR QCO functions, including qubit mapping, gate and matrix application, validation, build integration, and tests. Weyl decomposition tests now use the new DD functionality API. ChangesQCO DD functionality
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant QCOFunction
participant DDFunctionality
participant DDPackage
QCOFunction->>DDFunctionality: Provide MLIR function
DDFunctionality->>DDFunctionality: Prepare mapping and walk operations
DDFunctionality->>DDPackage: Apply gates or matrices
DDPackage-->>DDFunctionality: Return DD result
Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@mlir/lib/Dialect/QCO/Utils/DDFunctionality.cpp`:
- Around line 101-147: Add parameterized end-to-end semantic parity tests for
every gate handled by decodeStandardGate’s TypeSwitch, comparing QCO behavior
against QC behavior. Include all single- and multi-parameter mappings,
explicitly covering ROp, U2Op, UOp, XXPlusYYOp, and XXMinusYYOp with parameter
ordering validated. Ensure the cases cover every listed gate branch so enum or
decoding discrepancies are detected.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 10dd01db-048b-4134-aad9-73e61c70d6e6
📒 Files selected for processing (8)
CHANGELOG.mdmlir/include/mlir/Dialect/QCO/Utils/DDFunctionality.hmlir/lib/Dialect/QCO/Utils/CMakeLists.txtmlir/lib/Dialect/QCO/Utils/DDFunctionality.cppmlir/unittests/Dialect/QCO/Transforms/Decomposition/CMakeLists.txtmlir/unittests/Dialect/QCO/Transforms/Decomposition/test_weyl_decomposition.cppmlir/unittests/Dialect/QCO/Utils/CMakeLists.txtmlir/unittests/Dialect/QCO/Utils/test_dd_functionality.cpp
|
@coderabbitai review |
✅ Action performedReview finished.
|
denialhaag
left a comment
There was a problem hiding this comment.
Really cool to see this application of the QCO matrices! Thanks, @simon1hofmann! 🙂
This already looks good to me! I only have some minor comments, which you can find below.
Co-authored-by: Daniel Haag <121057143+denialhaag@users.noreply.github.com> Signed-off-by: simon1hofmann <119581649+simon1hofmann@users.noreply.github.com>
Thanks a lot for the review 🙏 |
denialhaag
left a comment
There was a problem hiding this comment.
Thanks for adressing my comments! 🙂 This LGTM now!
I'll tag @burgholzer for a final review.
Signed-off-by: simon1hofmann <119581649+simon1hofmann@users.noreply.github.com>
🤖 AI text below 🤖
Description
Add QCO-native DD construction so static unitary
func.funcprograms can build a matrix DD / simulate a statevector without round-tripping throughqc::QuantumComputation.mlir::qco::buildFunctionality/simulateinDDFunctionality.hctrl; dense path forinv, compoundctrl, etc., with QCO MSB → DD LSB basis conversionqco.static, or qubit block args0..n-1when no static ops (synthesis helpers)gphaseandbarriersupporteddd::{buildFunctionality,simulate}; Weyl reconstruction tests reuse the new APIFixes #1913
AI Assistance
Used
Composer 2.5andGrok 4.5via Cursor for parts of this change. I reviewed the fulldiff and take responsibility for everything in this PR.
Checklist
If PR contains AI-assisted content:
🤖 *AI text below* 🤖(titles are exempt).Assisted-by: [Model Name] via [Tool Name]footer.