Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
bcf595b
snapshot
taminob Sep 15, 2025
a06cb1b
copied rust code
taminob Sep 16, 2025
83a75c4
🎨 pre-commit fixes
pre-commit-ci[bot] Sep 16, 2025
1dc459b
snapshot
taminob Oct 6, 2025
95d7cae
snapshot
taminob Oct 7, 2025
512fbe8
snapshot
taminob Oct 7, 2025
ea302dd
minor additions
taminob Oct 9, 2025
91fd9c0
add pass to Passes.td
taminob Oct 9, 2025
8cf929f
snapshot
taminob Oct 9, 2025
2032436
compiling snapshot
taminob Oct 13, 2025
fe81855
tmp
taminob Oct 15, 2025
3df1e5c
switch to long double
taminob Oct 16, 2025
f080bc6
testing a.cpp
taminob Oct 16, 2025
792d082
add zgemm for testing, start euler decomposition implementation
taminob Oct 19, 2025
5bd31b4
non-working but finished snapshot
taminob Oct 21, 2025
5982c45
fix out-of-bounds issues
taminob Oct 22, 2025
2e86550
test using Armadillo
taminob Oct 22, 2025
6b110b8
minor fix
taminob Oct 22, 2025
4a6c1bc
tmp
taminob Oct 24, 2025
7ef7fde
work on gate application
taminob Oct 27, 2025
0254818
use laughing-umbrella implementation for decompose_two_qubit_product_…
taminob Oct 27, 2025
e5f659e
add more eigen decomposition implementations
taminob Oct 27, 2025
ae3d08d
work on applySeries()
taminob Oct 27, 2025
d2f4456
Revert "use laughing-umbrella implementation for decompose_two_qubit_…
taminob Oct 27, 2025
58c4ec3
fix transpose_conjugate
taminob Oct 27, 2025
5aa5d87
add test
taminob Oct 30, 2025
2359f28
actually kind of working snapshot?
taminob Oct 30, 2025
4435948
fix test case
taminob Oct 30, 2025
0b12cb3
minor fix
taminob Oct 30, 2025
e3dbdb3
fix test case
taminob Oct 30, 2025
3974582
add new test, fix tests
taminob Oct 30, 2025
458d187
iniital complexSeries test
taminob Nov 4, 2025
4cb24a0
use Eigen for multiply() and determinant()
taminob Nov 4, 2025
4cbc85e
fix gate matrix multiplication
taminob Nov 4, 2025
374454b
add simple (too simple) series complexity
taminob Nov 4, 2025
26b11a2
fix insertion when operations which are not part of the series are in…
taminob Nov 4, 2025
2b648a9
add gate matrices
taminob Nov 4, 2025
f559334
sequence complexity()
taminob Nov 6, 2025
85d204c
print debugging :)
taminob Nov 6, 2025
1036007
longer complex test to pass sequence complexity check
taminob Nov 6, 2025
1d654d1
use CXGate() definition for decomposer
taminob Nov 10, 2025
bba842c
add cnot test other direction
taminob Nov 10, 2025
bda98d0
tmp (to be deleted)
taminob Nov 10, 2025
246879c
re-write using Eigen
taminob Nov 10, 2025
d50484d
delete pulse-optimizer code (KEEP for future; should be re-added at s…
taminob Nov 10, 2025
9f7ac0e
use designated initializer lists
taminob Nov 11, 2025
c69618f
fix warnings, rename all variables
taminob Nov 11, 2025
f055925
test normalized magic basis, allow complex eigenvector decomposition
taminob Nov 11, 2025
be2feca
finally figured some stuff out
taminob Nov 11, 2025
d39d2ec
try out lauging-umbrella weyl-chamber
taminob Nov 12, 2025
0013723
try to implement weylchamber.c1c2c3 algorithm
taminob Nov 12, 2025
d28ab9d
on_gates two-qubit product decompose
taminob Nov 12, 2025
d6c6a8b
minor additions
taminob Nov 12, 2025
d294635
try ordering all four eigenvectors
taminob Nov 12, 2025
5c1d56b
undo ordering of all columns
taminob Nov 12, 2025
388ca6b
implement algorithm based on quantumflow.canonical_decomposition
taminob Nov 13, 2025
fbd6647
sanity checks and stuff
taminob Nov 13, 2025
db09335
add original implementation again which seems to kind of work?
taminob Nov 13, 2025
afd19ee
generate openqasm code of generated sequence
taminob Nov 14, 2025
79ced7b
some more small fixes, maybe breakthrough?
taminob Nov 14, 2025
65057a0
rework getTwoQubitSeries logic
taminob Nov 14, 2025
61e5678
generate openqasm code of found series
taminob Nov 14, 2025
812fcd7
fix new getTwoQubitSeries logic
taminob Nov 14, 2025
53f53c8
working except global phase?
taminob Nov 15, 2025
1a0eebb
fix global phase issues
taminob Nov 15, 2025
cb85552
first working snapshot
taminob Nov 16, 2025
09c9f2b
very minor cleanup
taminob Nov 16, 2025
fb0366d
add more sanity checks for unitary
taminob Nov 16, 2025
0a41410
find and fix minor formula mistake
taminob Nov 16, 2025
5bc93d9
test update
taminob Nov 16, 2025
27b4cf8
make calculations exact without approximation
taminob Nov 17, 2025
0a02763
respect gphase of circuit and fix series collection bug
taminob Nov 17, 2025
786143e
change global phase to local phase
taminob Nov 17, 2025
a9bf676
revert to global phase, fix controlled gate qubit order
taminob Nov 18, 2025
3a132ec
fix first couple of tests
taminob Nov 18, 2025
3b61c08
start working on basis set and remove dead code
taminob Nov 18, 2025
dff3f30
decompose for all bases, choose best
taminob Nov 18, 2025
e3f67b9
add checks for most tests
taminob Nov 18, 2025
b89d602
TMP, needs to be removed; allow OpenQASM export with round-trip pass
taminob Nov 18, 2025
c531c56
add single-qubit backtracking
taminob Nov 19, 2025
75d64a3
fix atol issues
taminob Nov 19, 2025
13d9a0d
add more euler bases to pattern
taminob Nov 19, 2025
d14ac76
minor cleanup (renaming, comments, disable printing)
taminob Nov 19, 2025
453565f
Revert "TMP, needs to be removed; allow OpenQASM export with round-tr…
taminob Nov 19, 2025
29d01aa
remove armadillo in cmake
taminob Nov 20, 2025
b5f4b2d
more cleanup
taminob Nov 20, 2025
0084081
fix (?) tests
taminob Nov 20, 2025
50310f6
fix final test
taminob Nov 20, 2025
500ccc6
another minor cleanup
taminob Nov 20, 2025
9a4574e
clean sanity check prints up
taminob Nov 20, 2025
bf714ac
properly add Eigen lib to cmake
taminob Nov 20, 2025
0a528b9
remove unnecessary correction
taminob Nov 20, 2025
686ed5f
🎨 pre-commit fixes
pre-commit-ci[bot] Nov 20, 2025
09d105c
fix eigen compilation issues
taminob Nov 20, 2025
91fe42d
more cleanup
taminob Nov 20, 2025
1705f83
clean up weyl decomposition creation
taminob Nov 21, 2025
49d512f
remove openqasm code generation
taminob Nov 21, 2025
d8ab299
fix includes and use SmallVector instead of std::vector
taminob Nov 21, 2025
4ea6f02
fix or silence linter
taminob Nov 21, 2025
37b30e3
incorporate coderabbitai feedback
taminob Nov 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ include(PreventInSourceBuilds)
include(PackageAddTest)
include(Cache)
include(AddMQTCoreLibrary)
include(FetchContent)

FetchContent_Declare(
Eigen
GIT_REPOSITORY https://gitlab.com/libeigen/eigen.git
GIT_TAG 3.4.1
GIT_SHALLOW TRUE)
FetchContent_MakeAvailable(Eigen)

option(BUILD_MQT_CORE_BINDINGS "Build the MQT Core Python bindings" OFF)
if(BUILD_MQT_CORE_BINDINGS)
Expand Down
1 change: 1 addition & 0 deletions mlir/include/mlir/Dialect/MQTOpt/Transforms/Passes.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ enum class RoutingMethod : std::uint8_t { Naive, AStar };
#include "mlir/Dialect/MQTOpt/Transforms/Passes.h.inc" // IWYU pragma: export

void populateGateEliminationPatterns(mlir::RewritePatternSet& patterns);
void populateGateDecompositionPatterns(mlir::RewritePatternSet& patterns);
void populateMergeRotationGatesPatterns(mlir::RewritePatternSet& patterns);
void populateSwapReconstructionAndElisionPatterns(
mlir::RewritePatternSet& patterns);
Expand Down
9 changes: 9 additions & 0 deletions mlir/include/mlir/Dialect/MQTOpt/Transforms/Passes.td
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ def GateElimination : Pass<"gate-elimination", "mlir::ModuleOp"> {
}];
}

