Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -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], [#1548], [#1550], [#1554])
([#1264], [#1330], [#1402], [#1428], [#1430], [#1436], [#1443], [#1446], [#1464], [#1465], [#1470], [#1471], [#1472], [#1474], [#1475], [#1506], [#1510], [#1513], [#1521], [#1548], [#1550], [#1554], [#1570])
([**@burgholzer**], [**@denialhaag**], [**@taminob**], [**@DRovara**], [**@li-mingbao**], [**@Ectras**], [**@MatthiasReumann**], [**@simon1hofmann**])

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

[#1571]: https://github.com/munich-quantum-toolkit/core/pull/1571
[#1570]: https://github.com/munich-quantum-toolkit/core/pull/1570
[#1568]: https://github.com/munich-quantum-toolkit/core/pull/1568
[#1565]: https://github.com/munich-quantum-toolkit/core/pull/1565
[#1554]: https://github.com/munich-quantum-toolkit/core/pull/1554
Expand Down
10 changes: 5 additions & 5 deletions docs/mlir/Conversions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@

## Internal Conversions

```{include} Conversions/MLIRQCToQCO.md
```{include} Conversions/QCToQCO.md

```

```{include} Conversions/MLIRQCOToQC.md
```{include} Conversions/QCOToQC.md

```

## Jeff Conversions

```{include} Conversions/MLIRQCOToJeff.md
```{include} Conversions/QCOToJeff.md

```

```{include} Conversions/MLIRJeffToQCO.md
```{include} Conversions/JeffToQCO.md

```

## QIR Conversions

```{include} Conversions/MLIRQCToQIR.md
```{include} Conversions/QCToQIR.md

```
4 changes: 2 additions & 2 deletions docs/mlir/QC.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
tocdepth: 3
---

```{include} Dialects/MLIRQCDialect.md
```{include} Dialects/QCDialect.md

```

```{include} Dialects/MLIRQCInterfaces.md
```{include} Dialects/QCInterfaces.md
:heading-offset: 1
Comment thread
denialhaag marked this conversation as resolved.
```
6 changes: 3 additions & 3 deletions docs/mlir/QCO.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
tocdepth: 3
---

```{include} Dialects/MLIRQCODialect.md
```{include} Dialects/QCODialect.md

```

```{include} Dialects/MLIRQCOInterfaces.md
```{include} Dialects/QCOInterfaces.md
:heading-offset: 1
```

## Passes

```{include} Passes/MLIRQCOTransforms.md
```{include} Passes/QCOTransforms.md
Comment thread
denialhaag marked this conversation as resolved.

```
2 changes: 1 addition & 1 deletion mlir/include/mlir/Conversion/JeffToQCO/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ set(LLVM_TARGET_DEFINITIONS JeffToQCO.td)
mlir_tablegen(JeffToQCO.h.inc -gen-pass-decls -name JeffToQCO)
add_public_tablegen_target(JeffToQCOIncGen)

add_mlir_doc(JeffToQCO MLIRJeffToQCO Conversions/ -gen-pass-doc)
add_mlir_doc(JeffToQCO JeffToQCO Conversions/ -gen-pass-doc)
2 changes: 1 addition & 1 deletion mlir/include/mlir/Conversion/QCOToJeff/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ set(LLVM_TARGET_DEFINITIONS QCOToJeff.td)
mlir_tablegen(QCOToJeff.h.inc -gen-pass-decls -name QCOToJeff)
add_public_tablegen_target(QCOToJeffIncGen)

add_mlir_doc(QCOToJeff MLIRQCOToJeff Conversions/ -gen-pass-doc)
add_mlir_doc(QCOToJeff QCOToJeff Conversions/ -gen-pass-doc)
2 changes: 1 addition & 1 deletion mlir/include/mlir/Conversion/QCOToQC/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ set(LLVM_TARGET_DEFINITIONS QCOToQC.td)
mlir_tablegen(QCOToQC.h.inc -gen-pass-decls -name QCOToQC)
add_public_tablegen_target(QCOToQCIncGen)

add_mlir_doc(QCOToQC MLIRQCOToQC Conversions/ -gen-pass-doc)
add_mlir_doc(QCOToQC QCOToQC Conversions/ -gen-pass-doc)
2 changes: 1 addition & 1 deletion mlir/include/mlir/Conversion/QCToQCO/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ set(LLVM_TARGET_DEFINITIONS QCToQCO.td)
mlir_tablegen(QCToQCO.h.inc -gen-pass-decls -name QCToQCO)
add_public_tablegen_target(QCToQCOIncGen)

add_mlir_doc(QCToQCO MLIRQCToQCO Conversions/ -gen-pass-doc)
add_mlir_doc(QCToQCO QCToQCO Conversions/ -gen-pass-doc)
2 changes: 1 addition & 1 deletion mlir/include/mlir/Conversion/QCToQIR/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ set(LLVM_TARGET_DEFINITIONS QCToQIR.td)
mlir_tablegen(QCToQIR.h.inc -gen-pass-decls -name QCToQIR)
add_public_tablegen_target(QCToQIRIncGen)

add_mlir_doc(QCToQIR MLIRQCToQIR Conversions/ -gen-pass-doc)
add_mlir_doc(QCToQIR QCToQIR Conversions/ -gen-pass-doc)
5 changes: 3 additions & 2 deletions mlir/include/mlir/Dialect/QC/IR/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@

add_mlir_dialect(QCOps qc)
add_mlir_interface(QCInterfaces)
add_mlir_doc(QCOps MLIRQCDialect Dialects/ -gen-dialect-doc)
add_mlir_doc(QCInterfaces MLIRQCInterfaces Dialects/ -gen-op-interface-docs -dialect=qc)

add_mlir_doc(QCOps QCDialect Dialects/ -gen-dialect-doc)
add_mlir_doc(QCInterfaces QCInterfaces Dialects/ -gen-op-interface-docs -dialect=qc)
Comment thread
denialhaag marked this conversation as resolved.
43 changes: 43 additions & 0 deletions mlir/include/mlir/Dialect/QC/IR/QCDialect.td
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// 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

#ifndef MLIR_DIALECT_QC_IR_QCDIALECT_TD
#define MLIR_DIALECT_QC_IR_QCDIALECT_TD

include "mlir/IR/DialectBase.td"

def QCDialect : Dialect {
let name = "qc";

let summary = "The QC (reference semantics) dialect for quantum computing.";

let description = [{
The QC dialect uses **reference semantics** where quantum operations
modify qubits in place, similar to how hardware physically transforms
quantum states. This model provides:

- Natural mapping to hardware execution models
- Intuitive representation for circuit descriptions
- Direct compatibility with imperative quantum programming languages
- Straightforward backend code generation

The name "QC" stands for "Quantum Circuit."

Example:
```mlir
qc.h %q // Applies Hadamard to qubit %q in place
qc.swap %q0, %q1 // Applies SWAP using %q0, %q1 as targets
```
}];

let cppNamespace = "::mlir::qc";

let useDefaultTypePrinterParser = 1;
}

#endif // MLIR_DIALECT_QC_IR_QCDIALECT_TD
6 changes: 3 additions & 3 deletions mlir/include/mlir/Dialect/QC/IR/QCInterfaces.td
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
//
// Licensed under the MIT License

#ifndef QC_INTERFACES
#define QC_INTERFACES
#ifndef MLIR_DIALECT_QC_IR_QCINTERFACES_TD
#define MLIR_DIALECT_QC_IR_QCINTERFACES_TD

include "mlir/IR/OpBase.td"

Expand Down Expand Up @@ -89,4 +89,4 @@ def UnitaryOpInterface : OpInterface<"UnitaryOpInterface"> {
];
}

#endif // QC_INTERFACES
#endif // MLIR_DIALECT_QC_IR_QCINTERFACES_TD
63 changes: 6 additions & 57 deletions mlir/include/mlir/Dialect/QC/IR/QCOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -6,70 +6,19 @@
//
// Licensed under the MIT License

#ifndef QC_OPS
#define QC_OPS
#ifndef MLIR_DIALECT_QC_IR_QCOPS_TD
#define MLIR_DIALECT_QC_IR_QCOPS_TD

include "mlir/Dialect/QC/IR/QCDialect.td"
include "mlir/Dialect/QC/IR/QCInterfaces.td"
include "mlir/IR/BuiltinTypeInterfaces.td"
include "mlir/IR/DialectBase.td"
include "mlir/Dialect/QC/IR/QCTypes.td"

include "mlir/IR/EnumAttr.td"
include "mlir/IR/OpBase.td"
include "mlir/IR/RegionKindInterface.td"
include "mlir/Interfaces/InferTypeOpInterface.td"
include "mlir/Interfaces/SideEffectInterfaces.td"

//===----------------------------------------------------------------------===//
// QC Dialect Definition
//===----------------------------------------------------------------------===//

def QCDialect : Dialect {
let name = "qc";

let summary = "The QC (reference semantics) dialect for quantum computing.";

let description = [{
The QC dialect uses **reference semantics** where quantum operations
modify qubits in place, similar to how hardware physically transforms
quantum states. This model provides:

- Natural mapping to hardware execution models
- Intuitive representation for circuit descriptions
- Direct compatibility with imperative quantum programming languages
- Straightforward backend code generation

The name "QC" stands for "Quantum Circuit."

Example:
```mlir
qc.h %q // Applies Hadamard to qubit %q in place
qc.swap %q0, %q1 // Applies SWAP using %q0, %q1 as targets
```
}];

let cppNamespace = "::mlir::qc";

let useDefaultTypePrinterParser = 1;
}

//===----------------------------------------------------------------------===//
// QC Type Definitions
//===----------------------------------------------------------------------===//

class QCType<string name, string typeMnemonic, list<Trait> traits = []>
: TypeDef<QCDialect, name, traits> {
let mnemonic = typeMnemonic;
}

def QubitType : QCType<"Qubit", "qubit"> {
let summary = "QC qubit reference type";
let description = [{
The `!qc.qubit` type represents a reference to a quantum bit in the
QC dialect. Operations using this type modify qubits in place using
reference semantics, similar to how classical imperative languages handle
mutable references.
}];
}

//===----------------------------------------------------------------------===//
// Base Operation Classes
//===----------------------------------------------------------------------===//
Expand Down Expand Up @@ -1015,4 +964,4 @@ def InvOp : QCOp<"inv",
let hasVerifier = 1;
}

#endif // QC_OPS
#endif // MLIR_DIALECT_QC_IR_QCOPS_TD
31 changes: 31 additions & 0 deletions mlir/include/mlir/Dialect/QC/IR/QCTypes.td
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// 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

#ifndef MLIR_DIALECT_QC_IR_QCTYPES_TD
#define MLIR_DIALECT_QC_IR_QCTYPES_TD

include "mlir/Dialect/QC/IR/QCDialect.td"

include "mlir/IR/AttrTypeBase.td"

class QCType<string name, string typeMnemonic, list<Trait> traits = []>
: TypeDef<QCDialect, name, traits> {
let mnemonic = typeMnemonic;
}

def QubitType : QCType<"Qubit", "qubit"> {
let summary = "QC qubit reference type";
let description = [{
The `!qc.qubit` type represents a reference to a quantum bit in the
QC dialect. Operations using this type modify qubits in place using
reference semantics, similar to how classical imperative languages handle
mutable references.
}];
}

#endif // MLIR_DIALECT_QC_IR_QCTYPES_TD
5 changes: 3 additions & 2 deletions mlir/include/mlir/Dialect/QCO/IR/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@

add_mlir_dialect(QCOOps qco)
add_mlir_interface(QCOInterfaces)
add_mlir_doc(QCOOps MLIRQCODialect Dialects/ -gen-dialect-doc)
add_mlir_doc(QCOInterfaces MLIRQCOInterfaces Dialects/ -gen-op-interface-docs -dialect=qco)

add_mlir_doc(QCOOps QCODialect Dialects/ -gen-dialect-doc)
add_mlir_doc(QCOInterfaces QCOInterfaces Dialects/ -gen-op-interface-docs -dialect=qco)
43 changes: 43 additions & 0 deletions mlir/include/mlir/Dialect/QCO/IR/QCODialect.td
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// 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

#ifndef MLIR_DIALECT_QCO_IR_QCODIALECT_TD
#define MLIR_DIALECT_QCO_IR_QCODIALECT_TD

include "mlir/IR/DialectBase.td"

def QCODialect : Dialect {
let name = "qco";

let summary = "The QCO (value semantics) dialect for quantum computing.";

let description = [{
The QCO dialect uses **value semantics** where quantum operations
consume input qubits and produce new output values, following the
functional programming and SSA paradigm. This model enables:

- Powerful compiler optimizations through clear dataflow
- Safe reordering and parallelization analysis
- Advanced transformation passes
- Explicit dependency tracking

The name "QCO" stands for "Quantum Circuit Optimization."

Example:
```mlir
%q_out = qco.h %q_in // Consumes %q_in, produces %q_out
%q0_out, %q1_out = qco.swap %q0_in, %q1_in // Consumes inputs, produces outputs
```
}];

let cppNamespace = "::mlir::qco";

let useDefaultTypePrinterParser = 1;
}

#endif // MLIR_DIALECT_QCO_IR_QCODIALECT_TD
6 changes: 3 additions & 3 deletions mlir/include/mlir/Dialect/QCO/IR/QCOInterfaces.td
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
//
// Licensed under the MIT License

#ifndef QCO_INTERFACES
#define QCO_INTERFACES
#ifndef MLIR_DIALECT_QCO_IR_QCOINTERFACES_TD
#define MLIR_DIALECT_QCO_IR_QCOINTERFACES_TD

include "mlir/IR/OpBase.td"

Expand Down Expand Up @@ -240,4 +240,4 @@ def UnitaryOpInterface : OpInterface<"UnitaryOpInterface"> {
}];
}

#endif // QCO_INTERFACES
#endif // MLIR_DIALECT_QCO_IR_QCOINTERFACES_TD
Loading
Loading