Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
275 commits
Select commit Hold shift + click to select a range
5ff807c
📦️ Try to fix wheel build
ystade May 9, 2025
66edcab
🎨 Exclude MLIR libs from installation
ystade May 9, 2025
82ddde3
🎨 Update tests
ystade May 9, 2025
0efb822
🎨 Default install instructions for the plugin
ystade May 9, 2025
5101a2a
🎨 Create a separate plugins dir
ystade May 9, 2025
4e3e71c
🎨 Use dependent option
ystade May 9, 2025
52a2ce1
🔧 Restructure cmake config
ystade May 11, 2025
d780c9c
🔧 Fix config
ystade May 11, 2025
30b965a
🔧 Cleanup config
ystade May 11, 2025
29a4eab
🚧 Start including catalyst via FetchContent
ystade May 19, 2025
573cf27
📦️ Setup fundamental Python Packaging structure to decouple catalyst …
ystade May 20, 2025
dff5f43
⏪️ Restore original top-level pyproject.toml
ystade May 20, 2025
5d86166
🎨 Refine the plugin structure
ystade May 20, 2025
73436bf
🔧 Fix config
ystade May 20, 2025
9de611c
🎨 Make plugin part of main CMake project, fix introduce add_mqt_core_…
ystade May 20, 2025
f5f5579
🐛 Fix cmake issues
ystade May 20, 2025
00e2628
🐛 Next try
ystade May 20, 2025
aea7ec4
🎨 Add missing header, make CMake more flexible
ystade May 21, 2025
800a94f
🎨 Add catalyst headers
ystade May 21, 2025
49e86aa
🐛 Fix MLIR include
ystade May 21, 2025
5eceb27
♻️ Update CMake config to new catalyst version
ystade May 21, 2025
4ae1632
🐛 Fix install component
ystade May 21, 2025
940b1b8
🐛 Fix pyproject.toml
ystade May 21, 2025
6243cba
🔀 Merge conversions
ystade May 21, 2025
5e589be
🎨 Some namespace adaptions
ystade May 21, 2025
11d1ae0
🐛 Make plugin compile
ystade May 21, 2025
0cceef8
🐛 Fix python package
ystade May 21, 2025
f987c99
🐛 Fix python path extraction
ystade May 21, 2025
5dcb245
🚧 WIP: Export Headers
ystade May 21, 2025
0b64642
🚚 Rename src to lib
ystade May 21, 2025
4903ff3
🐛 Fix errors in pyproject.toml
ystade May 21, 2025
09ea22c
⬆️ Update catalyst dep
ystade May 22, 2025
74231a1
♻️ Clean-up CMakeLists
ystade May 22, 2025
2c15f70
Merge branch 'main' into mlir-plugin
burgholzer May 22, 2025
76cb1dc
🎨 remove stray changes
burgholzer May 22, 2025
cbc5cba
🔥 remove duplicate file
burgholzer May 22, 2025
8a8f01d
🔥 remove further stray change
burgholzer May 22, 2025
9f17863
🎨 add entry point for mqt.passes in pyproject.toml
flowerthrower May 23, 2025
76535cb
add python guard
flowerthrower May 25, 2025
e69b0e1
Apply suggestions from code review
flowerthrower May 25, 2025
3626013
🎨 pre-commit fixes
pre-commit-ci[bot] May 25, 2025
5861960
Merge branch 'mlir-plugin' of https://github.com/cda-tum/mqt-core int…
flowerthrower May 25, 2025
01b139c
🎨 update CMakeLists.txt to improve RPATH handling and installation di…
flowerthrower May 26, 2025
816ac83
🎨 update CI configuration to enable BUILD_MQT_CORE_CATALYST_PLUGIN fo…
flowerthrower May 26, 2025
217305d
🎨 update pyproject.toml to set version and clean up dependencies
flowerthrower May 26, 2025
160c62e
🎨 pre-commit fixes
pre-commit-ci[bot] May 27, 2025
2b01fde
add environment markers
flowerthrower May 27, 2025
9d5f2eb
add ci for macos plugin test
flowerthrower Jun 2, 2025
d9d3028
fix ci
flowerthrower Jun 2, 2025
91304bf
fix ci
flowerthrower Jun 2, 2025
e23edb5
fix ci
flowerthrower Jun 2, 2025
c5242e3
fix ci
flowerthrower Jun 2, 2025
8db1931
fix ci
flowerthrower Jun 2, 2025
4cc18b0
fix ci
flowerthrower Jun 2, 2025
8c69fbd
fix ci
flowerthrower Jun 2, 2025
2a04dd5
dynamic path finding
flowerthrower Jun 2, 2025
65f34e7
calm down ruff
flowerthrower Jun 2, 2025
c2e0cda
remove version file
flowerthrower Jun 2, 2025
203049f
🚚 rename test file
flowerthrower Jun 4, 2025
270fd6d
🚧 use rpath
flowerthrower Jun 10, 2025
74a7ce9
🚧 use matchAndRewrite
flowerthrower Jun 11, 2025
cec21b4
add path in ci to find dylib
flowerthrower Jun 11, 2025
ffedad9
Merge commit '08e61d14291da0e7e39af3f5e6c46a6641635eb7' into mlir-plugin
flowerthrower Jun 11, 2025
95b7951
debug ci
flowerthrower Jun 11, 2025
8167e6f
🎨 pre-commit fixes
pre-commit-ci[bot] Jun 11, 2025
35c01bf
debug ci
flowerthrower Jun 11, 2025
c230d99
✅ add test for plugin execution
flowerthrower Jun 13, 2025
705ac5d
🎨 pre-commit fixes
pre-commit-ci[bot] Jun 13, 2025
116bb7f
➕ install pytest in ci
flowerthrower Jun 13, 2025
d5471b9
💚 fix urllib3 to stable version
flowerthrower Jun 13, 2025
4bd1af9
⚡️ improve ci
flowerthrower Jun 13, 2025
8c42d30
💚 improve ci
flowerthrower Jun 13, 2025
2680a1e
🐛 fix dialect roundtrip tests
flowerthrower Jun 20, 2025
ec8bedd
enable full round-trip-test
flowerthrower Jun 23, 2025
43f2bc2
add platform markers
flowerthrower Jun 23, 2025
294272f
Merge branch 'main' into mlir-plugin
burgholzer Jun 30, 2025
9ab3ef4
⏪ revert a couple of unrelated changes
burgholzer Jun 30, 2025
c43b7cc
♻️ restructure plugin package
burgholzer Jun 30, 2025
c0ee59f
🚧 work in progress that does not work yet
burgholzer Jun 30, 2025
388acf3
🩹 fix sdist for mqt-core
burgholzer Jul 9, 2025
54d4dec
➕ update dependencies
burgholzer Jul 9, 2025
ea57507
🚚 rename to `mqt-core-catalyst-plugin`
burgholzer Jul 9, 2025
7015cf3
🔧 do not explicitly register plugins
burgholzer Jul 9, 2025
745b26a
🔧 add target specific CMake settings
burgholzer Jul 9, 2025
7dda34a
♻️ turn into standalone plugin package
burgholzer Jul 9, 2025
624b5fa
🩹 do not register passes in dialect plugin
burgholzer Jul 9, 2025
4b69fa2
🎨 miscellaneous fixes in pyproject.toml configuration
burgholzer Jul 9, 2025
cbc97e9
🚨 run pre-commit
burgholzer Jul 9, 2025
7a97880
Merge remote-tracking branch 'refs/remotes/munich-quantum-toolkit/mai…
burgholzer Jul 9, 2025
fa3e096
⬆️ update mqt-core plugin dependency
burgholzer Jul 9, 2025
9900215
🔧 do not run cpp-linter on catalyst plugin for now.
burgholzer Jul 9, 2025
77266d3
👷 set up dedicated plugin CI
burgholzer Jul 9, 2025
4d76e3b
🩹 activate virtual environment in CI
burgholzer Jul 9, 2025
3d082df
🩹 enable PIC for MQT Core in plugin
burgholzer Jul 9, 2025
cd575bf
🔧 decouple plugin from main CMake build to avoid endless loop
burgholzer Jul 9, 2025
e3fe319
✏️ disambiguate workflow names
burgholzer Jul 9, 2025
ad33833
🔧 tweak workflow triggers
burgholzer Jul 9, 2025
8124ce3
Merge branch 'main' into mlir-plugin
flowerthrower Jul 10, 2025
70afd91
⏪ revert non plugin specific changes
flowerthrower Jul 10, 2025
173e971
⏪ revert non-plugin specific changes
flowerthrower Jul 10, 2025
3feaa26
⏪ revert non-plugin specific changes
flowerthrower Jul 10, 2025
aaa2188
🩹 properly run pytest
burgholzer Jul 10, 2025
d7d1783
🔧 only build catalyst MLIR component
burgholzer Jul 10, 2025
f1b333f
🩹 use active environment
burgholzer Jul 10, 2025
4b0d47e
⚗️ try building with clang-19 on Ubuntu
burgholzer Jul 10, 2025
e385ea5
Merge branch 'main' into mlir-plugin
burgholzer Jul 11, 2025
a314f38
⚗️ try Catalyst MLIR commit
burgholzer Jul 11, 2025
90dcb7b
🩹 set build type
burgholzer Jul 11, 2025
e80f154
⚗️ tweak LLVM installation
burgholzer Jul 12, 2025
29b121d
🩹 fix the mqt-core version
burgholzer Jul 12, 2025
8f804a2
🙈 simplify gitignore
burgholzer Jul 12, 2025
962802b
⏪ revert unnecessary config
burgholzer Jul 12, 2025
e9a3b56
⏪ don't explicitly install clang version that will not be used
burgholzer Jul 12, 2025
098c174
Merge branch 'main' into mlir-plugin
burgholzer Jul 12, 2025
43333de
⚗️ disable mold as a linker for catalyst build
burgholzer Jul 12, 2025
9179a40
♻️ one more `match` and `rewrite` replacement
burgholzer Jul 12, 2025
d9957f0
🔧 use mqt-core from the source tree
burgholzer Jul 14, 2025
989adfd
⬆️ update catalyst dependency
burgholzer Jul 14, 2025
14e5732
♻️ streamline Python plugin code
burgholzer Jul 14, 2025
106fa7d
🚨 address some clang-tidy warnings
burgholzer Jul 14, 2025
68142d6
🔧 tweak Catalyst installation on Linux
burgholzer Jul 14, 2025
9255e49
🔊 print more test output
burgholzer Jul 14, 2025
f7dce4c
⚗️ try with LLVM 21
burgholzer Jul 14, 2025
04a43f3
📦 only build the targets necessary for the plugin
burgholzer Jul 14, 2025
063b184
⚗️ experiment with the RPATH settings
burgholzer Jul 14, 2025
e7aed92
🔧 exclude macos and llvm@21
burgholzer Jul 14, 2025
610a8d9
⚗️ try compiling with gcc on Linux
burgholzer Jul 15, 2025
039cffc
🩹 disable LLD for catalyst build
burgholzer Jul 15, 2025
337ed02
🔧 only build the check-mlir target
burgholzer Jul 15, 2025
78e6291
⚗️ try an explicit repair wheel step
burgholzer Jul 15, 2025
7d874be
🔧 modify LLVM install configuration to maybe fix the Linux build
burgholzer Jul 15, 2025
e178ed8
🩹 fix CI configuration
burgholzer Jul 15, 2025
bec9939
⬆️ update to release version of Catalyst
burgholzer Jul 15, 2025
e045f05
🩹 also install the catalyst dependency group
burgholzer Jul 15, 2025
dd8cfb3
➕ add catalyst as a runtime dependency
burgholzer Jul 15, 2025
1afa51a
⏪ remove the wheel repair step again for now
burgholzer Jul 15, 2025
3b2c9dd
🔧 run without mold as a linker
burgholzer Jul 16, 2025
04f134d
🔊 print shared library information logs
burgholzer Jul 16, 2025
7668673
:refactor: added missing conversions from the separate PR #880
BertiFlorea Jul 16, 2025
60f7c22
:memo: update pass description with the remaining op conversions
BertiFlorea Jul 16, 2025
e2fde36
:bug: fix missing patterns of existing conversions
BertiFlorea Jul 16, 2025
3de0827
:recycle: add missing PeresOp conversion
BertiFlorea Jul 17, 2025
8686445
:memo: update MQTOptToCatalystQuantum pass description
BertiFlorea Jul 17, 2025
8fa8c0d
:green_heart: update include paths to prevent c lint error
BertiFlorea Jul 17, 2025
dfa1d9d
🎨 pre-commit fixes
pre-commit-ci[bot] Jul 17, 2025
f80355e
:rewind: :green_heart: revert include paths and update cmake file in …
BertiFlorea Jul 17, 2025
a682d93
:construction: try to explicitly point clang to see the includes
BertiFlorea Jul 17, 2025
d641451
🎨 pre-commit fixes
pre-commit-ci[bot] Jul 17, 2025
81b0e36
:recycle: revert catalyst/lib/CMakeLists.txt and catalyst/CMakeLists.txt
BertiFlorea Jul 17, 2025
ea46083
🐛 add arith includes and fix arith div logic
flowerthrower Jul 22, 2025
810ad4b
🐛 fix adjoint parameter handling in quantum gate conversions
flowerthrower Jul 22, 2025
48802d4
Merge remote-tracking branch 'munich-quantum-toolkit/main' into mlir-…
burgholzer Jul 30, 2025
5532a39
🔧 streamline CI configuration
burgholzer Jul 30, 2025
6358288
📦 make uv resolution more precise and update lockfile
burgholzer Jul 30, 2025
5953de0
🔧 match Catalyst macOS deployment target
burgholzer Jul 30, 2025
a83ecf6
⬆️ update C++ standard to C++20
burgholzer Jul 30, 2025
163d7d1
⬆️ update mqt-core version
burgholzer Jul 30, 2025
0b0b6d8
🔧 move prerelease config to comments
burgholzer Jul 30, 2025
fbfcf8c
🔥 remove unused CMake file
burgholzer Jul 30, 2025
41ad6a7
🔥 remove unused variable
burgholzer Jul 30, 2025
1667c4a
🚸 enable optional coverage collection
burgholzer Jul 30, 2025
5b1f072
🔧 optimize CMake configuration with header file sets
burgholzer Jul 30, 2025
32c4fdf
🎨 add format and linting config to plugin
burgholzer Jul 30, 2025
48ea811
♻️ first round of plugin code cleanup
burgholzer Jul 30, 2025
6a6c59f
🔥 remove LLVM 21 from the testing matrix
burgholzer Jul 30, 2025
ee084fd
👷 add Linux ARM to test matrix for plugin
burgholzer Jul 30, 2025
f9b32a2
♻️ simplify conversion patterns
burgholzer Jul 30, 2025
db60591
🐛 fix control and target ordering in MQTOpt to Catalyst translation
burgholzer Jul 30, 2025
6e829f2
🐛 fix pattern for `XXminusYY`
burgholzer Jul 30, 2025
54859f9
🔥 Comment out CI runs not using exact LLVM commit
burgholzer Jul 30, 2025
d2c7fec
✨ enable support for `CSWAP` from catalyst
burgholzer Jul 30, 2025
ee20add
✨ enable support for `S` and `T` from catalyst
burgholzer Jul 30, 2025
aa6bce6
✨ enable support for `ISWAP` from catalyst
burgholzer Jul 30, 2025
9daf5d3
✨ enable support for `Identity` from catalyst
burgholzer Jul 30, 2025
87ab895
✨ enable support for `SX` from catalyst
burgholzer Jul 30, 2025
ed9a3f3
✨ enable support for `ECR` from catalyst
burgholzer Jul 30, 2025
2374378
🎨 directly use string comparisons
burgholzer Jul 30, 2025
fec7946
🎨 reduce boilerplate code
burgholzer Jul 30, 2025
d80d1e4
⏪ restore boilerplate code for unresolved materialization
burgholzer Jul 30, 2025
12c47bf
♻️ streamline conversion to catalyst
burgholzer Jul 30, 2025
9a52a78
♻️ assume `SX` and `ECR` to be legal and supported
burgholzer Jul 30, 2025
857b368
✨ add support for CSWAP in conversion to catalyst
burgholzer Jul 30, 2025
4a7bf6e
♻️ simplify `V` and `Vdg` gate sequence
burgholzer Jul 30, 2025
778ae8f
🐛 fix DCX implementation
burgholzer Jul 30, 2025
b053818
🚨 fix missing header
burgholzer Jul 31, 2025
dbb2bb0
Merge branch 'main' into mlir-plugin
flowerthrower Aug 13, 2025
45ee5e1
add getting started example
flowerthrower Aug 13, 2025
11c308e
🎨 pre-commit fixes
pre-commit-ci[bot] Aug 13, 2025
f4580a3
💚 add ci for plugin lit tests
flowerthrower Aug 15, 2025
f84706e
🐛 fix tests
flowerthrower Aug 15, 2025
df10af6
🐛 fix control order in conversion test
flowerthrower Aug 15, 2025
f8215ca
🎨 pre-commit fixes
pre-commit-ci[bot] Aug 15, 2025
541c7ca
🚧 debug failing conversion
flowerthrower Aug 15, 2025
52023c1
🐛 fix test
flowerthrower Aug 18, 2025
5e46c40
🐛 fix operation names
flowerthrower Aug 18, 2025
5d3df91
✅ add conversion and test for xxplusyy gate
flowerthrower Aug 18, 2025
be0ba8e
🐛 fix lit setup
flowerthrower Aug 18, 2025
3f11c3c
🎨 remove debugging lines
flowerthrower Aug 19, 2025
1250676
✅ fix and test rzx gate conversion
flowerthrower Aug 19, 2025
b10f91b
🐛 fix include directories for Catalyst installation from PyPI
flowerthrower Aug 20, 2025
fca7d10
🎨 pre-commit fixes
pre-commit-ci[bot] Aug 20, 2025
a876914
🎨 clean up CI configuration by removing commented-out jobs and updati…
flowerthrower Aug 20, 2025
108bb60
🐛 update Python executable references to Python3 in CMake files
flowerthrower Aug 20, 2025
0fbdcfc
🐛 fix constant values in MQTOptToCatalystQuantum conversion for corre…
flowerthrower Aug 20, 2025
d48decf
📝 update README.md with installation instructions and system requirem…
flowerthrower Aug 20, 2025
8142c08
🎨 pre-commit fixes
pre-commit-ci[bot] Aug 20, 2025
906ca09
Merge commit '8bb58888948246ab3486c678a595ca670c2eddc7' into mlir-plugin
flowerthrower Aug 21, 2025
e7d8109
🚧 fix conversion patterns
flowerthrower Aug 21, 2025
ac126cd
🎨 imporve tests
flowerthrower Aug 21, 2025
b31f55e
✨ Update clang-tidy configurations and add clang-tidy to ci for the C…
flowerthrower Aug 25, 2025
00b2661
🎨 pre-commit fixes
pre-commit-ci[bot] Aug 25, 2025
5e642d7
🎨 pre-commit
flowerthrower Aug 25, 2025
3bcc78a
🎨 improve lit test coverage
flowerthrower Aug 25, 2025
bca11f7
🎨 reduce code duplication
flowerthrower Aug 25, 2025
7a4c649
Merge branch 'mlir-plugin' of https://github.com/cda-tum/mqt-core int…
flowerthrower Aug 26, 2025
a92555a
🎨 update parameter handling in ConvertMQTOptSimpleGate for VOp
flowerthrower Aug 26, 2025
3110870
Merge branch 'main' into mlir-plugin
flowerthrower Aug 29, 2025
e1193f5
Merge branch 'mlir-plugin' of https://github.com/cda-tum/mqt-core int…
flowerthrower Aug 29, 2025
0acca05
fix checks
flowerthrower Aug 29, 2025
23c1fd7
add pauli gates conversion lit test
flowerthrower Sep 2, 2025
559648d
add clifford gates conversion lit test
flowerthrower Sep 2, 2025
708f2c8
add swap gates conversion lit test
flowerthrower Sep 2, 2025
59bcd6e
add ising gates conversion lit test
flowerthrower Sep 2, 2025
fcf3f5d
add parameterized gates conversion lit test
flowerthrower Sep 2, 2025
81ee0af
remove xxminusyy conversion
flowerthrower Sep 2, 2025
1496eb8
remove duplicate tests
flowerthrower Sep 2, 2025
c9e0c9f
add quantum conversion tests
flowerthrower Sep 4, 2025
bad986e
🎨 make style consistent with other tests
flowerthrower Sep 4, 2025
ef302a7
Merge remote-tracking branch 'origin/main' into mlir-plugin
flowerthrower Sep 19, 2025
2e7dc88
update tests
flowerthrower Sep 26, 2025
cd7916c
🎨 pre-commit fixes
pre-commit-ci[bot] Sep 26, 2025
ac029e8
fix tests
flowerthrower Sep 26, 2025
2ea817b
Merge commit 'cd7916c2e194a709ae71c19aadd1ab3f99250e82' into mlir-plugin
flowerthrower Sep 26, 2025
dd33fbf
Merge branch 'main' into mlir-plugin
flowerthrower Sep 26, 2025
cec133f
first adaptions to work with new mref
flowerthrower Sep 26, 2025
2830e66
🎨 pre-commit fixes
pre-commit-ci[bot] Sep 26, 2025
1a49e72
make work with older llvm
flowerthrower Sep 29, 2025
f273fa4
Merge commit '2830e66c823f742f46bc19a356ddfaba6e73c422' into mlir-plugin
flowerthrower Sep 29, 2025
08a5565
update ising
flowerthrower Sep 29, 2025
0d79329
update entangling tests
flowerthrower Sep 29, 2025
0755907
finish update all mqtopt tests
flowerthrower Sep 29, 2025
fd2c784
fix quantum pauli test
flowerthrower Sep 29, 2025
e3ef2e9
update quantum to mqt conversion to account for mref
flowerthrower Sep 30, 2025
3fe4e05
use mlir isa
flowerthrower Sep 30, 2025
70be761
standardize tests
flowerthrower Oct 1, 2025
54c1dd7
calm down warnings
flowerthrower Oct 1, 2025
abc676d
Merge remote-tracking branch 'origin/main' into mlir-plugin
flowerthrower Oct 1, 2025
1906761
fix fialing tests
flowerthrower Oct 1, 2025
fe20c95
🚧 wip
flowerthrower Oct 1, 2025
54a4ec1
all lit tests succeed
flowerthrower Oct 1, 2025
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
1 change: 1 addition & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FormatStyle: file
HeaderFilterRegex: "^(?!.*plugins/).*"

