Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
f1140e1
Add "Layer" data structure
MatthiasReumann Mar 30, 2026
2fad455
Add split layer logic
MatthiasReumann Mar 30, 2026
391a27b
Add "fit" initial layout strategy
MatthiasReumann Mar 31, 2026
336f4dc
Add partitioning
MatthiasReumann Apr 1, 2026
f646661
Add fullLayers to unit test
MatthiasReumann Apr 1, 2026
43c5cd0
Fix Pass Option Description
MatthiasReumann Apr 1, 2026
6b06f38
Update CHANGELOG..md
MatthiasReumann Apr 1, 2026
15c3862
Fix linting issues
MatthiasReumann Apr 1, 2026
2e2b290
Apply bunny suggestions
MatthiasReumann Apr 1, 2026
d1a03c0
Merge branch 'main' into enh/improved-layering
MatthiasReumann Apr 1, 2026
820d9ff
Remove unused imports
MatthiasReumann Apr 1, 2026
6623145
Update pass option descriptions
MatthiasReumann Apr 1, 2026
dfdb923
Use entry point for executability check
MatthiasReumann Apr 1, 2026
eaab159
Update function description
MatthiasReumann Apr 1, 2026
c262d5f
Merge branch 'refs/heads/main' into enh/improved-layering
burgholzer Apr 1, 2026
ab899f3
🎨 Reduce includes through forward declaration
burgholzer Apr 1, 2026
7252d16
🔀 Fixes after merge
burgholzer Apr 1, 2026
c0300a0
🎨 Miscelaneous code quality optimizations
burgholzer Apr 1, 2026
8f08084
Add first walkLayer draft
MatthiasReumann Apr 2, 2026
ad49626
Improve naming
MatthiasReumann Apr 2, 2026
806fe1a
Improve walkLayer API
MatthiasReumann Apr 3, 2026
54415f3
Add convienience method
MatthiasReumann Apr 3, 2026
9db964d
Add function signature
MatthiasReumann Apr 3, 2026
726a69b
Improve API
MatthiasReumann Apr 3, 2026
bce9979
Add walkCircuitGraph driver
MatthiasReumann Apr 8, 2026
fe191e2
Clean up functions
MatthiasReumann Apr 8, 2026
d3ea059
Merge branch 'main' into enh/improved-layering
MatthiasReumann Apr 8, 2026
ef56ec9
Use llvm::priority_queue
MatthiasReumann Apr 8, 2026
3c620d4
Make tensors "work"
MatthiasReumann Apr 8, 2026
1132b30
Fix tests
MatthiasReumann Apr 8, 2026
8132ff7
Add walkQubitBlock and clean up a bit
MatthiasReumann Apr 8, 2026
f028b0a
Fix segmentation fault
MatthiasReumann Apr 9, 2026
6dd34df
Fix another segmentation fault
MatthiasReumann Apr 9, 2026
25ca7a3
Fix linting
MatthiasReumann Apr 9, 2026
a87443a
Remove mapping pass from compiler pipeline
MatthiasReumann Apr 9, 2026
46e36fe
Remove layout info
MatthiasReumann Apr 9, 2026
fded839
Fix linting
MatthiasReumann Apr 9, 2026
972fc9e
Implement partial solution A*
MatthiasReumann Apr 9, 2026
b1c5eb8
Final linting issues
MatthiasReumann Apr 9, 2026
0cccb05
Remove enumerations
MatthiasReumann Apr 10, 2026
6ef4e68
Add architecture to pass constructor
MatthiasReumann Apr 13, 2026
7f24f77
Improve runtime of skipTwoQubitBlock
MatthiasReumann Apr 13, 2026
def22ec
Use make_filter_range and workset approach
MatthiasReumann Apr 14, 2026
d127c6f
Update isGoal method
MatthiasReumann Apr 14, 2026
43ec985
Fix empty window bug
MatthiasReumann Apr 14, 2026
6c6ff04
Try individual gate strategy
MatthiasReumann Apr 14, 2026
a3ea538
Implement templated route function
MatthiasReumann Apr 17, 2026
f22a7f3
Merge branch 'main' into enh/improved-layering
MatthiasReumann Apr 17, 2026
858678f
Fix lint
MatthiasReumann Apr 17, 2026
6791aec
🎨 pre-commit fixes
pre-commit-ci[bot] Apr 17, 2026
d42623c
Fix direction in refineLayout
MatthiasReumann Apr 17, 2026
a0b09c9
Add anonym namespace
MatthiasReumann Apr 17, 2026
8503afa
Merge branch 'enh/improved-layering' of https://github.com/munich-qua…
MatthiasReumann Apr 17, 2026
fa805fc
Add two-qubit block skipping
MatthiasReumann Apr 17, 2026
f0a1175
Add documentation
MatthiasReumann Apr 17, 2026
d52d2bb
🎨 pre-commit fixes
pre-commit-ci[bot] Apr 17, 2026
002ea5c
Sort window items by complexity
MatthiasReumann Apr 21, 2026
9b68929
Remove sorting of windows as it didn't improve quality
MatthiasReumann Apr 22, 2026
ee29ee2
Merge branch 'main' into enh/improved-layering
MatthiasReumann Apr 29, 2026
c35db4d
🎨 pre-commit fixes
pre-commit-ci[bot] Apr 29, 2026
aecc320
Revert default ntrails to 4
MatthiasReumann Apr 29, 2026
62dac7f
Removed unused function_ref
MatthiasReumann Apr 29, 2026
b4fd16f
Remove debug header
MatthiasReumann Apr 29, 2026
b3c8c3e
Remove debug header in Mapping.cpp
MatthiasReumann Apr 29, 2026
2a60fec
Clean up code
MatthiasReumann Apr 29, 2026
8a35d2e
Slightly improve placement function
MatthiasReumann Apr 29, 2026
52c9be7
Apply bunny's suggestions
MatthiasReumann Apr 29, 2026
093064d
Merge branch 'main' into enh/improved-layering
denialhaag Apr 29, 2026
4989dfb
Fix linter errors
denialhaag Apr 29, 2026
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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This project adheres to [Semantic Versioning], with the exception that minor rel

