From 51b81ef05e533e194dcdbd9583cc53bc5d6ab3a5 Mon Sep 17 00:00:00 2001 From: Milan D Vijay Date: Thu, 4 Jun 2026 02:11:16 +0530 Subject: [PATCH 1/6] add mlir python bindings poc for qasm-to-qco pipeline --- CMakeLists.txt | 7 +++ mlir/CMakeLists.txt | 11 ++++ mlir/include/mlir/CAPI/Dialects.h | 31 +++++++++++ mlir/lib/CAPI/CMakeLists.txt | 30 +++++++++++ mlir/lib/CAPI/Dialects.cpp | 45 ++++++++++++++++ mlir/lib/CMakeLists.txt | 4 ++ mlir/python/CMakeLists.txt | 72 +++++++++++++++++++++++++ mlir/python/MQTCoreMLIRModule.cpp | 69 ++++++++++++++++++++++++ mlir/python/mqt/core/mlir/__init__.py | 16 ++++++ mlir/python/mqt/core/mlir/_pipeline.py | 39 ++++++++++++++ poc/CMakeLists.txt | 27 ++++++++++ poc/test_pipeline.cpp | 74 ++++++++++++++++++++++++++ 12 files changed, 425 insertions(+) create mode 100644 mlir/include/mlir/CAPI/Dialects.h create mode 100644 mlir/lib/CAPI/CMakeLists.txt create mode 100644 mlir/lib/CAPI/Dialects.cpp create mode 100644 mlir/python/CMakeLists.txt create mode 100644 mlir/python/MQTCoreMLIRModule.cpp create mode 100644 mlir/python/mqt/core/mlir/__init__.py create mode 100644 mlir/python/mqt/core/mlir/_pipeline.py create mode 100644 poc/CMakeLists.txt create mode 100644 poc/test_pipeline.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 4c1a0eee53..e457789ce4 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -120,6 +120,12 @@ endif() cmake_dependent_option(BUILD_MQT_CORE_QIR_RUNNER "Build the QIR runner of the MQT Core project" ON "BUILD_MQT_CORE_MLIR" OFF) +cmake_dependent_option( + BUILD_MQT_CORE_MLIR_PYTHON + "Build Python bindings for the MQT MLIR compiler collection (requires MLIR_ENABLE_BINDINGS_PYTHON=ON)" + OFF + "BUILD_MQT_CORE_MLIR" + OFF) # add main library code add_subdirectory(src) @@ -143,6 +149,7 @@ endif() if(BUILD_MQT_CORE_MLIR) add_subdirectory(mlir) + add_subdirectory(poc) # copy generated MLIR documentation add_custom_command( diff --git a/mlir/CMakeLists.txt b/mlir/CMakeLists.txt index cf6726f811..093e094076 100644 --- a/mlir/CMakeLists.txt +++ b/mlir/CMakeLists.txt @@ -40,6 +40,17 @@ add_subdirectory(include) add_subdirectory(lib) add_subdirectory(tools) +if(BUILD_MQT_CORE_MLIR_PYTHON) + if(NOT MLIR_ENABLE_BINDINGS_PYTHON) + message(FATAL_ERROR "BUILD_MQT_CORE_MLIR_PYTHON requires MLIR to be built with " + "MLIR_ENABLE_BINDINGS_PYTHON=ON. Re-build MLIR with that flag set.") + endif() + include(AddMLIRPython) + include(MLIRDetectPythonEnv) + mlir_configure_python_dev_packages() + add_subdirectory(python) +endif() + # add test code if(BUILD_MQT_CORE_TESTS) add_subdirectory(unittests) diff --git a/mlir/include/mlir/CAPI/Dialects.h b/mlir/include/mlir/CAPI/Dialects.h new file mode 100644 index 0000000000..74fea37435 --- /dev/null +++ b/mlir/include/mlir/CAPI/Dialects.h @@ -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 + */ + +#pragma once + +#include "mlir-c/IR.h" +#include "mlir-c/Support.h" + +#ifdef __cplusplus +extern "C" { +#endif + +MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(QC, qc); +MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(QCO, qco); + +/** Registers and loads all MQT MLIR dialects into a context. */ +MLIR_CAPI_EXPORTED void mqtMlirRegisterAllDialects(MlirContext context); + +/** Registers all MQT MLIR passes into the global registry. */ +MLIR_CAPI_EXPORTED void mqtMlirRegisterAllPasses(void); + +#ifdef __cplusplus +} +#endif diff --git a/mlir/lib/CAPI/CMakeLists.txt b/mlir/lib/CAPI/CMakeLists.txt new file mode 100644 index 0000000000..6e8307b092 --- /dev/null +++ b/mlir/lib/CAPI/CMakeLists.txt @@ -0,0 +1,30 @@ +# 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 + +add_mlir_public_c_api_library( + MQTMLIRCoreDialectsCAPI + Dialects.cpp + ADDITIONAL_HEADER_DIRS + ${MQT_MLIR_SOURCE_INCLUDE_DIR}/mlir/CAPI + ENABLE_AGGREGATION + LINK_LIBS + PUBLIC + MLIRIR + MLIRSupport + MLIRQCDialect + MLIRQCODialect + MLIRQTensorDialect + MLIRArithDialect + MLIRFuncDialect + MLIRMemRefDialect + MLIRSCFDialect + MLIRQCTransforms + MLIRQCOTransforms + MLIRQCToQCO) + +mqt_mlir_target_use_project_options(MQTMLIRCoreDialectsCAPI) diff --git a/mlir/lib/CAPI/Dialects.cpp b/mlir/lib/CAPI/Dialects.cpp new file mode 100644 index 0000000000..f34eb64c5e --- /dev/null +++ b/mlir/lib/CAPI/Dialects.cpp @@ -0,0 +1,45 @@ +/* + * 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 + */ + +#include "mlir/CAPI/Dialects.h" + +#include "mlir/CAPI/IR.h" +#include "mlir/CAPI/Registration.h" +#include "mlir/Conversion/QCToQCO/QCToQCO.h" +#include "mlir/Dialect/QC/IR/QCDialect.h" +#include "mlir/Dialect/QC/Transforms/Passes.h" +#include "mlir/Dialect/QCO/IR/QCODialect.h" +#include "mlir/Dialect/QCO/Transforms/Passes.h" +#include "mlir/Dialect/QTensor/IR/QTensorDialect.h" + +#include +#include +#include +#include +#include + +MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(QC, qc, ::mlir::qc::QCDialect) +MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(QCO, qco, ::mlir::qco::QCODialect) + +void mqtMlirRegisterAllDialects(MlirContext context) { + mlir::DialectRegistry registry; + registry.insert(); + unwrap(context)->appendDialectRegistry(registry); + unwrap(context)->loadAllAvailableDialects(); +} + +void mqtMlirRegisterAllPasses() { + mlir::qc::registerQCPasses(); + mlir::qco::registerQCOPasses(); + mlir::registerQCToQCOPasses(); +} diff --git a/mlir/lib/CMakeLists.txt b/mlir/lib/CMakeLists.txt index 959d80e2f1..122dc339a4 100644 --- a/mlir/lib/CMakeLists.txt +++ b/mlir/lib/CMakeLists.txt @@ -10,3 +10,7 @@ add_subdirectory(Conversion) add_subdirectory(Compiler) add_subdirectory(Dialect) add_subdirectory(Support) + +if(BUILD_MQT_CORE_MLIR_PYTHON) + add_subdirectory(CAPI) +endif() diff --git a/mlir/python/CMakeLists.txt b/mlir/python/CMakeLists.txt new file mode 100644 index 0000000000..cd9966f555 --- /dev/null +++ b/mlir/python/CMakeLists.txt @@ -0,0 +1,72 @@ +# 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 + +# Disable versioned soname — causes duplication in Python wheels. +set(CMAKE_PLATFORM_NO_VERSIONED_SONAME ON) + +set(MQT_MLIR_PYTHON_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/mqt/core/mlir") +set(MQT_MLIR_PYTHON_PACKAGES_DIR "${CMAKE_CURRENT_BINARY_DIR}/python_packages") + +# ################################################################################################## +# Sources +# ################################################################################################## + +declare_mlir_python_sources(MQTCoreMLIRPythonSources ROOT_DIR "${MQT_MLIR_PYTHON_ROOT_DIR}" SOURCES + __init__.py _pipeline.py) + +declare_mlir_python_sources(MQTCoreMLIRPythonExtensions) + +# ################################################################################################## +# Extension module +# ################################################################################################## + +declare_mlir_python_extension( + MQTCoreMLIRPythonExtensions.Main + MODULE_NAME + _mqtCoreMlir + ADD_TO_PARENT + MQTCoreMLIRPythonExtensions + SOURCES + MQTCoreMLIRModule.cpp + EMBED_CAPI_LINK_LIBS + MQTMLIRCoreDialectsCAPI + MLIRQCTranslation + MLIRSupportMQT + PRIVATE_LINK_LIBS + LLVMSupport + MQT::CoreIR) + +# ################################################################################################## +# Aggregate and install +# ################################################################################################## + +set(_source_components MQTCoreMLIRPythonSources MQTCoreMLIRPythonExtensions) + +add_mlir_python_common_capi_library( + MQTCoreMLIRAggregateCAPI + INSTALL_COMPONENT + MQTCoreMLIRPythonModules + INSTALL_DESTINATION + python_packages/mqt/core/mlir/_mlir_libs + OUTPUT_DIRECTORY + "${MQT_MLIR_PYTHON_PACKAGES_DIR}/mqt/core/mlir/_mlir_libs" + RELATIVE_INSTALL_ROOT + "../../../.." + DECLARED_SOURCES + ${_source_components}) + +add_mlir_python_modules( + MQTCoreMLIRPythonModules + ROOT_PREFIX + "${MQT_MLIR_PYTHON_PACKAGES_DIR}/mqt/core/mlir" + INSTALL_PREFIX + "python_packages/mqt/core/mlir" + DECLARED_SOURCES + ${_source_components} + COMMON_CAPI_LINK_LIBS + MQTCoreMLIRAggregateCAPI) diff --git a/mlir/python/MQTCoreMLIRModule.cpp b/mlir/python/MQTCoreMLIRModule.cpp new file mode 100644 index 0000000000..68adfb92a4 --- /dev/null +++ b/mlir/python/MQTCoreMLIRModule.cpp @@ -0,0 +1,69 @@ +/* + * 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 + */ + +#include "mlir/Bindings/Python/NanobindAdaptors.h" +#include "mlir/CAPI/Dialects.h" +#include "mlir/Conversion/QCToQCO/QCToQCO.h" +#include "mlir/Dialect/QC/Translation/TranslateQuantumComputationToQC.h" +#include "mlir/Support/Passes.h" +#include "qasm3/Importer.hpp" + +#include +#include +#include +#include +#include + +#include // NOLINT(misc-include-cleaner) +#include // NOLINT(misc-include-cleaner) + +namespace nb = nanobind; + +// NOLINTNEXTLINE(misc-use-internal-linkage,readability-identifier-naming,readability-named-parameter) +NB_MODULE(_mqtCoreMlir, m) { + mqtMlirRegisterAllPasses(); + + m.doc() = "MQT Core MLIR Python bindings"; + + m.def( + "register_dialects", + [](MlirContext context) { mqtMlirRegisterAllDialects(context); }, + nb::arg("context"), + "Register and load QC, QCO, QTensor, and dependent MLIR dialects."); + + m.def( + "qasm_to_qco", + [](const std::string& qasm) -> std::string { + auto qc = qasm3::Importer::imports(qasm); + + mlir::MLIRContext ctx; + MlirContext cCtx{&ctx}; + mqtMlirRegisterAllDialects(cCtx); + + auto module = mlir::translateQuantumComputationToQC(&ctx, qc); + if (!module) { + throw std::runtime_error("failed to translate circuit to QC MLIR"); + } + + mlir::PassManager pm(&ctx); + populateQCCleanupPipeline(pm); + pm.addPass(mlir::createQCToQCO()); + if (mlir::failed(pm.run(*module))) { + throw std::runtime_error("qc-to-qco conversion failed"); + } + + std::string out; + llvm::raw_string_ostream os(out); + module->print(os); + return out; + }, + nb::arg("qasm"), + "Run the full (py:qasm) -> (mlir:qc) -> (mlir:qco) pipeline."); +} diff --git a/mlir/python/mqt/core/mlir/__init__.py b/mlir/python/mqt/core/mlir/__init__.py new file mode 100644 index 0000000000..00104c0f05 --- /dev/null +++ b/mlir/python/mqt/core/mlir/__init__.py @@ -0,0 +1,16 @@ +# 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 + +"""Python bindings for the MQT MLIR compiler collection.""" + +from __future__ import annotations + +from ._mlir_libs._mqtCoreMlir import qasm_to_qco, register_dialects +from ._pipeline import compile_qc_to_qco, make_context + +__all__ = ["compile_qc_to_qco", "make_context", "qasm_to_qco", "register_dialects"] diff --git a/mlir/python/mqt/core/mlir/_pipeline.py b/mlir/python/mqt/core/mlir/_pipeline.py new file mode 100644 index 0000000000..382b93fc06 --- /dev/null +++ b/mlir/python/mqt/core/mlir/_pipeline.py @@ -0,0 +1,39 @@ +# 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 + +"""High-level pipeline helpers built on top of the MLIR Python bindings.""" + +from __future__ import annotations + +from mlir.ir import Context, Module +from mlir.passmanager import PassManager + +from ._mlir_libs._mqtCoreMlir import register_dialects + + +def make_context() -> Context: + """Return an MLIRContext with all MQT dialects registered and loaded.""" + ctx = Context() + register_dialects(ctx) + return ctx + + +def compile_qc_to_qco(mlir_text: str) -> str: + """Run the qc-to-qco conversion pass on an MLIR module given as text. + + Args: + mlir_text: MLIR module in the QC dialect, as a string. + + Returns: + The resulting QCO dialect MLIR module as a string. + """ + with make_context() as ctx: + module = Module.parse(mlir_text, ctx) + pm = PassManager.parse("builtin.module(qc-to-qco)", ctx) + pm.run(module.operation) + return str(module) diff --git a/poc/CMakeLists.txt b/poc/CMakeLists.txt new file mode 100644 index 0000000000..884a0dc9e7 --- /dev/null +++ b/poc/CMakeLists.txt @@ -0,0 +1,27 @@ +# 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 + +add_executable(poc-test-pipeline test_pipeline.cpp) + +target_link_libraries( + poc-test-pipeline + PRIVATE MLIRQCDialect + MLIRQCODialect + MLIRQTensorDialect + MLIRArithDialect + MLIRFuncDialect + MLIRMemRefDialect + MLIRSCFDialect + MLIRQCTranslation + MLIRQCToQCO + MLIRSupportMQT + MLIRPass + MQT::CoreIR + MQT::CoreQASM) + +mqt_mlir_target_use_project_options(poc-test-pipeline) diff --git a/poc/test_pipeline.cpp b/poc/test_pipeline.cpp new file mode 100644 index 0000000000..f20f16b57a --- /dev/null +++ b/poc/test_pipeline.cpp @@ -0,0 +1,74 @@ +/* + * Standalone C++ test for the (py:qasm) -> (mlir:qc) -> (mlir:qco) pipeline. + * + * Build: + * cmake --build build --target poc-test-pipeline + * Run: + * ./build/poc/poc-test-pipeline + */ + +#include "ir/QuantumComputation.hpp" +#include "mlir/Conversion/QCToQCO/QCToQCO.h" +#include "mlir/Dialect/QC/IR/QCDialect.h" +#include "mlir/Dialect/QC/Translation/TranslateQuantumComputationToQC.h" +#include "mlir/Dialect/QCO/IR/QCODialect.h" +#include "mlir/Dialect/QTensor/IR/QTensorDialect.h" +#include "mlir/Support/Passes.h" +#include "qasm3/Importer.hpp" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace { +const char* const BELL_QASM = R"( +OPENQASM 2.0; +include "qelib1.inc"; +qreg q[2]; +h q[0]; +cx q[0], q[1]; +)"; +} // namespace + +int main() { + auto qc = qasm3::Importer::imports(BELL_QASM); + + mlir::MLIRContext ctx; + mlir::DialectRegistry registry; + registry.insert(); + ctx.appendDialectRegistry(registry); + ctx.loadAllAvailableDialects(); + + auto module = mlir::translateQuantumComputationToQC(&ctx, qc); + if (!module) { + llvm::errs() << "translation failed\n"; + return 1; + } + + llvm::outs() << "=== mlir:qc ===\n"; + module->print(llvm::outs()); + llvm::outs() << "\n"; + + mlir::PassManager pm(&ctx); + populateQCCleanupPipeline(pm); + pm.addPass(mlir::createQCToQCO()); + if (mlir::failed(pm.run(*module))) { + llvm::errs() << "conversion failed\n"; + return 1; + } + + llvm::outs() << "=== mlir:qco ===\n"; + module->print(llvm::outs()); + llvm::outs() << "\n"; + + return 0; +} From b7a05b4056de640cef1a920f904746bee9925264 Mon Sep 17 00:00:00 2001 From: Milan D Vijay Date: Thu, 4 Jun 2026 02:26:05 +0530 Subject: [PATCH 2/6] fix misc-include-cleaner clang-tidy warnings --- mlir/python/MQTCoreMLIRModule.cpp | 21 +++++++++++---------- poc/test_pipeline.cpp | 2 +- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/mlir/python/MQTCoreMLIRModule.cpp b/mlir/python/MQTCoreMLIRModule.cpp index 68adfb92a4..ba6b27b305 100644 --- a/mlir/python/MQTCoreMLIRModule.cpp +++ b/mlir/python/MQTCoreMLIRModule.cpp @@ -8,23 +8,24 @@ * Licensed under the MIT License */ -#include "mlir/Bindings/Python/NanobindAdaptors.h" +#include "mlir-c/IR.h" +#include "mlir/Bindings/Python/NanobindAdaptors.h" // NOLINT(misc-include-cleaner) #include "mlir/CAPI/Dialects.h" -#include "mlir/Conversion/QCToQCO/QCToQCO.h" -#include "mlir/Dialect/QC/Translation/TranslateQuantumComputationToQC.h" -#include "mlir/Support/Passes.h" +#include "mlir/Conversion/QCToQCO/QCToQCO.h" // NOLINT(misc-include-cleaner) +#include "mlir/Dialect/QC/Translation/TranslateQuantumComputationToQC.h" // NOLINT(misc-include-cleaner) +#include "mlir/Support/Passes.h" // NOLINT(misc-include-cleaner) #include "qasm3/Importer.hpp" -#include -#include -#include -#include -#include +#include // NOLINT(misc-include-cleaner) +#include // NOLINT(misc-include-cleaner) +#include // NOLINT(misc-include-cleaner) +#include // NOLINT(misc-include-cleaner) +#include // NOLINT(misc-include-cleaner) #include // NOLINT(misc-include-cleaner) #include // NOLINT(misc-include-cleaner) -namespace nb = nanobind; +namespace nb = nanobind; // NOLINT(misc-unused-alias-decls) // NOLINTNEXTLINE(misc-use-internal-linkage,readability-identifier-naming,readability-named-parameter) NB_MODULE(_mqtCoreMlir, m) { diff --git a/poc/test_pipeline.cpp b/poc/test_pipeline.cpp index f20f16b57a..4cbd5f9c9c 100644 --- a/poc/test_pipeline.cpp +++ b/poc/test_pipeline.cpp @@ -7,7 +7,7 @@ * ./build/poc/poc-test-pipeline */ -#include "ir/QuantumComputation.hpp" +#include "ir/QuantumComputation.hpp" // NOLINT(misc-include-cleaner) #include "mlir/Conversion/QCToQCO/QCToQCO.h" #include "mlir/Dialect/QC/IR/QCDialect.h" #include "mlir/Dialect/QC/Translation/TranslateQuantumComputationToQC.h" From d8f9dfee70666dddcf9e5d23a68012098bc6b9a7 Mon Sep 17 00:00:00 2001 From: Milan D Vijay Date: Thu, 4 Jun 2026 02:50:15 +0530 Subject: [PATCH 3/6] suppress misc-include-cleaner on MlirContext usage sites --- mlir/python/MQTCoreMLIRModule.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/mlir/python/MQTCoreMLIRModule.cpp b/mlir/python/MQTCoreMLIRModule.cpp index ba6b27b305..f82ea44cf6 100644 --- a/mlir/python/MQTCoreMLIRModule.cpp +++ b/mlir/python/MQTCoreMLIRModule.cpp @@ -8,7 +8,6 @@ * Licensed under the MIT License */ -#include "mlir-c/IR.h" #include "mlir/Bindings/Python/NanobindAdaptors.h" // NOLINT(misc-include-cleaner) #include "mlir/CAPI/Dialects.h" #include "mlir/Conversion/QCToQCO/QCToQCO.h" // NOLINT(misc-include-cleaner) @@ -33,11 +32,12 @@ NB_MODULE(_mqtCoreMlir, m) { m.doc() = "MQT Core MLIR Python bindings"; - m.def( - "register_dialects", - [](MlirContext context) { mqtMlirRegisterAllDialects(context); }, - nb::arg("context"), - "Register and load QC, QCO, QTensor, and dependent MLIR dialects."); + // NOLINTNEXTLINE(misc-include-cleaner) + auto registerDialects = [](MlirContext context) { + mqtMlirRegisterAllDialects(context); + }; + m.def("register_dialects", registerDialects, nb::arg("context"), + "Register and load QC, QCO, QTensor, and dependent MLIR dialects."); m.def( "qasm_to_qco", @@ -45,6 +45,7 @@ NB_MODULE(_mqtCoreMlir, m) { auto qc = qasm3::Importer::imports(qasm); mlir::MLIRContext ctx; + // NOLINTNEXTLINE(misc-include-cleaner) MlirContext cCtx{&ctx}; mqtMlirRegisterAllDialects(cCtx); From 5acd3f945c9ad78305f930140a9166e00ff1b7e5 Mon Sep 17 00:00:00 2001 From: Milan D Vijay Date: Thu, 4 Jun 2026 04:20:23 +0530 Subject: [PATCH 4/6] fix MlirContext include: add mlir-c/IR.h directly --- mlir/python/MQTCoreMLIRModule.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mlir/python/MQTCoreMLIRModule.cpp b/mlir/python/MQTCoreMLIRModule.cpp index f82ea44cf6..609a42f031 100644 --- a/mlir/python/MQTCoreMLIRModule.cpp +++ b/mlir/python/MQTCoreMLIRModule.cpp @@ -8,6 +8,7 @@ * Licensed under the MIT License */ +#include "mlir-c/IR.h" #include "mlir/Bindings/Python/NanobindAdaptors.h" // NOLINT(misc-include-cleaner) #include "mlir/CAPI/Dialects.h" #include "mlir/Conversion/QCToQCO/QCToQCO.h" // NOLINT(misc-include-cleaner) @@ -32,7 +33,6 @@ NB_MODULE(_mqtCoreMlir, m) { m.doc() = "MQT Core MLIR Python bindings"; - // NOLINTNEXTLINE(misc-include-cleaner) auto registerDialects = [](MlirContext context) { mqtMlirRegisterAllDialects(context); }; @@ -45,7 +45,6 @@ NB_MODULE(_mqtCoreMlir, m) { auto qc = qasm3::Importer::imports(qasm); mlir::MLIRContext ctx; - // NOLINTNEXTLINE(misc-include-cleaner) MlirContext cCtx{&ctx}; mqtMlirRegisterAllDialects(cCtx); From ed720c9afbd22de745d6d0b022be235bf80e3f50 Mon Sep 17 00:00:00 2001 From: Milan D Vijay Date: Thu, 4 Jun 2026 04:38:01 +0530 Subject: [PATCH 5/6] fix include-cleaner warnings in Dialects.cpp --- mlir/lib/CAPI/Dialects.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mlir/lib/CAPI/Dialects.cpp b/mlir/lib/CAPI/Dialects.cpp index f34eb64c5e..2840adb761 100644 --- a/mlir/lib/CAPI/Dialects.cpp +++ b/mlir/lib/CAPI/Dialects.cpp @@ -10,13 +10,14 @@ #include "mlir/CAPI/Dialects.h" +#include "mlir-c/IR.h" #include "mlir/CAPI/IR.h" #include "mlir/CAPI/Registration.h" #include "mlir/Conversion/QCToQCO/QCToQCO.h" #include "mlir/Dialect/QC/IR/QCDialect.h" #include "mlir/Dialect/QC/Transforms/Passes.h" #include "mlir/Dialect/QCO/IR/QCODialect.h" -#include "mlir/Dialect/QCO/Transforms/Passes.h" +#include "mlir/Dialect/QCO/Transforms/Passes.h" // NOLINT(misc-include-cleaner) #include "mlir/Dialect/QTensor/IR/QTensorDialect.h" #include From 37588a580c0b31d1e20ca7b8feb99a799affee49 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 3 Jun 2026 23:09:08 +0000 Subject: [PATCH 6/6] =?UTF-8?q?=F0=9F=8E=A8=20pre-commit=20fixes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- poc/test_pipeline.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/poc/test_pipeline.cpp b/poc/test_pipeline.cpp index 4cbd5f9c9c..f3d0b5418c 100644 --- a/poc/test_pipeline.cpp +++ b/poc/test_pipeline.cpp @@ -1,3 +1,13 @@ +/* + * 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 + */ + /* * Standalone C++ test for the (py:qasm) -> (mlir:qc) -> (mlir:qco) pipeline. *