Checks: |
bugprone-*,
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ jobs:
contents: read
id-token: write

cpp-linter:
cpp-linter: # TODO: exclude the plugin directory from linting here (is done manually in ci_mlir_plugin.yml)
name: 🇨‌ Lint
needs: change-detection
if: fromJSON(needs.change-detection.outputs.run-cpp-linter)
Expand Down
171 changes: 171 additions & 0 deletions .github/workflows/ci_mlir_plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
name: MLIR Plugin CI
on:
push:
branches:
- main
paths:
- "plugins/**"
pull_request:
paths:
- "plugins/**"
- ".github/workflows/ci_mlir_plugin.yml"
merge_group:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
cpp-test-mlir-catalyst-plugin-exact-mlir:
name: 🧩 Test MLIR Catalyst Plugin on ${{ matrix.runs-on }} from exact MLIR source
runs-on: ${{ matrix.runs-on }}
strategy:
matrix:
runs-on: [ubuntu-24.04, ubuntu-24.04-arm, macos-14]
fail-fast: false
env:
CMAKE_BUILD_PARALLEL_LEVEL: 4
CTEST_PARALLEL_LEVEL: 4
FORCE_COLOR: 3
steps:
# Check out the repository
- uses: actions/checkout@v4
with:
fetch-depth: 0

