✨ Add native gate synthesis MLIR pass and decomposition stack#1665
✨ Add native gate synthesis MLIR pass and decomposition stack#1665simon1hofmann wants to merge 55 commits into
Conversation
…use `std::exp` for complex exponentiation instead of `std::polar`.
… basis decomposer, Euler decomposition, and associated helper functions. This update introduces new headers and source files for managing gate sequences, unitary matrices, and decomposition strategies, enhancing the framework's capabilities for quantum circuit transformations. Co-authored-by: Tamino Bauknecht <dev@tb6.eu>
… and additional test cases for Euler and Weyl decompositions.
…, including new utility functions and validation for gate sequences.
…xamples and execution details.
…dual global phases.
… synthesis utilities
… clarifying examples and improving readability.
…d results in native synthesis tests.
…re both output and input qubits match correctly.
…pointers and ensure operand count validation for RZ, RX, RY, U, P, and R operations in native synthesis tests.
…ubit outputs and inputs, ensuring correct operation merging in XXMinusYY and XXPlusYY patterns.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
@burgholzer
Planned dependency chain: PR1 -> PR2 -> PR3 -> PR4 -> PR5 (each PR based on the previous one). Does this split and order look good, or would you prefer a different grouping/order? |
That order looks reasonable to me. If it can be split up like that, I would certainly appreciate it! 👍🏼 |
…::polar for complex exponentiation, improving numerical stability and readability.
Signed-off-by: simon1hofmann <119581649+simon1hofmann@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@mlir/include/mlir/Dialect/QCO/Transforms/Passes.h`:
- Around line 42-43: Add a Doxygen comment above the public factory declaration
createNativeGateSynthesisPass describing its purpose (what the pass does),
documenting the parameter `@param` options (type NativeGateSynthesisOptions) and
any important semantics of those options, and the return value via `@return` (a
std::unique_ptr<Pass> owning the created pass). Keep wording consistent with
surrounding pass factory comments (brief one-line summary plus `@param/`@return
tags) and place it immediately above the declaration for
createNativeGateSynthesisPass.
🪄 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: 468c7c0e-7e17-4ed8-8a53-dd3ca91801ad
📒 Files selected for processing (4)
mlir/include/mlir/Dialect/QCO/Transforms/Passes.hmlir/lib/Compiler/CompilerPipeline.cppmlir/lib/Dialect/QCO/IR/Operations/StandardGates/XXMinusYYOp.cppmlir/lib/Dialect/QCO/IR/Operations/StandardGates/XXPlusYYOp.cpp
…1672) ## Description - Consolidate Euler decomposition into `Euler.h` / `Euler.cpp` (angle extraction + `synthesizeUnitary1QEuler` IR emission), replacing the previous `EulerDecomposition` / `GateSequence` / `Helpers` / `UnitaryMatrices` split. - Add the `fuse-single-qubit-unitary-runs` MLIR pass: fuse maximal runs of constant single-qubit unitaries on a wire by composing 2×2 matrices and resynthesizing in a configurable Euler basis (`zyz`, `zxz`, `xzx`, `xyx`, `u`, `zsxx`), with `gphase` for exact global phase. Split up and refactored from #1665. ## AI Assistance Used Composer via Cursor for parts of this change. I reviewed the full diff and take responsibility for everything in this PR. ## Checklist <!--- This checklist serves as a reminder of a couple of things that ensure your pull request will be merged swiftly. --> - [x] The pull request only contains commits that are focused and relevant to this change. - [x] I have added appropriate tests that cover the new/changed functionality. - [x] I have updated the documentation to reflect these changes. - [x] I have added entries to the changelog for any noteworthy additions, changes, fixes, or removals. - [ ] I have added migration instructions to the upgrade guide (if needed). - [x] The changes follow the project's style guidelines and introduce no new warnings. - [x] The changes are fully tested and pass the CI checks. - [x] I have reviewed my own code changes. **If PR contains AI-assisted content:** - [x] I have disclosed the use of AI tools in the PR description as per our [AI Usage Guidelines](https://github.com/munich-quantum-toolkit/core/blob/main/docs/ai_usage.md). - [ ] AI-assisted commits include an `Assisted-by: [Model Name] via [Tool Name]` footer. - [x] I confirm that I have personally reviewed and understood all AI-generated content, and accept full responsibility for it. --------- Signed-off-by: simon1hofmann <119581649+simon1hofmann@users.noreply.github.com> Signed-off-by: burgholzer <burgholzer@me.com> Signed-off-by: Lukas Burgholzer <burgholzer@me.com> Co-authored-by: Tamino Bauknecht <dev@tb6.eu> Co-authored-by: Daniel Haag <121057143+denialhaag@users.noreply.github.com> Co-authored-by: Copilot <copilot@github.com> Co-authored-by: burgholzer <burgholzer@me.com>
Cpp-Linter Report
|
…qubit unitary windows via Weyl/KAK resynthesis. Update changelog and remove obsolete files related to two-qubit window consolidation.
Description
Introduces a
native-gate-synthesistransform on QCO modules that lowers arbitrary supported unitaries to a comma-separated native gate menu, with scoring over two-qubit count, single-qubit count, and local depth.User-visible behavior
--native-gates=<menu>onmqt-cc(empty menu = no-op), aligned with pass options documented inPasses.td(native-gates,score-weight-twoq,score-weight-oneq,score-weight-depth).Fixes #(issue)
Checklist
If PR contains AI-assisted content:
Assisted-by: [Model Name] via [Tool Name]footer.