Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
198 commits
Select commit Hold shift + click to select a range
789654d
:test_tube: Added tests for Hadamard lifting
LiRem101 Mar 26, 2026
e05e2fe
:test_tube: Added test cases for controlled Pauli Z lifting
LiRem101 Mar 27, 2026
fc10555
:twisted_rightwards_arrows: Merge branch 'main' into mlir/hadamard-li…
LiRem101 Mar 27, 2026
fa877c6
:construction: Added framework for hadamard lifting pass
LiRem101 Mar 27, 2026
d784d01
:construction: Started exchange of Hadamard and Pauli
LiRem101 Mar 30, 2026
e1b6b37
:construction: Lifting uncontrolled Hadamard gates above Pauli
LiRem101 Mar 31, 2026
59739f1
:twisted_rightwards_arrows: Merge branch 'main' into mlir/hadamard-li…
LiRem101 Mar 31, 2026
9dc386e
:white_check_mark: Added canonicalization to references
LiRem101 Mar 31, 2026
5653b9a
:white_check_mark: Corrected gates
LiRem101 Mar 31, 2026
67d3c7c
:construction: Added handling of controlled gates
LiRem101 Apr 1, 2026
95e3604
:recycle: Refactored handling of controlled gates
LiRem101 Apr 1, 2026
e01a8b9
:construction: Added handling of controlled Pauli Z gates
LiRem101 Apr 1, 2026
798c514
:recycle: Refactored handling of controlled Pauli Z gates
LiRem101 Apr 1, 2026
baf731c
:construction: Added CNOT Hadamard handling
LiRem101 Apr 1, 2026
a43b158
✅ Corrected test
LiRem101 Apr 2, 2026
7fd4f75
:rotating_light: Fixed linter warnings
LiRem101 Apr 2, 2026
9c43526
:twisted_rightwards_arrows: Merge branch 'main' into mlir/hadamard-li…
LiRem101 Apr 2, 2026
18382b3
:rotating_light: Fixed linter warnings
LiRem101 Apr 2, 2026
7a89811
:fire: Removed statistics
LiRem101 Apr 2, 2026
cc5f15c
:construction: Added infrastructure to use hadamard lifting
LiRem101 Apr 2, 2026
a682420
:construction: Added infrastructure to use hadamard lifting
LiRem101 Apr 2, 2026
2c298bf
🎨 pre-commit fixes
pre-commit-ci[bot] Apr 2, 2026
e3da07f
:memo: Added information to CHANGELOG.md
LiRem101 Apr 2, 2026
b3bf966
:pencil2: Changed Preceeding to preceding
LiRem101 Apr 2, 2026
b2862e8
:twisted_rightwards_arrows: Merge branch 'mlir/hadamard-lifting' of g…
LiRem101 Apr 2, 2026
e9c66b3
:rotating_light: Fixed linter warnings
LiRem101 Apr 7, 2026
13c046d
:rotating_light: Optimized imports
LiRem101 Apr 7, 2026
db8491e
:rotating_light: Changed dyn_cast to llvm
LiRem101 Apr 7, 2026
f95eeb0
🔀 Merge branch 'main' into mlir/hadamard-lifting
LiRem101 Apr 7, 2026
18cb1b0
:twisted_rightwards_arrows: Merged 'main' and resolved merge conflicts
LiRem101 Apr 8, 2026
fb70183
🎨 pre-commit fixes
pre-commit-ci[bot] Apr 8, 2026
d785bdb
:construction: Fixed branching for optimization passes
LiRem101 Apr 8, 2026
74edb2e
:twisted_rightwards_arrows: Merge branch 'mlir/hadamard-lifting' of g…
LiRem101 Apr 8, 2026
cc97cfd
:memo: Updated Hadamard lifting documentation and fixed typos
LiRem101 Apr 8, 2026
26ca2ed
:construction: Removed double MLIRParser in CMakeLists
LiRem101 Apr 8, 2026
a15d2c1
:white_check_mark: Apply only canonicalizer to reference code
LiRem101 Apr 8, 2026
233da3f
:recycle: use is_permutation
LiRem101 Apr 8, 2026
6af2a96
:bug: Controlled Pauli Y cannot be lifted
LiRem101 Apr 8, 2026
664abad
🎨 pre-commit fixes
pre-commit-ci[bot] Apr 8, 2026
cf245b1
:recycle: Refactored runCanonicalizerPass method
LiRem101 Apr 8, 2026
4ab38c1
:twisted_rightwards_arrows: Merge branch 'mlir/hadamard-lifting' of g…
LiRem101 Apr 8, 2026
57159ae
:rotating_light: Optimized imports and test naming
LiRem101 Apr 8, 2026
c966623
:construction: Apply suggestions from code review
LiRem101 Apr 15, 2026
8d32188
:construction: Adapated code to suggestions from code review
LiRem101 Apr 15, 2026
edc59a2
:memo: Adapted documentation according to review
LiRem101 Apr 15, 2026
cdfc8ed
:construction: Implemented changes suggested by review, removed handl…
LiRem101 Apr 15, 2026
de726cb
:construction: Added global phase for Y-H commutation
LiRem101 Apr 16, 2026
500b0d1
:construction: Added TypeSwitch
LiRem101 Apr 16, 2026
b67a26f
:memo: Improved documentation
LiRem101 Apr 16, 2026
928f6c5
:recycle: Removed temporary value and branchings, assisted-by: GPT 5 …
LiRem101 Apr 16, 2026
9b2397e
:construction: Implemented changes requested in review
LiRem101 Apr 16, 2026
20b6580
:white_check_mark: Added test for measurement after target of CNOT
LiRem101 Apr 16, 2026
3b430d4
:construction: Implemented changes requested in review
LiRem101 Apr 17, 2026
ee2f941
:twisted_rightwards_arrows: Merge with main
LiRem101 Apr 17, 2026
f3cb1d7
🎨 pre-commit fixes
pre-commit-ci[bot] Apr 17, 2026
e5ba050
:pencil2: Fixed typos
LiRem101 Apr 17, 2026
afdb6b0
:twisted_rightwards_arrows: Merge with origin
LiRem101 Apr 17, 2026
44d8c98
🎨 pre-commit fixes
pre-commit-ci[bot] Apr 17, 2026
1ca77fa
:rotating_light: Fix linter errors
LiRem101 Apr 17, 2026
10b21ed
:rotating_light: Fix linter errors
LiRem101 Apr 17, 2026
f183f63
:rotating_light: Fix linter errors
LiRem101 Apr 17, 2026
89da08c
:rotating_light: Fix linter errors
LiRem101 Apr 17, 2026
2f0dbe6
:rotating_light: Fix linter errors
LiRem101 Apr 17, 2026
31995a8
:bug: Fix dangling range, assisted-by: GPT 5 via KI:connect
LiRem101 Apr 20, 2026
3750513
:white_check_mark: Adapated tests to removal of controlled cases
LiRem101 Apr 20, 2026
0da58cf
:bug: Fixed dangling hadamard gate object
LiRem101 Apr 20, 2026
1c2a5a8
:twisted_rightwards_arrows: Merge with main
LiRem101 Apr 22, 2026
fce739b
🎨 pre-commit fixes
pre-commit-ci[bot] Apr 22, 2026
3331f0c
Merge branch 'main' into mlir/hadamard-lifting
denialhaag Apr 29, 2026
7f1256b
Simplify diff
denialhaag Apr 29, 2026
3084ec4
Adapt to new include style
denialhaag Apr 29, 2026
615bbd4
Merge branch 'main' into fork/LiRem101/mlir/hadamard-lifting
burgholzer May 6, 2026
9afaacd
♻️ Simplify pass implementation
burgholzer May 6, 2026
43452ee
:twisted_rightwards_arrows: Merge branch 'main' into mlir/hadamard-li…
LiRem101 May 7, 2026
0fcf1e6
:memo: Adapted documentation
LiRem101 May 7, 2026
6b4f865
Merge branch 'main' into fork/LiRem101/mlir/hadamard-lifting
burgholzer May 11, 2026
413585b
Merge branch 'main' into mlir/hadamard-lifting
burgholzer May 11, 2026
06c681f
:bricks: Add files for tracking QuantumStates
LiRem101 Jun 9, 2026
4bd6f65
:construction: Added GateToMap.h
LiRem101 Jun 10, 2026
87ddcde
:recycle: Refactored GateToMap.h, Assisted-by: GPT OSS via KI:connect
LiRem101 Jun 10, 2026
992c0f6
📝 Added Docstring
LiRem101 Jun 10, 2026
3954213
:construction: Added Header File for QuantumState
LiRem101 Jun 10, 2026
549e786
:recycle: Refactored QuantumState.hpp, assisted-by GPT OSS via KI:con…
LiRem101 Jun 10, 2026
060c7c7
:construction: Added QuantumState class
LiRem101 Jun 11, 2026
fca5829
:recycle: Refactored QuantumState.hpp and QuantumState.cpp, assisted-…
LiRem101 Jun 11, 2026
dfb3c79
✅ Added tests for QuantumState
LiRem101 Jun 11, 2026
edbde78
:white_check_mark: Passes first test
LiRem101 Jun 12, 2026
24903c1
:white_check_mark: Passed tests
LiRem101 Jun 12, 2026
4c8b2bf
:recycle: Refactored QuantumState.hpp
LiRem101 Jun 12, 2026
37df86d
:recycle: Refactored QuantumState.hpp, assisted-by GPT-OSS va KI:connect
LiRem101 Jun 12, 2026
515928d
:construction: Corrected macros
LiRem101 Jun 12, 2026
9e5d051
:rotating_light: Corrected clang errors
LiRem101 Jun 12, 2026
2fc9805
🚧 Created HybridState.hpp
LiRem101 Jun 12, 2026
eeec576
🚧 Adapted HybridState and created ClassicalArithOperation
LiRem101 Jun 16, 2026
fa6667b
🚧 Added HybridState implementation
LiRem101 Jun 17, 2026
af69c0c
🚧 Added tests for HybridState
LiRem101 Jun 17, 2026
c77bb06
:white_check_mark: Added tests for classical operations
LiRem101 Jun 18, 2026
2cbc8ae
:recycle: Refactored HybridState
LiRem101 Jun 18, 2026
8b23135
:construction: Added UnionTable infrastructure
LiRem101 Jun 18, 2026
e8b170d
:white_check_mark: Added UnionTable tests
LiRem101 Jun 18, 2026
e8dabcb
:construction: Added UnionTable methods
LiRem101 Jun 19, 2026
1607ddb
:construction: Added UnionTable methods
LiRem101 Jun 19, 2026
c3fd47c
:construction: Corrected handling of maps
LiRem101 Jun 19, 2026
3300fe6
:construction: Corrected handling of maps
LiRem101 Jun 19, 2026
056af2e
:construction: Corrected several test problems
LiRem101 Jun 22, 2026
b3269eb
:construction: Added additional tests for UnionTable
LiRem101 Jun 22, 2026
aecb3a0
:construction: Added getValueThatIsEquivalentToQubit
LiRem101 Jun 23, 2026
fefdc7e
:construction: Added UnionTableFunctionality
LiRem101 Jun 24, 2026
1a93171
:construction: Fixed test results
LiRem101 Jun 24, 2026
d7bfb19
:construction: Fixed tests
LiRem101 Jun 25, 2026
2cc0545
:construction: Added infrastructure for constant propagation passes
LiRem101 Jun 26, 2026
500ada9
:test_tube: Added first test for constant propagation
LiRem101 Jun 26, 2026
9c47ebf
:construction: Continued constant propagation infrastructure
LiRem101 Jun 26, 2026
ab7ba5b
:test_tube: Added constant propagation test
LiRem101 Jun 29, 2026
a0341a7
:construction: Global phase as double
LiRem101 Jun 29, 2026
e0f9a98
:construction: Handling of global phases without control
LiRem101 Jun 29, 2026
d4690b1
:construction: Ctrl qubits changed after gate
LiRem101 Jun 29, 2026
32dde57
:construction: Start of ctrl handling
LiRem101 Jun 29, 2026
4e8463d
:construction: Handling of ctrl continued
LiRem101 Jun 30, 2026
9f15fb1
:construction: Handling of ctrl
LiRem101 Jun 30, 2026
af40f05
:memo: Added docstrings
LiRem101 Jun 30, 2026
27e9da3
:construction: Added creation of classical value inside measurement
LiRem101 Jun 30, 2026
1819c07
:construction: Added reset and measurement handling
LiRem101 Jun 30, 2026
eb0f2fb
:construction: Started removal of ctrl of always executed gates
LiRem101 Jun 30, 2026
99850ff
:construction: Removal of ctrl of always executed gates
LiRem101 Jun 30, 2026
64619cc
:construction: Started removal of ctrls that are superfluous
LiRem101 Jun 30, 2026
0d440a2
✅ Fixed test
LiRem101 Jun 30, 2026
ef60703
:memo: Added docstring
LiRem101 Jul 1, 2026
6397001
:construction: Continued removal of ctrls in CtrlOp
LiRem101 Jul 1, 2026
c527209
:construction: Fixed creation of uncontrolled gates
LiRem101 Jul 1, 2026
80c6b82
:test_tube: Added test to check propagation in classical branching
LiRem101 Jul 1, 2026
dd691d1
:construction: Added propagation of classical branching
LiRem101 Jul 1, 2026
3ec5f72
:test_tube: Extended test for removal of classical condition
LiRem101 Jul 2, 2026
22e02a9
:construction: Removal of branch if condition is one
LiRem101 Jul 2, 2026
aea9d47
:construction: Added handling to remove classical branches
LiRem101 Jul 2, 2026
cd1ff0a
:construction: First draft of creating branches
LiRem101 Jul 2, 2026
e05c433
:construction: Create branches during constant propagation
LiRem101 Jul 2, 2026
4c3f9cc
:test_tube: Added tests for movement of measurement
LiRem101 Jul 2, 2026
bf7b1af
:construction: Added moving measurement in front
LiRem101 Jul 2, 2026
ffe6293
:construction: Added handling of classical operations
LiRem101 Jul 2, 2026
774e859
:construction: Creating then and else branches
LiRem101 Jul 2, 2026
e83acbd
:construction: Added usage of parameters
LiRem101 Jul 2, 2026
a87875a
:construction: Added pipeline frame
LiRem101 Jul 2, 2026
fb56ef0
:twisted_rightwards_arrows: Merged with main
LiRem101 Jul 2, 2026
74d198b
:construction: Adapted to changes from main
LiRem101 Jul 2, 2026
edd955c
🎨 pre-commit fixes
pre-commit-ci[bot] Jul 2, 2026
4420939
:memo: Added change information to CHANGELOG.md
LiRem101 Jul 2, 2026
b096acf
Merge branch 'mlir/constant-propagation' of github.com:LiRem101/mqt-c…
LiRem101 Jul 2, 2026
c26efd8
🎨 pre-commit fixes
pre-commit-ci[bot] Jul 2, 2026
33b2498
:rotating_light: Fixed linter warnings
LiRem101 Jul 14, 2026
a2252d0
🔀 Merge branch 'mlir/constant-propagation' of github.com:LiRem101/mqt…
LiRem101 Jul 14, 2026
536950f
:twisted_rightwards_arrows: Merge with main
LiRem101 Jul 14, 2026
a41cf5a
🎨 pre-commit fixes
pre-commit-ci[bot] Jul 14, 2026
34ff5ad
:pencil2: Fixed typo
LiRem101 Jul 14, 2026
be3bb9c
:rotating_light: Fixed linter warnings
LiRem101 Jul 14, 2026
9e132b0
🎨 pre-commit fixes
pre-commit-ci[bot] Jul 14, 2026
bf61d45
:rotating_light: Fixed linter warnings
LiRem101 Jul 14, 2026
ef9bd3a
:rotating_light: Fixed linter warnings
LiRem101 Jul 14, 2026
dd1ee75
:rotating_light: Fixed linter warnings
LiRem101 Jul 14, 2026
a88b33e
:poop: Checking if only one test fails on macos
LiRem101 Jul 14, 2026
cf1d023
:rotating_light: Fixed linter warnings
LiRem101 Jul 14, 2026
8b6e347
:construction: Added const keyword
LiRem101 Jul 14, 2026
34eefac
:construction: Fixed span creation
LiRem101 Jul 14, 2026
a46a201
:poop: Finding error cause for macos
LiRem101 Jul 14, 2026
d06dd5f
:poop: Finding error cause for macos
LiRem101 Jul 14, 2026
7e8d48f
:poop: Finding error cause for macos
LiRem101 Jul 14, 2026
17307b3
:construction: Check satisfiability earlier
LiRem101 Jul 14, 2026
b373771
:construction: Check satisfiability earlier
LiRem101 Jul 14, 2026
3d7164f
:construction: Fixed span creation
LiRem101 Jul 14, 2026
62e5ec6
:construction: Fixed erasure of variable, Assisted-by: Copilot via Gi…
LiRem101 Jul 14, 2026
5299761
:poop: Find macos Segfault cause
LiRem101 Jul 14, 2026
3dc72e4
🎨 pre-commit fixes
pre-commit-ci[bot] Jul 14, 2026
8494cf3
:poop: Find macos Segfault cause
LiRem101 Jul 14, 2026
2e9bbc2
:poop: Find macos Segfault cause
LiRem101 Jul 15, 2026
83b7eaa
:construction: Fix string
LiRem101 Jul 15, 2026
0bfc8e4
:poop: Find segfault on macos
LiRem101 Jul 15, 2026
c5fcd98
:poop: Find segfault on macos
LiRem101 Jul 15, 2026
374f056
:poop: Find segfault on macos
LiRem101 Jul 15, 2026
40d2fc6
:poop: Find segfault on macos
LiRem101 Jul 15, 2026
776068f
:poop: Find segfault on macos
LiRem101 Jul 15, 2026
24aa56a
:poop: Find macos Segfault cause
LiRem101 Jul 15, 2026
fac19e0
:poop: Find macos Segfault cause
LiRem101 Jul 15, 2026
158c32d
:poop: Find macos Segfault cause
LiRem101 Jul 15, 2026
851fd22
:construction: Put yield operations always to null
LiRem101 Jul 15, 2026
29e36fc
:twisted_rightwards_arrows: Merge with main
LiRem101 Jul 15, 2026
76e6b50
🎨 pre-commit fixes
pre-commit-ci[bot] Jul 15, 2026
12ee3f8
:fire: Remove Debug Strings
LiRem101 Jul 15, 2026
4b86a0b
:bug: Prevented HS from being copied and not changed
LiRem101 Jul 17, 2026
1b94f3f
:white_check_mark: Added test to remove class ctrl from various gates
LiRem101 Jul 17, 2026
52062f0
:white_check_mark: Added test for reset
LiRem101 Jul 17, 2026
1ed7b20
:white_check_mark: Added test for classical operations
LiRem101 Jul 17, 2026
bb38f78
:white_check_mark: Added test to remove only some q ctrls
LiRem101 Jul 17, 2026
9b42fa9
:white_check_mark: Added additional tests
LiRem101 Jul 17, 2026
dc21457
:pencil2: Fixed typo
LiRem101 Jul 17, 2026
93446b3
:white_check_mark: Added tests
LiRem101 Jul 17, 2026
a930830
:white_check_mark: Added tests for gates
LiRem101 Jul 17, 2026
22f705e
:white_check_mark: Added tests
LiRem101 Jul 17, 2026
9bdaaa1
:white_check_mark: Fixed test
LiRem101 Jul 17, 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
4 changes: 2 additions & 2 deletions .agent/plans/first-mlir-python-bindings.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ Jeff serialization, QIR output, and Qiskit subclass support.
## Progress