# set up gcc as compiler
- name: Set up GCC as compiler
if: runner.os == 'Linux'
run: |
echo "C_COMPILER=gcc-14" >> $GITHUB_ENV
echo "CXX_COMPILER=g++-14" >> $GITHUB_ENV
echo "CC=gcc-14" >> $GITHUB_ENV
echo "CXX=g++-14" >> $GITHUB_ENV

# set up ccache for faster C++ builds
- name: Setup ccache
uses: Chocobo1/setup-ccache-action@v1
with:
prepend_symlinks_to_path: false
override_cache_key: mlir-plugin-${{ matrix.runs-on }}-exact-mlir

# Set up uv for faster Python package management
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v6
with:
python-version: 3.13
activate-environment: true

# Check out the LLVM commit Catalyst is based on
- name: Checkout llvm
uses: actions/checkout@v4
with:
repository: llvm/llvm-project
ref: 179d30f8c3fddd3c85056fd2b8e877a4a8513158
path: llvm-project

# Install LLVM
- name: Install LLVM
working-directory: llvm-project
run: |
cmake \
-S llvm \
-B build_llvm \
-G Ninja \
-DLLVM_ENABLE_PROJECTS=mlir \
-DLLVM_BUILD_EXAMPLES=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_BUILD_TESTS=OFF \
-DLLVM_INCLUDE_TESTS=OFF \
-DLLVM_INCLUDE_EXAMPLES=OFF \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DLLVM_ENABLE_ZLIB=FORCE_ON \
-DLLVM_ENABLE_ZSTD=OFF \
-DCMAKE_CXX_VISIBILITY_PRESET=default
cmake --build build_llvm --config Release
echo "MLIR_DIR=$(pwd)/build_llvm/lib/cmake/mlir" >> $GITHUB_ENV
echo "LLVM_DIR=$(pwd)/build_llvm/lib/cmake/llvm" >> $GITHUB_ENV

