Skip to content
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
3e9099e
✨ Update QCO operations to reflect memory effects and enhance dealloc…
simon1hofmann Mar 17, 2026
6c77dbb
✨ Add `staticQubitWithOp` function to allocate a static qubit and app…
simon1hofmann Mar 17, 2026
646cf3e
✅ Add test cases for `staticQubitWithOp` across various dialects (QC,…
simon1hofmann Mar 17, 2026
ea7b675
🔧 Add missing include for LLVM casting support in QCOToQC.cpp
simon1hofmann Mar 17, 2026
b824284
✨ Rename `staticQubitWithOp` to `staticQubitsWithOps` and update rela…
simon1hofmann Mar 17, 2026
c2d414f
🔧 Enhance `ConvertFuncReturnOp` to exclude escaped qubits from the li…
simon1hofmann Mar 17, 2026
0b81e9c
✨ Enhance QubitType to support static and dynamic qubits, updating re…
simon1hofmann Mar 19, 2026
0221058
✨ Update QubitType handling in QCO and QC dialects to support static …
simon1hofmann Mar 19, 2026
a5ffdef
🔧 Refactor QCO and QC dialects: remove unnecessary includes, simplify…
simon1hofmann Mar 19, 2026
6af63db
✨ Introduce StaticQubit type in QC and QCO dialects, enhance StaticOp…
simon1hofmann Mar 19, 2026
08410f6
🔧 Update QCO and QC dialects: add missing LLVM casting includes, enha…
simon1hofmann Mar 19, 2026
893a746
Merge branch 'main' into static_qubit_handling
simon1hofmann Mar 19, 2026
ec4f2fa
🔧 Update StaticOp to output StaticQubit type and remove unnecessary v…
simon1hofmann Mar 19, 2026
6ff64e4
🔧 Refactor QubitType definitions in QC dialect: reintroduce DynamicQu…
simon1hofmann Mar 19, 2026
e0689dc
🔧 Add DynamicQubit and StaticQubit type definitions in QCO dialect, u…
simon1hofmann Mar 19, 2026
c624c3d
🔧 Update AllocOp to return DynamicQubit type, refactor ConvertFuncRet…
simon1hofmann Mar 19, 2026
8499977
🔧 Enhance QCO operations with type verification: add input-output typ…
simon1hofmann Mar 19, 2026
a16da14
Apply suggestions from code review
simon1hofmann Mar 20, 2026
adb5192
🔧 Refactor QCO operations to improve static qubit handling: update St…
simon1hofmann Mar 20, 2026
34a6ffe
Merge branch 'main' into static_qubit_handling
simon1hofmann Mar 20, 2026
ea8b155
🎨 pre-commit fixes
pre-commit-ci[bot] Mar 20, 2026
95970d6
🔧 Implement synchronizeMappedQubitTypes function to align qubit resul…
simon1hofmann Mar 20, 2026
0ed81fa
🔧 Update conversion patterns in QCO, QC, and QIR dialects to ensure c…
simon1hofmann Mar 20, 2026
c9d1b8f
🔧 Add missing includes in QCOToQC and Mapping.
simon1hofmann Mar 20, 2026
acdc0cb
🔧 Refactor qubit mapping in QCToQCO conversion patterns to use per-re…
simon1hofmann Mar 20, 2026
c3e1b2a
🐧 Fix compile error on Linux due to missing link library
burgholzer Mar 20, 2026
3dcb30a
✏️ Rename SSABeforeForDeallocOrder to SSAOrder and tweak docstring
burgholzer Mar 20, 2026
417857a
🎨 Replace two-qubit gate programs with gate that is less likely to be…
burgholzer Mar 20, 2026
4c8c0f9
🚨 Fix use of outdated rewrite method
burgholzer Mar 20, 2026
d6ad7c4
🎨 Refine static qubit handling to require less casting
burgholzer Mar 20, 2026
9c807b7
🩹 Mark result of `qc.alloc` as dynamic qubit
burgholzer Mar 20, 2026
ef2bdaa
🎨 one cast less
burgholzer Mar 20, 2026
bf3b82e
🎨 Incremental code quality improvements to the QCToQCO conversion
burgholzer Mar 20, 2026
57e150a
♻️ Streamline QCToQCO conversion by introducing helper functions
burgholzer Mar 20, 2026
2b6f808
🚨 Fix clang-tidy warnings
burgholzer Mar 20, 2026
20a7e6a
🐛 Fix the logic in `synchronizeMappedQubitTypes` and add dedicated tests
burgholzer Mar 21, 2026
3166aa0
✨ Update mapping pass to use `IRRewriter`.
simon1hofmann Mar 23, 2026
01e9861
✨ clang-tidy and coderabbit comments.
simon1hofmann Mar 23, 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 @@ -15,7 +15,7 @@ This project adheres to [Semantic Versioning], with the exception that minor rel
- ✨ Add conversions between Jeff and QCO ([#1479], [#1548], [#1565]) ([**@denialhaag**])
- ✨ 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], [#1542], [#1548], [#1550], [#1554], [#1570])
([#1264], [#1330], [#1402], [#1428], [#1430], [#1436], [#1443], [#1446], [#1464], [#1465], [#1470], [#1471], [#1472], [#1474], [#1475], [#1506], [#1510], [#1513], [#1521], [#1542], [#1548], [#1550], [#1554], [#1569], [#1570])
([**@burgholzer**], [**@denialhaag**], [**@taminob**], [**@DRovara**], [**@li-mingbao**], [**@Ectras**], [**@MatthiasReumann**], [**@simon1hofmann**])

### Changed
Expand Down Expand Up @@ -335,6 +335,7 @@ _📚 Refer to the [GitHub Release Notes](https://github.com/munich-quantum-tool

[#1571]: https://github.com/munich-quantum-toolkit/core/pull/1571
[#1570]: https://github.com/munich-quantum-toolkit/core/pull/1570
[#1569]: https://github.com/munich-quantum-toolkit/core/pull/1569
[#1568]: https://github.com/munich-quantum-toolkit/core/pull/1568
[#1565]: https://github.com/munich-quantum-toolkit/core/pull/1565
[#1564]: https://github.com/munich-quantum-toolkit/core/pull/1564
Expand Down
25 changes: 19 additions & 6 deletions mlir/include/mlir/Dialect/QC/IR/QCOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -65,31 +65,37 @@ def AllocOp : QCOp<"alloc", [MemoryEffects<[MemAlloc]>]> {

let builders = [
OpBuilder<(ins), [{
build($_builder, $_state, QubitType::get($_builder.getContext()), nullptr, nullptr, nullptr);
build($_builder, $_state, QubitType::get($_builder.getContext(), /*isStatic=*/false), nullptr, nullptr, nullptr);
}]>,
OpBuilder<(ins "::mlir::StringAttr":$register_name,
"::mlir::IntegerAttr":$register_size,
"::mlir::IntegerAttr":$register_index), [{
build($_builder, $_state, QubitType::get($_builder.getContext()),
build($_builder, $_state, QubitType::get($_builder.getContext(), /*isStatic=*/false),
register_name, register_size, register_index);
}]>
];

let hasVerifier = 1;
}

def DynamicQubit : Type<
And<[CPred<"::mlir::isa<::mlir::qc::QubitType>($_self)">,
CPred<"!::mlir::cast<::mlir::qc::QubitType>($_self).getIsStatic()">]>,
"dynamic qubit type (!qc.qubit)">;

def DeallocOp : QCOp<"dealloc", [MemoryEffects<[MemFree]>]> {
let summary = "Deallocate a qubit";
let summary = "Deallocate a dynamically allocated qubit";
let description = [{
Deallocates a qubit, releasing its resources.
Deallocates a dynamically allocated qubit, releasing its resources.
Static qubits (`!qc.qubit<static>`) cannot be deallocated.

Example:
```mlir
qc.dealloc %q : !qc.qubit
```
}];

let arguments = (ins QubitType:$qubit);
let arguments = (ins DynamicQubit:$qubit);
let assemblyFormat = "$qubit attr-dict `:` type($qubit)";

let hasCanonicalizer = 1;
Expand All @@ -104,13 +110,20 @@ def StaticOp : QCOp<"static", [Pure]> {

Example:
```mlir
%q = qc.static 0 : !qc.qubit
%q = qc.static 0 : !qc.qubit<static>
```
}];

let arguments = (ins ConfinedAttr<I64Attr, [IntNonNegative]>:$index);
let results = (outs QubitType:$qubit);
let assemblyFormat = "$index attr-dict `:` type($qubit)";

let builders = [
OpBuilder<(ins "int64_t":$index), [{
build($_builder, $_state, QubitType::get($_builder.getContext(), /*isStatic=*/true),
$_builder.getI64IntegerAttr(index));
}]>
];
}

//===----------------------------------------------------------------------===//
Expand Down
11 changes: 11 additions & 0 deletions mlir/include/mlir/Dialect/QC/IR/QCTypes.td
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,18 @@ def QubitType : QCType<"Qubit", "qubit"> {
QC dialect. Operations using this type modify qubits in place using
reference semantics, similar to how classical imperative languages handle
mutable references.

`!qc.qubit` (default) denotes a dynamically allocated qubit.
`!qc.qubit<static>` denotes a qubit that has been mapped to a fixed
hardware position.
}];
let parameters = (ins DefaultValuedParameter<"bool", "false">:$isStatic);
let builders = [
TypeBuilder<(ins), [{
return $_get($_ctxt, /*isStatic=*/false);
}]>
];
let hasCustomAssemblyFormat = 1;
}

#endif // MLIR_DIALECT_QC_IR_QCTYPES_TD
Loading
Loading