Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
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 Sampler and Estimator Primitives to the QDMI-Qiskit Interface ([#1507]) ([**@marcelwa**])
- ✨ Add conversions between Jeff and QCO ([#1479], [#1548]) ([**@denialhaag**])
- ✨ Add a `place-and-route` pass for mapping circuits to architectures with restricted topologies ([#1537], [#1547]) ([**@MatthiasReumann**])
- ✨ Add a `place-and-route` pass for mapping circuits to architectures with restricted topologies ([#1537], [#1547], [#1568]) ([**@MatthiasReumann**])
- ✨ 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], [#1548], [#1550], [#1554])
([**@burgholzer**], [**@denialhaag**], [**@taminob**], [**@DRovara**], [**@li-mingbao**], [**@Ectras**], [**@MatthiasReumann**], [**@simon1hofmann**])
Expand Down Expand Up @@ -331,6 +331,7 @@ _📚 Refer to the [GitHub Release Notes](https://github.com/munich-quantum-tool

<!-- PR links -->

[#1568]: https://github.com/munich-quantum-toolkit/core/pull/1568
[#1554]: https://github.com/munich-quantum-toolkit/core/pull/1554
[#1550]: https://github.com/munich-quantum-toolkit/core/pull/1550
[#1549]: https://github.com/munich-quantum-toolkit/core/pull/1549
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ class [[nodiscard]] Architecture {
[[nodiscard]] mlir::SmallVector<std::size_t, 4>
neighboursOf(std::size_t u) const;

/**
* @brief Return the maximum degree (connectivity) of any qubit in the
* architecture.
*/
[[nodiscard]] std::size_t maxDegree() const;

private:
using Matrix = mlir::SmallVector<mlir::SmallVector<std::size_t, 0>, 0>;

Expand Down
9 changes: 8 additions & 1 deletion mlir/include/mlir/Dialect/QCO/Transforms/Passes.td
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ def MappingPass : Pass<"place-and-route", "mlir::ModuleOp"> {
each traversal, the pass routes the circuit and updates the dynamic-to-static mapping based on the routing decisions
made during that traversal. By performing multiple traversals, the pass can iteratively refine the mapping and
potentially find a more optimal solution. This is behavior is controlled by the `niterations` parameter.

The pass option `ntrials` determines how many random initial layouts the pass explores. Per default, the pass always
explores the identity layout. If compiled with multi-threading on, these trials will be executed in parallel.
}];
let options = [
Option<"nlookahead", "nlookahead", "std::size_t", "1",
Expand All @@ -58,7 +61,11 @@ def MappingPass : Pass<"place-and-route", "mlir::ModuleOp"> {
Option<"lambda", "lambda", "float", "0.5F",
"The lambda factor in the cost function.">,
Option<"niterations", "niterations", "std::size_t", "2",
"The number of forwards and backwards traversal to improve the initial layout.">
"The number of forwards and backwards traversal to improve the initial layout.">,
Option<"ntrials", "ntrials", "std::size_t", "4",
"The number of (possibly parallel) random trials of the forwards and backwards mechanism.">,
Option<"seed", "seed", "std::size_t", "42",
"A seed used for randomization.">
];
}

Expand Down
8 changes: 8 additions & 0 deletions mlir/lib/Dialect/QCO/Transforms/Mapping/Architecture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,11 @@
neighbours_[u].push_back(v);
}
}

std::size_t Architecture::maxDegree() const {
std::size_t deg = 0;
for (const auto& nbrs : neighbours_) {
deg = std::max(deg, nbrs.size());

Check warning on line 79 in mlir/lib/Dialect/QCO/Transforms/Mapping/Architecture.cpp

View workflow job for this annotation

GitHub Actions / 🇨‌ Lint / 🚨 Lint

mlir/lib/Dialect/QCO/Transforms/Mapping/Architecture.cpp:79:16 [misc-include-cleaner]

no header providing "std::max" is directly included
}
return deg;
}
Loading
Loading