# Build the plugin package
- name: Build mqt-core-catalyst-plugin
working-directory: plugins/catalyst
run: uv sync --verbose --active

# Print shared library dependencies for the plugin
- name: Print shared library dependencies for mqt-core-catalyst-plugin
run: |
if [ "$(uname)" = "Linux" ]; then
ldd .venv/lib/python3.13/site-packages/mqt/core/plugins/catalyst/mqt-core-catalyst-plugin.so || true
elif [ "$(uname)" = "Darwin" ]; then
otool -l .venv/lib/python3.13/site-packages/mqt/core/plugins/catalyst/mqt-core-catalyst-plugin.dylib || true
fi

# Print shared library dependencies for Catalyst
- name: Print shared library dependencies for Catalyst
run: |
if [ "$(uname)" = "Linux" ]; then
ldd $(which catalyst) || true
elif [ "$(uname)" = "Darwin" ]; then
otool -l $(which catalyst) || true
fi

# Reconfigure CMake for LIT
- name: Reconfigure CMake for LIT
working-directory: plugins/catalyst
run: |
BUILD_DIR=$(find build -type d -name Release | head -n1)
cmake -S . \
-B "$BUILD_DIR" \
-DLLVM_EXTERNAL_LIT=$(which lit) \
-DPython3_EXECUTABLE=$(which python) \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON

# Run clang-tidy on plugin code
- name: Run clang-tidy on plugin
working-directory: plugins/catalyst
run: |
BUILD_DIR=$(find build -type d -name Release | head -n1)

# Check if compilation database exists
if [ ! -f "$BUILD_DIR/compile_commands.json" ]; then
echo "No compilation database found, skipping clang-tidy"
exit 0
fi

# Find all C++ source files in the plugin
FILES=$(find lib include -name "*.cpp" -o -name "*.h" 2>/dev/null || true)
if [ -z "$FILES" ]; then
echo "No C++ files found to analyze"
exit 0
fi

# Find Catalyst include directory
CATALYST_INCLUDE=$(find .venv -path "*/catalyst/include" -type d | head -n1)
if [ -z "$CATALYST_INCLUDE" ]; then
echo "Catalyst include directory not found, running without extra includes"
EXTRA_ARGS=""
else
echo "Found Catalyst includes at: $CATALYST_INCLUDE"
EXTRA_ARGS="--extra-arg=-I$CATALYST_INCLUDE"
fi

echo "Running clang-tidy on plugin files..."
echo "$FILES" | xargs clang-tidy \
-p="$BUILD_DIR" \
--config-file=.clang-tidy \
--format-style=file \
$EXTRA_ARGS \
|| echo "clang-tidy completed with warnings"