- [x] (2026-06-26 to 2026-07-15) Implemented typed compiler programs, the Python
binding module, package integration, documentation, and tests; merged
through pull request #1815.
binding module, package integration, documentation, and tests; merged
through pull request #1815.
- [x] (2026-07-15) Reviewed CodeRabbit feedback and incorporated valid input,
type-validation, CLI, pass-registration, typing, and documentation fixes.
- [x] (2026-07-15) Added binding-owned Python docstrings and regenerated stubs.
Expand Down
6 changes: 4 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ This checklist serves as a reminder of a couple of things that ensure your pull

**If PR contains AI-assisted content:**

- [ ] Any agent that created, edited, or submitted GitHub content was explicitly authorized for that scope, as required by our [AI Usage Guidelines](https://github.com/munich-quantum-toolkit/core/blob/main/docs/ai_usage.md).
- [ ] Every agent-authored or agent-edited public text body begins with the visible disclosure `🤖 *AI text below* 🤖` (titles are exempt).
- [ ] Any agent that created, edited, or submitted GitHub content was explicitly authorized for that scope, as required
by our [AI Usage Guidelines](https://github.com/munich-quantum-toolkit/core/blob/main/docs/ai_usage.md).
- [ ] Every agent-authored or agent-edited public text body begins with the visible disclosure `🤖 *AI text below* 🤖` (
titles are exempt).
- [ ] AI-assisted commits include an `Assisted-by: [Model Name] via [Tool Name]` footer.
- [ ] I confirm that I have personally reviewed and understood all AI-generated content, and accept full responsibility for it.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ releases may include breaking changes.

### Added

- ✨ Add a `constant propagation` pass for reducing superfluous quantum
resources by propagating the quantum machine state ([#1845]) ([**@lirem101])
Comment on lines +15 to +16

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Fix the author attribution markup.

Line 16 is missing the closing **, so the contributor attribution renders incorrectly.

Proposed fix
-  resources by propagating the quantum machine state ([`#1845`]) ([**`@lirem101`])
+  resources by propagating the quantum machine state ([`#1845`]) ([**`@lirem101`**])
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- ✨ Add a `constant propagation` pass for reducing superfluous quantum
resources by propagating the quantum machine state ([#1845]) ([**@lirem101])
- ✨ Add a `constant propagation` pass for reducing superfluous quantum
resources by propagating the quantum machine state ([`#1845`]) ([**`@lirem101`**])
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@CHANGELOG.md` around lines 15 - 16, Correct the contributor attribution
markup in the changelog entry by adding the missing closing bold delimiter after
the username, while preserving the existing link and entry text.

- ✨ Add Python bindings for the MQT Compiler Collection ([#1815])
([**@burgholzer**], [**@denialhaag**])
- ✨ Add support for QDMI child devices to the driver and FoMaC libraries
Expand Down Expand Up @@ -649,6 +651,7 @@ changelogs._
[#1850]: https://github.com/munich-quantum-toolkit/core/pull/1850
[#1849]: https://github.com/munich-quantum-toolkit/core/pull/1849
[#1848]: https://github.com/munich-quantum-toolkit/core/pull/1848
[#1845]: https://github.com/munich-quantum-toolkit/core/pull/1845
[#1844]: https://github.com/munich-quantum-toolkit/core/pull/1844
[#1842]: https://github.com/munich-quantum-toolkit/core/pull/1842
[#1836]: https://github.com/munich-quantum-toolkit/core/pull/1836
Expand All @@ -659,6 +662,7 @@ changelogs._
[#1824]: https://github.com/munich-quantum-toolkit/core/pull/1824
[#1823]: https://github.com/munich-quantum-toolkit/core/pull/1823
[#1817]: https://github.com/munich-quantum-toolkit/core/pull/1817

[#1815]: https://github.com/munich-quantum-toolkit/core/pull/1815
[#1814]: https://github.com/munich-quantum-toolkit/core/pull/1814
[#1809]: https://github.com/munich-quantum-toolkit/core/pull/1809
Expand Down
1 change: 1 addition & 0 deletions UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ It also requires the `uv` library version 0.5.20 or higher.
<!-- Version links -->

[unreleased]: https://github.com/munich-quantum-toolkit/core/compare/v3.7.0...HEAD

[3.7.0]: https://github.com/munich-quantum-toolkit/core/compare/v3.6.0...v3.7.0
[3.6.0]: https://github.com/munich-quantum-toolkit/core/compare/v3.5.1...v3.6.0
[3.5.1]: https://github.com/munich-quantum-toolkit/core/compare/v3.5.0...v3.5.1
Expand Down
4 changes: 3 additions & 1 deletion docs/_templates/doxygen-header.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@
</td>
<!--END PROJECT_NAME-->
<!--BEGIN !PROJECT_NAME--><!--BEGIN PROJECT_BRIEF-->
<td><div id="projectbrief">$projectbrief</div></td>
<td>
<div id="projectbrief">$projectbrief</div>
</td>
<!--END PROJECT_BRIEF--><!--END !PROJECT_NAME-->
<!--BEGIN DISABLE_INDEX--><!--BEGIN SEARCHENGINE--><!--BEGIN !FULL_SIDEBAR-->
<td>$searchbox</td>
Expand Down
1 change: 0 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ def format_url(self, _e: Entry) -> HRef: # noqa: PLR6301
("py:class", r"qiskit\.primitives\.containers\.(Estimator|Sampler)PubLike"),
]


cpp_api_tagfile = ("_build/doxygen/mqt-core.tag", "cpp/", "_build/doxygen/xml")
qdmi_api_tagfile = (
"_build/qdmi.tag",
Expand Down
16 changes: 8 additions & 8 deletions docs/mlir/python_compiler_collection.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ The compiler accepts source strings, `.qasm`, `.mlir`, and `.jeff` files, MQT
and Qiskit circuit objects, and typed compiler programs. Select an output format
to stop the pipeline at a particular representation:

| Purpose | Output format | Result type |
| --- | --- | --- |
| Inspect frontend translation | `OutputFormat.QC_IMPORT` | `QCProgram` |
| Inspect QCO immediately after conversion | `OutputFormat.QCO` | `QCOProgram` |
| Inspect QCO after optimization | `OutputFormat.QCO_OPTIMIZED` | `QCOProgram` |
| Obtain the optimized circuit | `OutputFormat.QC` (default) | `QCProgram` |
| Serialize a compiler program | `OutputFormat.JEFF` | `JeffProgram` |
| Generate QIR | `OutputFormat.QIR_BASE` or `OutputFormat.QIR_ADAPTIVE` | `QIRProgram` |
| Purpose | Output format | Result type |
| ---------------------------------------- | ------------------------------------------------------ | ------------- |
| Inspect frontend translation | `OutputFormat.QC_IMPORT` | `QCProgram` |
| Inspect QCO immediately after conversion | `OutputFormat.QCO` | `QCOProgram` |
| Inspect QCO after optimization | `OutputFormat.QCO_OPTIMIZED` | `QCOProgram` |
| Obtain the optimized circuit | `OutputFormat.QC` (default) | `QCProgram` |
| Serialize a compiler program | `OutputFormat.JEFF` | `JeffProgram` |
| Generate QIR | `OutputFormat.QIR_BASE` or `OutputFormat.QIR_ADAPTIVE` | `QIRProgram` |

For example, select optimized QCO to inspect the representation after the
default QCO pass pipeline:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
/*
* 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

#ifndef MQT_CORE_CLASSICALARITHOPERATION_H
#define MQT_CORE_CLASSICALARITHOPERATION_H

#include "mlir/Dialect/QCO/IR/QCOOps.h"
#include "mlir/Dialect/QCO/Utils/Drivers.h"

#include <mlir/Dialect/Arith/IR/Arith.h>
#include <mlir/IR/BuiltinTypes.h>
#include <mlir/IR/Operation.h>

#include <cmath>
#include <stdexcept>

/**
* This file provides information of available arith operations. It calculates
* the result of valid arith operations. Operations are only valid with one to
* two operands, not if they are applied to sequences.
*/
inline int64_t getArithIntegerOpResult(mlir::Operation* operation,
int64_t value1, int64_t value2 = 0,
int64_t value3 = 0) {

for (mlir::Value operand : operation->getOperands()) {
if (isa<mlir::VectorType>(operand.getType())) {
throw std::runtime_error(
"Constant propagation does not support vectors as classical types.");
}
}

return mlir::TypeSwitch<mlir::Operation*, int64_t>(operation)
.Case<mlir::arith::AddIOp>([&](auto) { return value1 + value2; })
.Case<mlir::arith::AndIOp>([&](auto) { return value1 & value2; })
.Case<mlir::arith::CeilDivSIOp>([&](auto) {
// Division that rounds to positive infinity
return ceil(1.0 * value1 / value2);
})
.Case<mlir::arith::DivSIOp>([&](auto) {
// Division that rounds towards zero
return value1 / value2;
})
.Case<mlir::arith::FloorDivSIOp>([&](auto) {
// Division that rounds to negative infinity
return floor(1.0 * value1 / value2);
})
.Case<mlir::arith::MaxSIOp>(
[&](auto) { return value1 > value2 ? value1 : value2; })
.Case<mlir::arith::MinSIOp>(
[&](auto) { return value1 < value2 ? value1 : value2; })
.Case<mlir::arith::MulIOp>([&](auto) { return value1 * value2; })
.Case<mlir::arith::OrIOp>([&](auto) { return value1 | value2; })
.Case<mlir::arith::RemSIOp>(
[&](auto) { return remainder(value1, value2); })
.Case<mlir::arith::ShLIOp>([&](auto) { return value1 << value2; })
.Case<mlir::arith::ShRSIOp>([&](auto) { return value1 >> value2; })
.Case<mlir::arith::SubIOp>([&](auto) { return value1 - value2; })
.Case<mlir::arith::XOrIOp>([&](auto) { return value1 ^ value2; })
.Case<mlir::arith::SelectOp>(
[&](auto) { return value1 == 0 ? value3 : value2; })
.Default([&](auto) -> int64_t {
throw std::runtime_error("Unsupported integer operation in "
"mlir::qco::classicalarithoperation");
});
}

inline double getArithDoubleOpResult(mlir::Operation* operation, double value1,
double value2 = 0.0) {

for (mlir::Value operand : operation->getOperands()) {
if (isa<mlir::VectorType>(operand.getType())) {
throw std::runtime_error(
"Constant propagation does not support vectors as classical types.");
}
}

return mlir::TypeSwitch<mlir::Operation*, double>(operation)
.Case<mlir::arith::AddFOp>([&](auto) { return value1 + value2; })
.Case<mlir::arith::DivFOp>([&](auto) { return value1 / value2; })
.Case<mlir::arith::MaximumFOp>(
[&](auto) { return value1 > value2 ? value1 : value2; })
.Case<mlir::arith::MaxNumFOp>(
[&](auto) { return value1 > value2 ? value1 : value2; })
.Case<mlir::arith::MinimumFOp>(
[&](auto) { return value1 < value2 ? value1 : value2; })
.Case<mlir::arith::MinNumFOp>(
[&](auto) { return value1 < value2 ? value1 : value2; })
.Case<mlir::arith::MulFOp>([&](auto) { return value1 * value2; })
.Case<mlir::arith::NegFOp>([&](auto) { return -value1; })
.Case<mlir::arith::RemFOp>(
[&](auto) { return remainder(value1, value2); })
.Case<mlir::arith::SubFOp>([&](auto) { return value1 - value2; })
.Default([&](auto) -> double {
throw std::runtime_error("Unsupported floating-point operation in "
"mlir::qco::classicalarithoperation");
});
}
Comment on lines +31 to +107

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🔴 Critical | 🏗️ Heavy lift

🧩 Analysis chain

🌐 Web query:

What are the exact scalar folding semantics of MLIR arith.remsi, arith.remf, ceildivsi, floordivsi, maximumf, and maxnumf, including integer bit widths and poison/undefined cases?

💡 Result:

The MLIR 'arith' dialect defines basic arithmetic operations that operate on scalars (integers or floating-point), as well as vectors and tensors of these types [1]. Unless otherwise stated, these operations use two's complement representation for integers and propagate poison values [1]. If any input is poison, the result is poison [1]. arith.remsi (Signed Integer Division Remainder) This operation performs a signed integer remainder [2][3]. It treats the leading bit as a sign bit (e.g., 6 % -2 = 0) [2][3]. Division by zero is undefined behavior [2][3]. For vector and tensor types, if any element is divided by zero, the behavior is undefined [2][3]. arith.remf (Floating-Point Remainder) This operation performs a floating-point remainder, with semantics matching the llvm.frem instruction [4]. The sign of the result always matches the sign of the dividend (the left-hand side operand) [4]. arith.ceildivsi (Signed Integer Ceil Division) This performs signed integer division rounded towards positive infinity (e.g., 7 / -2 = -3) [5]. arith.floordivsi (Signed Integer Floor Division) This performs signed integer division rounded towards negative infinity (e.g., 5 / -2 = -3) [5][6]. arith.maximumf (Floating-Point Maximum) Returns the maximum of two arguments, treating -0.0 as less than +0.0 [2][5]. If either argument is NaN, the result is NaN [2][5]. arith.maxnumf (Floating-Point Maximum) Returns the maximum of two arguments [2][5]. If the arguments are -0.0 and +0.0, the result is either value [2][5]. If one argument is NaN, the result is the other argument [2][5]. Note on Integer Bit Widths: These operations are polymorphic and accept integers of any bit width (e.g., i8, i16, i32, i64) as defined in the MLIR type system [1][2]. The specific behavior, such as two's complement arithmetic and overflow behavior, applies generically across these widths [1]. Note on Poison: Unless otherwise specified, all operations in the arith dialect propagate poison values, meaning that if any of the inputs are poison, the output is also poison [1]. For structured types (vector/tensor), this propagation occurs element-wise [1].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Map the target header and nearby symbols.
ast-grep outline mlir/include/mlir/Dialect/QCO/Transforms/Optimizations/ConstantPropagation/ClassicalArithOperation.h --view expanded || true

echo
echo "=== File excerpt ==="
sed -n '1,220p' mlir/include/mlir/Dialect/QCO/Transforms/Optimizations/ConstantPropagation/ClassicalArithOperation.h

echo
echo "=== Call sites for helpers ==="
rg -n "getArith(Integer|Double)OpResult|maximumf|maxnumf|remsi|remf|ceildivsi|floordivsi" mlir -g '!**/build/**'

Repository: munich-quantum-toolkit/core

Length of output: 5551


Use MLIR folding/APInt/APFloat here instead of native C++ arithmetic.

  • std::remainder, double-based ceil/floor division, and raw shifts/overflow rules do not match arith semantics.
  • maximumf and maxnumf are also conflated; they differ on NaN and signed zero.
  • Delegate to the ops’ fold hooks or use APInt/APFloat, and return not-foldable when the result can’t be represented safely.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@mlir/include/mlir/Dialect/QCO/Transforms/Optimizations/ConstantPropagation/ClassicalArithOperation.h`
around lines 31 - 107, Replace the native arithmetic in getArithIntegerOpResult
and getArithDoubleOpResult with MLIR arith folding or APInt/APFloat operations
so results match arith semantics, including overflow, shifts, division,
remainder, NaN, and signed-zero behavior. Keep maximumf and maxnumf handled
distinctly, and propagate a not-foldable result whenever the computed value
cannot be represented safely rather than forcing an int64_t or double result.


#endif // MQT_CORE_MQT_CORE_CLASSICALARITHOPERATION_H
Loading
Loading