Skip to content
Open
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
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ jobs:
uses: munich-quantum-toolkit/workflows/.github/workflows/reusable-python-tests.yml@e7f84f39ce2d3b6c5d1d04526b8f94f98e455143 # v2.2.0
with:
runs-on: ${{ matrix.runs-on }}
setup-mlir: true
llvm-version: 22.1.7

python-coverage:
name: 🐍 Coverage
Expand All @@ -208,6 +210,8 @@ jobs:
uses: munich-quantum-toolkit/workflows/.github/workflows/reusable-python-tests.yml@e7f84f39ce2d3b6c5d1d04526b8f94f98e455143 # v2.2.0
with:
runs-on: ${{ matrix.runs-on }}
setup-mlir: true
llvm-version: 22.1.7

python-linter:
name: 🐍 Lint
Expand All @@ -218,6 +222,8 @@ jobs:
check-stubs: true
enable-ty: true
enable-mypy: false
setup-mlir: true
llvm-version: 22.1.7

build-sdist:
name: 🚀 CD
Expand All @@ -244,6 +250,8 @@ jobs:
uses: munich-quantum-toolkit/workflows/.github/workflows/reusable-python-packaging-wheel-cibuildwheel.yml@e7f84f39ce2d3b6c5d1d04526b8f94f98e455143 # v2.2.0
with:
runs-on: ${{ matrix.runs-on }}
setup-mlir: true
llvm-version: 22.1.7

# this job does nothing and is only used for branch protection
required-checks-pass:
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ build:
- asdf install uv latest
- asdf global uv latest
# Install MLIR
- curl -LsSf https://github.com/munich-quantum-software/setup-mlir/releases/latest/download/setup-mlir.sh | bash -s -- -v 22.1.0 -p $HOME/mlir
- curl -LsSf https://github.com/munich-quantum-software/setup-mlir/releases/download/v1.4.1/setup-mlir.sh | bash -s -- -v 22.1.7 -p $HOME/mlir
# Build the MLIR documentation
- uvx cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_MQT_CORE_MLIR=ON -DMLIR_DIR=$HOME/mlir/lib/cmake/mlir
- uvx cmake --build build --target mlir-doc
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,11 @@ if(MQT_CORE_INSTALL)
endif()

cmake_dependent_option(BUILD_MQT_CORE_QIR_RUNNER "Build the QIR runner of the MQT Core project" ON
"BUILD_MQT_CORE_MLIR" OFF)
"BUILD_MQT_CORE_MLIR;NOT BUILD_MQT_CORE_BINDINGS" OFF)

cmake_dependent_option(
BUILD_MQT_CORE_QDMI_DDSIM_WITH_QIR "Enable QIR program format support for the DDSIM QDMI Device"
ON "BUILD_MQT_CORE_MLIR" OFF)
ON "BUILD_MQT_CORE_MLIR;NOT BUILD_MQT_CORE_BINDINGS" OFF)

# add main library code
add_subdirectory(src)
Expand Down
15 changes: 10 additions & 5 deletions UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ please refer to the [changelog](CHANGELOG.md).

## [Unreleased]

### MLIR enabled by default for C++ builds
### MLIR enabled by default for C++ and Python package builds

The MLIR-based functionality within MQT Core has long been experimental
and opt-in.
Expand All @@ -24,10 +24,15 @@ You can then point CMake to the installation directory using the

The MLIR components can still be manually disabled by passing
`-DBUILD_MQT_CORE_MLIR=OFF` to CMake.
MLIR is also not enabled for the Python package builds
because no functionality depends on it yet.
This is expected to change in the future,
when we expose the MLIR-based functionality via the Python package.
As of this release, MLIR is also enabled for Python package builds,
since the package now exposes an MLIR-based compiler entry point in
`mqt.core.mlir`.

For local development, you can configure `MLIR_DIR`
once in a repository-local `.env` file
(for example, `MLIR_DIR=/path/to/installation/lib/cmake/mlir`).
MQT Core's CMake setup will pick this up automatically
when `MLIR_DIR` is not otherwise provided.

Known limitations:

Expand Down
4 changes: 4 additions & 0 deletions bindings/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ add_subdirectory(ir)
add_subdirectory(dd)
add_subdirectory(fomac)
add_subdirectory(na)

if(BUILD_MQT_CORE_MLIR)
add_subdirectory(mlir)
endif()
41 changes: 41 additions & 0 deletions bindings/mlir/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# 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

set(TARGET_NAME "${MQT_CORE_TARGET_NAME}-mlir-bindings")

if(NOT TARGET ${TARGET_NAME})
# collect source files
file(GLOB_RECURSE SOURCES *.cpp)

# declare the Python module
add_mqt_python_binding_nanobind(
CORE
${TARGET_NAME}
${SOURCES}
MODULE_NAME
mlir
INSTALL_DIR
.
LINK_LIBS
MQTCompilerPipeline
MLIRQCTranslation
MLIRParser
MLIRJeffTranslation
MLIRJeffToQCO
MLIRQCOToQC
MQT::MLIRSupport
MQT::CoreIR)

# install the Python stub file in editable mode for better IDE support
if(SKBUILD_STATE STREQUAL "editable")
install(
FILES ${PROJECT_SOURCE_DIR}/python/mqt/core/mlir.pyi
DESTINATION .
COMPONENT ${MQT_CORE_TARGET_NAME}_Python)
endif()
endif()
Loading
Loading