- ✨ Add a `merge-single-qubit-rotation-gates` pass for merging consecutive rotation gates using quaternions ([#1407]) ([**@J4MMlE**])
- ✨ Add conversions between `jeff` and QCO ([#1479], [#1548], [#1565], [#1637]) ([**@denialhaag**])
- ✨ Add a `place-and-route` pass for mapping circuits to architectures with restricted topologies ([#1537], [#1547], [#1568], [#1581], [#1583], [#1588], [#1664]) ([**@MatthiasReumann**], [**@burgholzer**])
- ✨ Add a `place-and-route` pass for mapping circuits to architectures with restricted topologies ([#1537], [#1547], [#1568], [#1581], [#1583], [#1588], [#1600], [#1664]) ([**@MatthiasReumann**], [**@burgholzer**])
- ✨ Add initial infrastructure for new QC and QCO MLIR dialects
([#1264], [#1330], [#1402], [#1428], [#1430], [#1436], [#1443], [#1446], [#1464], [#1465], [#1470], [#1471], [#1472], [#1474], [#1475], [#1506], [#1510], [#1513], [#1521], [#1542], [#1548], [#1550], [#1554], [#1567], [#1569], [#1570], [#1572], [#1573], [#1580], [#1602], [#1620], [#1623], [#1624], [#1626], [#1627], [#1635], [#1673])
([**@burgholzer**], [**@denialhaag**], [**@taminob**], [**@DRovara**], [**@li-mingbao**], [**@Ectras**], [**@MatthiasReumann**], [**@simon1hofmann**])
Expand Down Expand Up @@ -373,6 +373,7 @@ _📚 Refer to the [GitHub Release Notes](https://github.com/munich-quantum-tool
[#1623]: https://github.com/munich-quantum-toolkit/core/pull/1623
[#1620]: https://github.com/munich-quantum-toolkit/core/pull/1620
[#1602]: https://github.com/munich-quantum-toolkit/core/pull/1602
[#1600]: https://github.com/munich-quantum-toolkit/core/pull/1600
[#1596]: https://github.com/munich-quantum-toolkit/core/pull/1596
[#1593]: https://github.com/munich-quantum-toolkit/core/pull/1593
[#1588]: https://github.com/munich-quantum-toolkit/core/pull/1588
Expand Down
15 changes: 12 additions & 3 deletions mlir/include/mlir/Dialect/QCO/Transforms/Mapping/Architecture.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#pragma once

#include <llvm/ADT/ArrayRef.h>
#include <llvm/ADT/DenseSet.h>
#include <llvm/ADT/SmallVector.h>
#include <mlir/Support/LLVM.h>
Expand All @@ -32,8 +33,8 @@ class [[nodiscard]] Architecture {
CouplingSet couplingSet)
: name_(std::move(name)), nqubits_(nqubits),
couplingSet_(std::move(couplingSet)), neighbours_(nqubits),
dist_(nqubits, SmallVector<size_t>(nqubits, UINT64_MAX)),
prev_(nqubits, SmallVector<size_t>(nqubits, UINT64_MAX)) {
dist_(nqubits, SmallVector<std::size_t>(nqubits, UINT64_MAX)),
prev_(nqubits, SmallVector<std::size_t>(nqubits, UINT64_MAX)) {
floydWarshallWithPathReconstruction();
collectNeighbours();
}
Expand Down Expand Up @@ -61,7 +62,7 @@ class [[nodiscard]] Architecture {
/**
* @brief Collect all neighbours of @p u.
*/
[[nodiscard]] SmallVector<std::size_t, 4> neighboursOf(std::size_t u) const;
[[nodiscard]] ArrayRef<std::size_t> neighboursOf(std::size_t u) const;

/**
* @brief Return the maximum degree (connectivity) of any qubit in the
Expand All @@ -72,6 +73,9 @@ class [[nodiscard]] Architecture {
private:
using Matrix = SmallVector<SmallVector<std::size_t, 0>, 0>;

Architecture() : nqubits_(0) {}
friend Architecture getEmptyArchitecture();

/**
* @brief Find all shortest paths in the coupling map between two qubits.
* @details Vertices are the qubits. Edges connected two qubits. Has a time
Expand All @@ -95,4 +99,9 @@ class [[nodiscard]] Architecture {
Matrix prev_;
};

/**
* @brief Return an empty architecture with no qubits and no coupling.
*/
[[nodiscard]] Architecture getEmptyArchitecture();

} // namespace mlir::qco
40 changes: 40 additions & 0 deletions mlir/include/mlir/Dialect/QCO/Transforms/Mapping/Mapping.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* 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/Transforms/Passes.h"

#include <llvm/Support/LogicalResult.h>
#include <mlir/IR/Region.h>
#include <mlir/Pass/Pass.h>

#include <memory>

namespace mlir::qco {

// Forward declaration
class Architecture;

/**
* @brief Verifies if all two-qubit gates within the region are executable on
* the targeted architecture. Expects static qubits only.
* @returns llvm::success() if executable, llvm::failure() otherwise.
*/
LogicalResult isExecutable(Region& region, const Architecture& arch);

/**
* @brief Create a mapping pass instance with the given target architecture.
* @returns a pass object.
*/
std::unique_ptr<Pass>
createMappingPass(std::shared_ptr<Architecture> arch,
MappingPassOptions options = MappingPassOptions{});
Comment thread
MatthiasReumann marked this conversation as resolved.
} // namespace mlir::qco
4 changes: 2 additions & 2 deletions mlir/include/mlir/Dialect/QCO/Transforms/Passes.td
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ def MappingPass : Pass<"place-and-route", "mlir::ModuleOp"> {
"The alpha factor in the cost function. Must be > 0.">,
Option<"lambda", "lambda", "float", "0.5F",
"The lambda factor in the cost function.">,
Option<"niterations", "niterations", "std::size_t", "2",
Option<"niterations", "niterations", "std::size_t", "1",
"The number of forwards and backwards traversal to "
"improve the initial layout.">,
"improve the initial layout. Must be > 0.">,
Option<"ntrials", "ntrials", "std::size_t", "4",
"The number of (possibly parallel) random trials of "
"the forwards and backwards mechanism. Must be > 0.">,
Expand Down
3 changes: 3 additions & 0 deletions mlir/include/mlir/Dialect/QCO/Utils/Drivers.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@
#include "mlir/Dialect/QCO/Utils/WireIterator.h"
#include "mlir/Dialect/QTensor/IR/QTensorOps.h"

#include <llvm/ADT/ADL.h>
#include <llvm/ADT/STLExtras.h>
#include <llvm/ADT/TypeSwitch.h>
#include <mlir/IR/Region.h>
#include <mlir/IR/Value.h>
#include <mlir/IR/Visitors.h>
#include <mlir/Support/LLVM.h>
#include <mlir/Support/WalkResult.h>

#include <cstddef>
#include <functional>
Expand Down
5 changes: 5 additions & 0 deletions mlir/include/mlir/Dialect/QCO/Utils/Qubits.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ class Qubits {
*/
[[nodiscard]] TypedValue<QubitType> getHardwareQubit(std::size_t index) const;

/**
* @returns the index assigned to the qubit value.
*/
[[nodiscard]] std::size_t getIndex(TypedValue<QubitType> q) const;

private:
DenseMap<std::size_t, TypedValue<QubitType>> programToValue_;
DenseMap<std::size_t, TypedValue<QubitType>> hardwareToValue_;
Expand Down
6 changes: 3 additions & 3 deletions mlir/lib/Dialect/QCO/Transforms/Mapping/Architecture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

#include "mlir/Dialect/QCO/Transforms/Mapping/Architecture.h"

#include <llvm/ADT/SmallVector.h>
#include <llvm/ADT/Twine.h>
#include <llvm/Support/ErrorHandling.h>
#include <mlir/Support/LLVM.h>
Expand All @@ -24,6 +23,8 @@
using namespace mlir;
using namespace mlir::qco;

Architecture mlir::qco::getEmptyArchitecture() { return {}; }

std::string_view Architecture::name() const { return name_; }

std::size_t Architecture::nqubits() const { return nqubits_; }
Expand All @@ -41,8 +42,7 @@ std::size_t Architecture::distanceBetween(std::size_t u, std::size_t v) const {
return dist_[u][v];
}

SmallVector<std::size_t, 4>
Architecture::neighboursOf(const std::size_t u) const {
ArrayRef<std::size_t> Architecture::neighboursOf(std::size_t u) const {
return neighbours_[u];
}

Expand Down
Loading
Loading