def GateDecomposition : Pass<"gate-decomposition", "mlir::ModuleOp"> {
let dependentDialects = [ "mlir::arith::ArithDialect", "mqt::ir::opt::MQTOptDialect" ];
let summary = "This pass performs various gate decompositions to translate quantum gates being used.";
let description = [{
Decomposes series of operations that operate on up to two qubits into a sequence of up to three
two-qubit basis gates and single-qubit operations.
}];
}

def MergeRotationGates : Pass<"merge-rotation-gates", "mlir::ModuleOp"> {
let summary = "This pass searches for consecutive applications of rotation gates that can be merged.";
let description = [{
Expand Down
2 changes: 1 addition & 1 deletion mlir/lib/Dialect/MQTOpt/Transforms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Licensed under the MIT License

get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
set(LIBRARIES ${dialect_libs} MQT::CoreIR)
set(LIBRARIES ${dialect_libs} MQT::CoreIR Eigen3::Eigen)
add_compile_options(-fexceptions)

file(GLOB_RECURSE TRANSFORMS_SOURCES *.cpp)
Expand Down
52 changes: 52 additions & 0 deletions mlir/lib/Dialect/MQTOpt/Transforms/GateDecomposition.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Copyright (c) 2023 - 2025 Chair for Design Automation, TUM
* Copyright (c) 2025 Munich Quantum Software Company GmbH
* All rights reserved.
*
* SPDX-License-Identifier: MIT
*
* Licensed under the MIT License
*/

#include "mlir/Dialect/MQTOpt/Transforms/Passes.h"

#include <mlir/IR/PatternMatch.h>
#include <mlir/Support/LLVM.h>
#include <mlir/Transforms/GreedyPatternRewriteDriver.h>
#include <utility>

namespace mqt::ir::opt {

#define GEN_PASS_DEF_GATEDECOMPOSITION
#include "mlir/Dialect/MQTOpt/Transforms/Passes.h.inc"

/**
* @brief This pass attempts to collect as many operations as possible into a
* 4x4 unitary matrix and then decompose it into 1q rotations and 2q
* basis gates.
*/
struct GateDecomposition final
: impl::GateDecompositionBase<GateDecomposition> {

void runOnOperation() override {
// Get the current operation being operated on.
auto op = getOperation();
auto* ctx = &getContext();

// Define the set of patterns to use.
mlir::RewritePatternSet patterns(ctx);
populateGateDecompositionPatterns(patterns);

// Configure greedy driver
mlir::GreedyRewriteConfig config;
config.setUseTopDownTraversal(true);

// Apply patterns in an iterative and greedy manner.
if (mlir::failed(
mlir::applyPatternsGreedily(op, std::move(patterns), config))) {
signalPassFailure();
}
}
};

} // namespace mqt::ir::opt
Loading
Loading