Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
7436f34
feat(mlir): :sparkles: add pass and patterns for measurement lifting
DRovara May 13, 2026
b4d8e0e
test(mlir/hybrid-opt): :construction: set up tests for measurement li…
DRovara Jun 1, 2026
91b3ef9
feat(mlir): :sparkles: implement dead gate elimination canonicalizati…
DRovara Jun 1, 2026
ba57aa2
fix(mlir): :bug: fix tests
DRovara Jun 1, 2026
b83afab
test(mlir): :white_check_mark: add direct test for dead gate elimination
DRovara Jun 1, 2026
4243ac0
docs(mlir): :memo: update changelog
DRovara Jun 1, 2026
a50032b
style(mlir): :rotating_light: fix linter issues
DRovara Jun 1, 2026
d8c9ad5
fix(mlir): :recycle: guard RegionOp removal for child oeprations with…
DRovara Jun 2, 2026
9717547
fix(mlir): :bug: fix handling for `IfOp` removal and add specialized …
DRovara Jun 2, 2026
2d65418
fix(mlir): :bug: minor bug and code style fixes
DRovara Jun 2, 2026
278a54e
style(mlir): :rotating_light: fix linter issues on includes
DRovara Jun 2, 2026
28a34ab
Merge branch 'mlir/dead-gate-elimination' into mlir/measurement-lifting
DRovara Jun 2, 2026
a45a150
fix(mlir): :white_check_mark: fix tests
DRovara Jun 2, 2026
0edfeb1
🎨 pre-commit fixes
pre-commit-ci[bot] Jun 2, 2026
c4a43c2
style(mlir): :rotating_light: fix linter issues
DRovara Jun 2, 2026
6c6c87b
Merge branch 'mlir/measurement-lifting' of github.com:munich-quantum-…
DRovara Jun 2, 2026
44eaf7e
fix: :pencil2: fix typo in changelog
DRovara Jun 2, 2026
5c54635
Merge branch 'mlir/dead-gate-elimination' into mlir/measurement-lifting
DRovara Jun 2, 2026
a695579
style(mlir): :recycle: implement coderabbit suggestions
DRovara Jun 2, 2026
51cc982
fix(mlir): :bug: fix all measurement lifting tests
DRovara Jun 2, 2026
f6d5e3e
style(mlir): :rotating_light: fix linter issues
DRovara Jun 2, 2026
9070612
feat(mlir): :sparkles: implement classical control replacement patter…
DRovara Jun 2, 2026
c1fda94
style(mlir): :rotating_light: fix includes
DRovara Jun 2, 2026
ad1be84
style(mlir): :recycle: apply coderabbit suggestions
DRovara Jun 3, 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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ This project adheres to [Semantic Versioning], with the exception that minor rel

### Added

- ✨ Add Dead Gate Elimination Pattern ([#1755]) ([**@DRovara**])
Comment thread
coderabbitai[bot] marked this conversation as resolved.
- 🚸 Add [CMake presets] to provide a standardized and reproducible way to configure builds ([#1660]) ([**@denialhaag**])
- ✨ Add a `quantum-loop-unroll` pass for unrolling for-loop operations containing quantum operations ([#1718]) ([**@MatthiasReumann**])
- ✨ Add a `hadamard-lifting` pass for lifting Hadamard gates above Pauli gates ([#1605]) ([**@lirem101**], [**@burgholzer**])
Expand Down Expand Up @@ -402,6 +403,7 @@ _📚 Refer to the [GitHub Release Notes](https://github.com/munich-quantum-tool

<!-- PR links -->

[#1755]: https://github.com/munich-quantum-toolkit/core/pull/1755
[#1749]: https://github.com/munich-quantum-toolkit/core/pull/1749
[#1748]: https://github.com/munich-quantum-toolkit/core/pull/1748
[#1737]: https://github.com/munich-quantum-toolkit/core/pull/1737
Expand Down
48 changes: 47 additions & 1 deletion mlir/include/mlir/Dialect/QCO/Builder/QCOProgramBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,26 @@ class QCOProgramBuilder final : public ImplicitLocOpBuilder {
//===--------------------------------------------------------------------===//

/**
* @brief Initialize the builder and prepare for program construction
* @brief Initialize the builder and prepare for program construction, with
* a default return type of i64.
*
* @details
* Creates a main function with an entry_point attribute. Must be called
* before adding operations.
*/
void initialize();

/**
* @brief Initialize the builder and prepare for program construction
* with specified return types.
* @param returnTypes The return types for the main function
*
* @details
* Creates a main function with an entry_point attribute. Must be called
* before adding operations.
*/
void initialize(TypeRange returnTypes);

//===--------------------------------------------------------------------===//
// Constants
//===--------------------------------------------------------------------===//
Expand All @@ -105,6 +117,21 @@ class QCOProgramBuilder final : public ImplicitLocOpBuilder {
*/
Value intConstant(int64_t value);

/**
* @brief Create a constant boolean value
* @param value The value to store in the constant
* @return The value produced by the constant operation
*
* @par Example:
* ```c++
* auto c = builder.boolConstant(true);
* ```
* ```mlir
* %c = arith.constant 1 : i1
* ```
*/
Value boolConstant(bool value);

//===--------------------------------------------------------------------===//
// Memory Management
//===--------------------------------------------------------------------===//
Expand Down Expand Up @@ -1375,6 +1402,25 @@ class QCOProgramBuilder final : public ImplicitLocOpBuilder {
*/
OwningOpRef<ModuleOp> finalize();

/**
* @brief Finalize the program with a given exit code and return the
* constructed module
* @param returnValues Values representing the exit code to return
*
* @details
* Automatically deallocates all remaining valid qubits and tensors of qubits,
* adds a return statement with a given exit code,
* and transfers ownership of the module to the caller. The builder should not
* be used after calling this method.
*
* The return values must have the types indicated by the function signature
* of the main function, which returns an `i64` by default and can be
* modified by passing different arguments to the `initialize()` method.
*
* @return OwningOpRef containing the constructed quantum program module
*/
OwningOpRef<ModuleOp> finalize(ValueRange returnValues);

/**
* @brief Convenience method for building quantum programs
* @param context The MLIR context to use for building the program
Expand Down
2 changes: 2 additions & 0 deletions mlir/include/mlir/Dialect/QCO/IR/QCODialect.td
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ def QCODialect : Dialect {
let cppNamespace = "::mlir::qco";

let useDefaultTypePrinterParser = 1;

let hasCanonicalizer = 1;
}

#endif // MLIR_DIALECT_QCO_IR_QCODIALECT_TD
Loading
Loading