-
-
Notifications
You must be signed in to change notification settings - Fork 63
✨ Add QCO Euler synthesis and fuse-single-qubit-unitary-runs pass
#1672
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
80 commits
Select commit
Hold shift + click to select a range
e5280c5
✨ Add Euler decomposition and supporting decomposition primitives
simon1hofmann 01ff591
🐇 Address Rabbit's Comments
simon1hofmann 2c74981
📝 Update factorization documentation in EulerDecomposition
simon1hofmann b7307a3
📝 Update docs and comments
simon1hofmann e978f16
🐇 Address Rabbit's Comments
simon1hofmann d1a85d3
Merge branch 'main' into decomp/euler
denialhaag 1d1ba72
Adapt to new include style
denialhaag 3c7370d
Merge branch 'main' into decomp/euler
simon1hofmann ab35f91
✨ Add QCO UnitaryMatrixOpInterface for compile-time unitary matrices
simon1hofmann 6cb4af2
♻️ Use UnitaryMatrixOpInterface in CtrlOp and InvOp matrix expansion
simon1hofmann abd87fc
♻️ Consolidate QCO Euler decomposition into Euler.h/cpp
simon1hofmann 9c10cb6
✨ Add fuse-single-qubit-unitary-runs pass for Euler resynthesis
simon1hofmann 54ca07d
✅ Add tests for Euler synthesis and fuse-single-qubit-unitary-runs
simon1hofmann 1c01e71
📝 Document fuse-single-qubit-unitary-runs in CHANGELOG
simon1hofmann a92a2b6
🚨 Fix linter warnings
simon1hofmann 577c094
🚨 Fix linter warnings
simon1hofmann 6e7fa7f
🐇 Address Rabbit's comments
simon1hofmann ebc984f
Merge branch 'main' into decomp/euler
simon1hofmann 418b17e
✅ Refactor QCO decomposition tests and update dependencies
simon1hofmann 7da85cd
🎨 Refactor Euler basis handling in QCO transformations
simon1hofmann 5e2cbdc
🎨 Refactor Euler decomposition operations in QCO
simon1hofmann 8eb937c
🎨 Refactor matrix handling and wire start collection in QCO transform…
simon1hofmann e287b80
🎨 Enhance Euler decomposition in QCO
simon1hofmann 20d5835
🚨 fix clang-tidy warnings
simon1hofmann 1b541d3
🚨 fix clang-tidy warnings
simon1hofmann 3d54872
⚡️Increase single qubit fusion performance
simon1hofmann a94b83f
Merge branch 'main' into decomp/euler
simon1hofmann 608491f
🎨 Enhance WireIterator to include YieldOp in boundary checks
simon1hofmann 98266bd
📝 Refine Euler decomposition and synthesis documentation
simon1hofmann d2e7731
🔀 Merge branch 'main' into decomp/euler, fix conflicts and remove Eig…
simon1hofmann 0302530
🎨 missing new line
simon1hofmann b8d506d
🚨 Fix linter warnings
simon1hofmann 3496c5f
🎨 Enhance Euler decomposition: update documentation, add support for …
simon1hofmann 5d08032
🚨 Fix linter warnings
simon1hofmann 5c6b317
🎨 Enhance QCO matrix handling: add `assignFrom` methods for `DynamicM…
simon1hofmann 2bab298
🎨 Multiple small fixes
simon1hofmann 981fdc8
☂️ increase coverage
simon1hofmann ee5199d
🚨 Fix linter warnings
simon1hofmann 20b7e1f
Merge remote-tracking branch 'origin/main' into decomp/euler
simon1hofmann 37383f1
✨ Implement composeSingleQubitBodyMatrix function for InvOp and enhan…
simon1hofmann 215ad55
✨ Fuse modifiers with multiple single unitary operations
simon1hofmann fe6c413
Merge branch 'main' into decomp/euler
simon1hofmann 4cff97e
🚨 Fix linter warnings
simon1hofmann fa5444e
☂️ Increase coverage
simon1hofmann 74002cd
🎨 Simplify code and remove testcase
simon1hofmann a19abaa
🐇 Address rabbit's comments
simon1hofmann 9e2502d
🚨 Fix linter warnings
simon1hofmann 150e50d
Merge branch 'main' into decomp/euler
simon1hofmann a0a9a83
:rotating_light: Please local clang-tidy
burgholzer fa85055
:art: Drop redundant namespace qualifiers
burgholzer 98886a5
:art: Consistently use `isNearZeroRotationAngle`
burgholzer 93ef9eb
:art: Code quality improvements and cleanup
burgholzer a9009fe
Merge branch 'main' into decomp/euler
burgholzer 093ba8b
✨ Enhance matrix operations with element-wise scaling and adjoint fun…
simon1hofmann 39a8d4f
🎨 Update default tolerance for MLIR dialect numerics and revert error…
simon1hofmann 1d076c7
🎨 Refactor Euler synthesis functions and improve gate fusion logic
simon1hofmann b8b6616
⚡️ Improve fusable run logic
simon1hofmann 63f5994
Merge branch 'main' into decomp/euler
simon1hofmann 257bc0f
🚨 Fix linter warnings
simon1hofmann 9c1a659
🎨 Refactor Euler decomposition and fuse single-qubit run logic
simon1hofmann 902729f
🚨 Fix linter warnings
simon1hofmann c7551bf
🎨 Update tolerance check for global complex value in InvOp.cpp
simon1hofmann 2d71d9b
🚨 Fix linter warnings
simon1hofmann 3701236
✅ Refactor test_euler_decomposition.cpp: streamline includes, rename …
simon1hofmann c9b7a3c
🚨 Fix linter warnings
simon1hofmann 91c8184
🚨 Fix linter warnings
simon1hofmann ed4121e
📝 Streamline docstrings and comments
simon1hofmann 8843648
🎨 Remove unnecessary llvm namespace from SmallVector usage in Euler.cpp
simon1hofmann 61cddb0
🎨 Update function signatures in FuseSingleQubitUnitaryRuns.cpp to use…
simon1hofmann 217407e
✅ Organize test_euler_decomposition.cpp
simon1hofmann 9f19d9b
🔀 Merge main
burgholzer a22d8ec
⚡ Optimize the implementation of the Euler decomposition
burgholzer 85fa0fc
🎨 Better debuggability by printing matrices upon mismatch
burgholzer 9806784
🚸 Add efficient check for compile-time availability of a unitary matrix
burgholzer 8e5b09e
🩹 Ensure Barrier defines its unitary matrix
burgholzer 177e534
🚸 Add a `WireRange` construct that wraps a `WireIterator` for easy us…
burgholzer f094f33
♻️ Simplify the implementation of the single-qubit gate fusion
burgholzer a04bc3d
📝 Add to changelog
burgholzer 0f86d05
🚨 Address clang-tidy warnings
burgholzer 6fdebf3
Merge branch 'main' into decomp/euler
simon1hofmann File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
mlir/include/mlir/Dialect/QCO/Transforms/Decomposition/Euler.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| /* | ||
| * Copyright (c) 2023 - 2026 Chair for Design Automation, TUM | ||
| * Copyright (c) 2025 - 2026 Munich Quantum Software Company GmbH | ||
| * All rights reserved. | ||
| * | ||
| * SPDX-License-Identifier: MIT | ||
| * | ||
| * Licensed under the MIT License | ||
| */ | ||
|
|
||
| #pragma once | ||
|
|
||
| #include "mlir/Dialect/QCO/Utils/Matrix.h" | ||
|
|
||
| #include <mlir/IR/Builders.h> | ||
| #include <mlir/IR/Location.h> | ||
| #include <mlir/Support/LLVM.h> | ||
|
|
||
| #include <cstddef> | ||
| #include <cstdint> | ||
| #include <optional> | ||
|
|
||
| namespace mlir::qco::decomposition { | ||
|
|
||
| /** | ||
| * @brief Native gate sets for single-qubit Euler synthesis. | ||
| */ | ||
| enum class EulerBasis : std::uint8_t { | ||
| ZYZ = 0, ///< `RZ(phi) * RY(theta) * RZ(lambda)`. | ||
| ZXZ = 1, ///< `RZ(phi) * RX(theta) * RZ(lambda)`. | ||
| XZX = 2, ///< `RX(phi) * RZ(theta) * RX(lambda)`. | ||
| XYX = 3, ///< `RX(phi) * RY(theta) * RX(lambda)`. | ||
| U = 4, ///< `U(theta, phi, lambda)`. | ||
| ZSXX = 5, ///< `RZ` / `SX` / `X` synthesis via ZYZ decomposition. | ||
| }; | ||
|
|
||
| /** | ||
| * @brief Parses a basis name (e.g. `zyz`, `zsxx`; case-insensitive). | ||
| * | ||
| * @param basis The basis name. | ||
| * @return The parsed basis, or `std::nullopt` if unrecognized. | ||
| */ | ||
| [[nodiscard]] std::optional<EulerBasis> parseEulerBasis(StringRef basis); | ||
|
|
||
| /** | ||
| * @brief Synthesizes a composed single-qubit unitary as gates in @p basis. | ||
| * | ||
| * Returns `std::nullopt` when @p hasNonBasisGate is false and resynthesis | ||
| * would not shorten a run of @p runSize gates; otherwise emits gates | ||
| * (including `qco.gphase` when needed). | ||
| * | ||
| * @param builder Builder for the emitted operations. | ||
| * @param loc Location for the emitted operations. | ||
| * @param qubit Input qubit value. | ||
| * @param composed Composed unitary to synthesize. | ||
| * @param runSize Number of gates in the run. | ||
| * @param hasNonBasisGate Whether the run contains a gate outside @p basis. | ||
| * @param basis The target Euler basis. | ||
| * @return The synthesized qubit, or `std::nullopt` if synthesis is skipped. | ||
| */ | ||
| [[nodiscard]] std::optional<Value> | ||
| synthesizeUnitary1QEuler(OpBuilder& builder, Location loc, Value qubit, | ||
| const Matrix2x2& composed, std::size_t runSize, | ||
| bool hasNonBasisGate, EulerBasis basis); | ||
|
|
||
| } // namespace mlir::qco::decomposition |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.