# Run the MLIR LIT tests
- name: Run LIT tests
working-directory: plugins/catalyst
run: |
BUILD_DIR=$(find build -type d -name Release | head -n1)
ninja -C "$BUILD_DIR" check-mqt-core-catalyst-plugin

# Run the plugin Python tests
- name: Run pytest for mqt-core-catalyst-plugin
working-directory: plugins/catalyst
run: python -m pytest -s --verbose
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ python/**/_version.py
# SKBuild cache dir
_skbuild/

# Any build dirs in the tests
test/**/build/
# Any build dirs
**/build/

# Common editor files
*~
Expand Down Expand Up @@ -167,9 +167,7 @@ Thumbs.db
/distro/plans/main.fmf
/distro/tests/main.fmf

/docs/**/build
.vs
out/build

node_modules/
wheelhouse/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ struct SwapReconstructionAndElision final

// Configure greedy driver
mlir::GreedyRewriteConfig config;
#if MLIR_VERSION_MAJOR >= 22
config.setUseTopDownTraversal(true);
#else
// For older MLIR versions, use the useTopDownTraversal field directly
config.useTopDownTraversal = true;
#endif

// Apply patterns in an iterative and greedy manner.
if (mlir::failed(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#include <mlir/IR/Value.h>
#include <mlir/IR/Visitors.h>
#include <mlir/Support/LLVM.h>
#include <mlir/Support/WalkResult.h>
#include <numeric>
#include <random>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include <mlir/IR/Visitors.h>
#include <mlir/Rewrite/PatternApplicator.h>
#include <mlir/Support/LLVM.h>
#include <mlir/Support/WalkResult.h>
#include <utility>
#include <vector>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <mlir/IR/Value.h>
#include <mlir/IR/Visitors.h>
#include <mlir/Support/LLVM.h>
#include <mlir/Support/WalkResult.h>
#include <vector>

#define DEBUG_TYPE "routing-verification-sc"
Expand Down
1 change: 1 addition & 0 deletions plugins/catalyst/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
BasedOnStyle: InheritParentConfig
2 changes: 2 additions & 0 deletions plugins/catalyst/.clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
InheritParentConfig: true
HeaderFilterRegex: ".*"
65 changes: 65 additions & 0 deletions plugins/catalyst/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Copyright (c) 2023 - 2025 Chair for Design Automation, TUM
# Copyright (c) 2025 Munich Quantum Software Company GmbH
# All rights reserved.
#
# SPDX-License-Identifier: MIT
#
# Licensed under the MIT License

# set required cmake version
cmake_minimum_required(VERSION 3.24...4.0)

project(
mqt-core-catalyst-plugin
LANGUAGES C CXX
VERSION 0.1.0
DESCRIPTION "MQT Core MLIR Plugin for Catalyst")

set(CMAKE_CXX_STANDARD
20
CACHE STRING "C++ standard to conform to")

if(ENABLE_COVERAGE)
add_compile_options(--coverage -O0)
add_link_options(--coverage)
endif()

include(cmake/ExternalDependencies.cmake)

set(MQT_MLIR_PLUGIN_SOURCE_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
set(MQT_MLIR_PLUGIN_BUILD_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/include")

# MLIR must be installed on the system
find_package(MLIR REQUIRED CONFIG)

# Add the paths to the MLIR and LLVM CMake modules.
list(APPEND CMAKE_MODULE_PATH "${MLIR_CMAKE_DIR}")
list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}")

# Include the TableGen, LLVM and MLIR CMake modules.
include(TableGen)
include(AddLLVM)
include(AddMLIR)
include(HandleLLVMOptions)

include_directories(${LLVM_INCLUDE_DIRS})
include_directories(${MLIR_INCLUDE_DIRS})
include_directories(BEFORE ${MQT_MLIR_PLUGIN_SOURCE_INCLUDE_DIR})
include_directories(BEFORE ${MQT_MLIR_PLUGIN_BUILD_INCLUDE_DIR})
include_directories(${CATALYST_INCLUDE_DIRS})

link_directories(${LLVM_BUILD_LIBRARY_DIR})
add_definitions(${LLVM_DEFINITIONS})

if(APPLE)
set(BASEPOINT @loader_path)
else()
set(BASEPOINT $ORIGIN)
endif()
set(CMAKE_INSTALL_RPATH ${BASEPOINT} ${BASEPOINT}/${CMAKE_INSTALL_LIBDIR})
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)

add_subdirectory(include)
add_subdirectory(lib)
add_subdirectory(test)
22 changes: 22 additions & 0 deletions plugins/catalyst/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
MIT License

Copyright (c) 2023 - 2025 Chair for Design Automation, TUM
Copyright (c) 2025 Munich Quantum Software Company GmbH

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading
Loading