From 62d3ac49aaf53e9f9efd98f217dd0623bb0dd397 Mon Sep 17 00:00:00 2001 From: Daniel Haag <121057143+denialhaag@users.noreply.github.com> Date: Mon, 16 Mar 2026 01:51:57 +0100 Subject: [PATCH 1/8] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Update=20jeff-mlir?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/ExternalDependencies.cmake | 2 +- .../mlir/Conversion/JeffToQCO/JeffToQCO.td | 30 +++-- .../mlir/Conversion/QCOToJeff/QCOToJeff.td | 15 ++- mlir/lib/Conversion/JeffToQCO/CMakeLists.txt | 1 + mlir/lib/Conversion/JeffToQCO/JeffToQCO.cpp | 123 +++++------------- mlir/lib/Conversion/QCOToJeff/CMakeLists.txt | 1 + mlir/lib/Conversion/QCOToJeff/QCOToJeff.cpp | 72 ++-------- 7 files changed, 71 insertions(+), 173 deletions(-) diff --git a/cmake/ExternalDependencies.cmake b/cmake/ExternalDependencies.cmake index 6b99e90e11..451fedfffb 100644 --- a/cmake/ExternalDependencies.cmake +++ b/cmake/ExternalDependencies.cmake @@ -41,7 +41,7 @@ if(BUILD_MQT_CORE_MLIR) FetchContent_Declare( jeff-mlir GIT_REPOSITORY https://github.com/PennyLaneAI/jeff-mlir.git - GIT_TAG c22047e0ebe361126f042baf3c439e0042827a03) + GIT_TAG 7b07a285dfd41aff13f612933995ff01a80c8817) list(APPEND FETCH_PACKAGES jeff-mlir) endif() diff --git a/mlir/include/mlir/Conversion/JeffToQCO/JeffToQCO.td b/mlir/include/mlir/Conversion/JeffToQCO/JeffToQCO.td index 43f6d306ed..9237a19aa4 100644 --- a/mlir/include/mlir/Conversion/JeffToQCO/JeffToQCO.td +++ b/mlir/include/mlir/Conversion/JeffToQCO/JeffToQCO.td @@ -12,24 +12,26 @@ def JeffToQCO : Pass<"jeff-to-qco"> { let summary = "Convert Jeff operations to QCO operations"; let description = [{ - This pass converts all operations from the Jeff dialect to their equivalent operations in the QCO dialect. - It ensures that the returned module is a valid QCO module. + This pass converts all operations from the Jeff dialect to their equivalent operations in the QCO dialect. + It ensures that the returned module is a valid QCO module. - Note that this pass is still in development as QCO and Jeff do not have full feature parity yet. + Note that this pass is still in development as QCO and Jeff do not have full feature parity yet. - Known limitations: + Known limitations: - - Gates with a non-trivial power are currently not supported - - Only specific `CustomOp`s are currently supported - - Only specific `PPROp`s are currently supported - - `Qureg_Op`s are currently not supported - - `SCF_Op`s are currently not supported - - Support for multiple functions is currently limited - }]; + - Gates with a non-trivial power are currently not supported + - Only specific `CustomOp`s are currently supported + - Only specific `PPROp`s are currently supported + - `Qureg_Op`s are currently not supported + - `SCF_Op`s are currently not supported + - Support for multiple functions is currently limited + }]; let dependentDialects = [ - "mlir::arith::ArithDialect", - "mlir::jeff::JeffDialect", - "mlir::qco::QCODialect", + "mlir::arith::ArithDialect", + "mlir::math::MathDialect", + "mlir::tensor::TensorDialect", + "mlir::jeff::JeffDialect", + "mlir::qco::QCODialect", ]; } diff --git a/mlir/include/mlir/Conversion/QCOToJeff/QCOToJeff.td b/mlir/include/mlir/Conversion/QCOToJeff/QCOToJeff.td index 03dff36a4c..e31f5bc5a1 100644 --- a/mlir/include/mlir/Conversion/QCOToJeff/QCOToJeff.td +++ b/mlir/include/mlir/Conversion/QCOToJeff/QCOToJeff.td @@ -12,14 +12,17 @@ def QCOToJeff : Pass<"qco-to-jeff"> { let summary = "Convert QCO operations to Jeff operations"; let description = [{ - This pass converts all operations from the QCO dialect to their equivalent operations in the Jeff dialect. - It ensures that the returned module is a valid Jeff module that can be serialized. + This pass converts all operations from the QCO dialect to their equivalent operations in the Jeff dialect. + It ensures that the returned module is a valid Jeff module that can be serialized. - Note that this pass is still in development as QCO and Jeff do not have full feature parity yet. - }]; + Note that this pass is still in development as QCO and Jeff do not have full feature parity yet. + }]; let dependentDialects = [ - "mlir::jeff::JeffDialect", - "mlir::qco::QCODialect", + "mlir::arith::ArithDialect", + "mlir::math::MathDialect", + "mlir::tensor::TensorDialect", + "mlir::jeff::JeffDialect", + "mlir::qco::QCODialect", ]; } diff --git a/mlir/lib/Conversion/JeffToQCO/CMakeLists.txt b/mlir/lib/Conversion/JeffToQCO/CMakeLists.txt index 0f0b0380aa..7e239360fd 100644 --- a/mlir/lib/Conversion/JeffToQCO/CMakeLists.txt +++ b/mlir/lib/Conversion/JeffToQCO/CMakeLists.txt @@ -15,6 +15,7 @@ add_mlir_conversion_library( JeffToQCOIncGen LINK_LIBS MLIRJeff + MLIRJeffToNative MLIRQCODialect MLIRTransforms DISABLE_INSTALL) diff --git a/mlir/lib/Conversion/JeffToQCO/JeffToQCO.cpp b/mlir/lib/Conversion/JeffToQCO/JeffToQCO.cpp index 80c7f6ac2f..e0a02ff98d 100644 --- a/mlir/lib/Conversion/JeffToQCO/JeffToQCO.cpp +++ b/mlir/lib/Conversion/JeffToQCO/JeffToQCO.cpp @@ -13,6 +13,7 @@ #include "mlir/Dialect/QCO/IR/QCODialect.h" #include "mlir/Dialect/QCO/IR/QCOOps.h" +#include #include #include #include @@ -20,6 +21,8 @@ #include #include #include +#include +#include #include #include #include @@ -29,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -883,78 +887,6 @@ struct ConvertJeffMainToQCO final : OpConversionPattern { } }; -/** - * @brief Converts jeff.int_const1 to arith.constant - * - * @par Example: - * ```mlir - * %0 = jeff.int_const1(true) : i1 - * ``` - * is converted to - * ```mlir - * %0 = arith.constant true : i1 - * ``` - */ -struct ConvertJeffIntConst1OpToArith final - : OpConversionPattern { - using OpConversionPattern::OpConversionPattern; - - LogicalResult - matchAndRewrite(jeff::IntConst1Op op, OpAdaptor /*adaptor*/, - ConversionPatternRewriter& rewriter) const override { - rewriter.replaceOpWithNewOp(op, op.getValAttr()); - return success(); - } -}; - -/** - * @brief Converts jeff.int_const64 to arith.constant - * - * @par Example: - * ```mlir - * %0 = jeff.int_const64(3) : i64 - * ``` - * is converted to - * ```mlir - * %0 = arith.constant 3 : i64 - * ``` - */ -struct ConvertJeffIntConst64OpToArith final - : OpConversionPattern { - using OpConversionPattern::OpConversionPattern; - - LogicalResult - matchAndRewrite(jeff::IntConst64Op op, OpAdaptor /*adaptor*/, - ConversionPatternRewriter& rewriter) const override { - rewriter.replaceOpWithNewOp(op, op.getValAttr()); - return success(); - } -}; - -/** - * @brief Converts jeff.float_const64 to arith.constant - * - * @par Example: - * ```mlir - * %0 = jeff.float_const64(0.3) : f64 - * ``` - * is converted to - * ```mlir - * %0 = arith.constant 0.3 : f64 - * ``` - */ -struct ConvertJeffFloatConst64OpToArith final - : OpConversionPattern { - using OpConversionPattern::OpConversionPattern; - - LogicalResult - matchAndRewrite(jeff::FloatConst64Op op, OpAdaptor /*adaptor*/, - ConversionPatternRewriter& rewriter) const override { - rewriter.replaceOpWithNewOp(op, op.getValAttr()); - return success(); - } -}; - /** * @brief Type converter for Jeff-to-QCO conversion * @@ -984,6 +916,14 @@ struct JeffToQCO final : impl::JeffToQCOBase { MLIRContext* context = &getContext(); auto* module = getOperation(); + { + PassManager pm(context); + pm.addPass(createJeffToNative()); + if (pm.run(module).failed()) { + signalPassFailure(); + } + } + ConversionTarget target(*context); RewritePatternSet patterns(context); const JeffToQCOTypeConverter typeConverter(context); @@ -999,27 +939,24 @@ struct JeffToQCO final : impl::JeffToQCOBase { target.addLegalOp(); // Register operation conversion patterns - patterns - .add, - ConvertJeffOneTargetZeroParameterToQCO, - ConvertJeffOneTargetZeroParameterToQCO, - ConvertJeffOneTargetZeroParameterToQCO, - ConvertJeffOneTargetZeroParameterToQCO, - ConvertJeffOneTargetZeroParameterToQCO, - ConvertJeffOneTargetZeroParameterToQCO, - ConvertJeffOneTargetOneParameterToQCO, - ConvertJeffOneTargetOneParameterToQCO, - ConvertJeffOneTargetOneParameterToQCO, - ConvertJeffOneTargetOneParameterToQCO, - ConvertJeffUOpToQCO, ConvertJeffSwapOpToQCO, - ConvertJeffCustomOpToQCO, ConvertJeffPPROpToQCO, - ConvertJeffMainToQCO, ConvertJeffIntConst1OpToArith, - ConvertJeffIntConst64OpToArith, ConvertJeffFloatConst64OpToArith>( - typeConverter, context); + patterns.add< + ConvertJeffQubitAllocOpToQCO, ConvertJeffQubitFreeOpToQCO, + ConvertJeffQubitFreeZeroOpToQCO, ConvertJeffQubitMeasureOpToQCO, + ConvertJeffQubitMeasureNDOpToQCO, ConvertJeffQubitResetOpToQCO, + ConvertJeffGPhaseOpToQCO, + ConvertJeffOneTargetZeroParameterToQCO, + ConvertJeffOneTargetZeroParameterToQCO, + ConvertJeffOneTargetZeroParameterToQCO, + ConvertJeffOneTargetZeroParameterToQCO, + ConvertJeffOneTargetZeroParameterToQCO, + ConvertJeffOneTargetZeroParameterToQCO, + ConvertJeffOneTargetZeroParameterToQCO, + ConvertJeffOneTargetOneParameterToQCO, + ConvertJeffOneTargetOneParameterToQCO, + ConvertJeffOneTargetOneParameterToQCO, + ConvertJeffOneTargetOneParameterToQCO, + ConvertJeffUOpToQCO, ConvertJeffSwapOpToQCO, ConvertJeffCustomOpToQCO, + ConvertJeffPPROpToQCO, ConvertJeffMainToQCO>(typeConverter, context); // Apply the conversion if (applyPartialConversion(module, target, std::move(patterns)).failed()) { diff --git a/mlir/lib/Conversion/QCOToJeff/CMakeLists.txt b/mlir/lib/Conversion/QCOToJeff/CMakeLists.txt index 03c1b041d4..719c35fb00 100644 --- a/mlir/lib/Conversion/QCOToJeff/CMakeLists.txt +++ b/mlir/lib/Conversion/QCOToJeff/CMakeLists.txt @@ -16,6 +16,7 @@ add_mlir_conversion_library( LINK_LIBS MLIRDialect MLIRJeff + MLIRNativeToJeff MLIRQCODialect MLIRTransforms DISABLE_INSTALL) diff --git a/mlir/lib/Conversion/QCOToJeff/QCOToJeff.cpp b/mlir/lib/Conversion/QCOToJeff/QCOToJeff.cpp index 3541be7571..5237a616e3 100644 --- a/mlir/lib/Conversion/QCOToJeff/QCOToJeff.cpp +++ b/mlir/lib/Conversion/QCOToJeff/QCOToJeff.cpp @@ -13,6 +13,7 @@ #include "mlir/Dialect/QCO/IR/QCODialect.h" #include "mlir/Dialect/QCO/IR/QCOOps.h" +#include #include #include #include @@ -21,6 +22,8 @@ #include #include #include +#include +#include #include #include #include @@ -29,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -1312,63 +1316,6 @@ struct ConvertQCOMainToJeff final : StatefulOpConversionPattern { } }; -/** - * @brief Converts arith.constant to Jeff - * - * @par Example: - * ```mlir - * %0 = arith.constant 0 : i64 - * ``` - * is converted to - * ```mlir - * %0 = jeff.int_const64(0) : i64 - * ``` - */ -struct ConvertArithConstOpToJeff final - : StatefulOpConversionPattern { - using StatefulOpConversionPattern::StatefulOpConversionPattern; - - LogicalResult - matchAndRewrite(arith::ConstantOp op, OpAdaptor /*adaptor*/, - ConversionPatternRewriter& rewriter) const override { - auto value = op.getValue(); - return llvm::TypeSwitch(op.getType()) - .Case([&](auto type) -> LogicalResult { - auto floatAttr = llvm::dyn_cast(value); - if (!floatAttr) { - return rewriter.notifyMatchFailure(op, "Expected float attribute"); - } - switch (type.getWidth()) { - case 64: - rewriter.replaceOpWithNewOp(op, floatAttr); - return success(); - default: - return rewriter.notifyMatchFailure(op, "Unsupported type"); - } - }) - .Case([&](auto type) -> LogicalResult { - auto intAttr = llvm::dyn_cast(value); - if (!intAttr) { - return rewriter.notifyMatchFailure(op, - "Expected integer attribute"); - } - switch (type.getWidth()) { - case 1: - rewriter.replaceOpWithNewOp(op, intAttr); - return success(); - case 64: - rewriter.replaceOpWithNewOp(op, intAttr); - return success(); - default: - return rewriter.notifyMatchFailure(op, "Unsupported type"); - } - }) - .Default([&](auto) -> LogicalResult { - return rewriter.notifyMatchFailure(op, "Unsupported type"); - }); - } -}; - /** * @brief Type converter for QCO-to-Jeff conversion * @@ -1398,6 +1345,14 @@ struct QCOToJeff final : impl::QCOToJeffBase { MLIRContext* context = &getContext(); auto* module = getOperation(); + { + PassManager pm(context); + pm.addPass(createNativeToJeff()); + if (pm.run(module).failed()) { + signalPassFailure(); + } + } + ConversionTarget target(*context); RewritePatternSet patterns(context); QCOToJeffTypeConverter typeConverter(context); @@ -1439,8 +1394,7 @@ struct QCOToJeff final : impl::QCOToJeffBase { ConvertQCORZZOpToJeff, ConvertQCOXXMinusYYOpToJeff, ConvertQCOXXPlusYYOpToJeff, ConvertQCOBarrierOpToJeff, ConvertQCOCtrlOpToJeff, ConvertQCOInvOpToJeff, ConvertQCOYieldOpToJeff, - ConvertQCOMainToJeff, ConvertArithConstOpToJeff>(typeConverter, context, - &state); + ConvertQCOMainToJeff>(typeConverter, context, &state); // Apply the conversion if (applyPartialConversion(module, target, std::move(patterns)).failed()) { From 64636000fc1e248bee103809f75d6519aaadeeac Mon Sep 17 00:00:00 2001 From: Daniel Haag <121057143+denialhaag@users.noreply.github.com> Date: Mon, 16 Mar 2026 19:51:32 +0100 Subject: [PATCH 2/8] Use improved CMake target --- cmake/ExternalDependencies.cmake | 2 +- mlir/lib/Conversion/JeffToQCO/CMakeLists.txt | 3 --- mlir/lib/Conversion/QCOToJeff/CMakeLists.txt | 3 --- mlir/unittests/Conversion/JeffRoundTrip/CMakeLists.txt | 3 --- 4 files changed, 1 insertion(+), 10 deletions(-) diff --git a/cmake/ExternalDependencies.cmake b/cmake/ExternalDependencies.cmake index 451fedfffb..85e2816b47 100644 --- a/cmake/ExternalDependencies.cmake +++ b/cmake/ExternalDependencies.cmake @@ -41,7 +41,7 @@ if(BUILD_MQT_CORE_MLIR) FetchContent_Declare( jeff-mlir GIT_REPOSITORY https://github.com/PennyLaneAI/jeff-mlir.git - GIT_TAG 7b07a285dfd41aff13f612933995ff01a80c8817) + GIT_TAG e76be7dd40e6f1e5b1d74ce34b547816d1b67390) list(APPEND FETCH_PACKAGES jeff-mlir) endif() diff --git a/mlir/lib/Conversion/JeffToQCO/CMakeLists.txt b/mlir/lib/Conversion/JeffToQCO/CMakeLists.txt index 7e239360fd..43d5c4caf9 100644 --- a/mlir/lib/Conversion/JeffToQCO/CMakeLists.txt +++ b/mlir/lib/Conversion/JeffToQCO/CMakeLists.txt @@ -19,6 +19,3 @@ add_mlir_conversion_library( MLIRQCODialect MLIRTransforms DISABLE_INSTALL) - -target_include_directories(MLIRJeffToQCO PRIVATE ${jeff-mlir_SOURCE_DIR}/include - ${jeff-mlir_BINARY_DIR}/include) diff --git a/mlir/lib/Conversion/QCOToJeff/CMakeLists.txt b/mlir/lib/Conversion/QCOToJeff/CMakeLists.txt index 719c35fb00..269af18c2b 100644 --- a/mlir/lib/Conversion/QCOToJeff/CMakeLists.txt +++ b/mlir/lib/Conversion/QCOToJeff/CMakeLists.txt @@ -21,9 +21,6 @@ add_mlir_conversion_library( MLIRTransforms DISABLE_INSTALL) -target_include_directories(MLIRQCOToJeff PRIVATE ${jeff-mlir_SOURCE_DIR}/include - ${jeff-mlir_BINARY_DIR}/include) - if(TARGET MLIRQCOToJeff) target_compile_definitions(MLIRQCOToJeff PRIVATE MQT_CORE_VERSION="${MQT_CORE_VERSION}") endif() diff --git a/mlir/unittests/Conversion/JeffRoundTrip/CMakeLists.txt b/mlir/unittests/Conversion/JeffRoundTrip/CMakeLists.txt index d308854a9a..868d4e5656 100644 --- a/mlir/unittests/Conversion/JeffRoundTrip/CMakeLists.txt +++ b/mlir/unittests/Conversion/JeffRoundTrip/CMakeLists.txt @@ -22,9 +22,6 @@ target_link_libraries( MLIRJeffToQCO MLIRQCOToJeff) -target_include_directories(${target_name} PRIVATE ${jeff-mlir_SOURCE_DIR}/include - ${jeff-mlir_BINARY_DIR}/include) - mqt_mlir_configure_unittest_target(${target_name}) gtest_discover_tests(${target_name} PROPERTIES LABELS mqt-mlir-unittests DISCOVERY_TIMEOUT 60) From 2fae48607c4c876f1790e6fac417bae1c0dd615a Mon Sep 17 00:00:00 2001 From: Daniel Haag <121057143+denialhaag@users.noreply.github.com> Date: Mon, 16 Mar 2026 19:55:37 +0100 Subject: [PATCH 3/8] Fix linter errors --- mlir/include/mlir/Conversion/JeffToQCO/JeffToQCO.h | 3 +++ mlir/include/mlir/Conversion/QCOToJeff/QCOToJeff.h | 3 +++ mlir/lib/Conversion/JeffToQCO/JeffToQCO.cpp | 2 -- mlir/lib/Conversion/QCOToJeff/QCOToJeff.cpp | 4 ---- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mlir/include/mlir/Conversion/JeffToQCO/JeffToQCO.h b/mlir/include/mlir/Conversion/JeffToQCO/JeffToQCO.h index f2c41b31d9..14c945e2b5 100644 --- a/mlir/include/mlir/Conversion/JeffToQCO/JeffToQCO.h +++ b/mlir/include/mlir/Conversion/JeffToQCO/JeffToQCO.h @@ -10,6 +10,9 @@ #pragma once +#include +#include +#include #include namespace mlir { diff --git a/mlir/include/mlir/Conversion/QCOToJeff/QCOToJeff.h b/mlir/include/mlir/Conversion/QCOToJeff/QCOToJeff.h index b5fca4bd30..937a4f19cd 100644 --- a/mlir/include/mlir/Conversion/QCOToJeff/QCOToJeff.h +++ b/mlir/include/mlir/Conversion/QCOToJeff/QCOToJeff.h @@ -10,6 +10,9 @@ #pragma once +#include +#include +#include #include namespace mlir { diff --git a/mlir/lib/Conversion/JeffToQCO/JeffToQCO.cpp b/mlir/lib/Conversion/JeffToQCO/JeffToQCO.cpp index e0a02ff98d..02ebdbf81d 100644 --- a/mlir/lib/Conversion/JeffToQCO/JeffToQCO.cpp +++ b/mlir/lib/Conversion/JeffToQCO/JeffToQCO.cpp @@ -21,8 +21,6 @@ #include #include #include -#include -#include #include #include #include diff --git a/mlir/lib/Conversion/QCOToJeff/QCOToJeff.cpp b/mlir/lib/Conversion/QCOToJeff/QCOToJeff.cpp index 5237a616e3..3c07286e49 100644 --- a/mlir/lib/Conversion/QCOToJeff/QCOToJeff.cpp +++ b/mlir/lib/Conversion/QCOToJeff/QCOToJeff.cpp @@ -18,12 +18,8 @@ #include #include #include -#include #include -#include #include -#include -#include #include #include #include From 454c2d3c9bdb39e9a99a2075bd4f75e907603ddc Mon Sep 17 00:00:00 2001 From: Daniel Haag <121057143+denialhaag@users.noreply.github.com> Date: Mon, 16 Mar 2026 20:01:58 +0100 Subject: [PATCH 4/8] Update changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ed8c0f998..017bb6c6f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ This project adheres to [Semantic Versioning], with the exception that minor rel ### Added - ✨ Add Sampler and Estimator Primitives to the QDMI-Qiskit Interface ([#1507]) ([**@marcelwa**]) -- ✨ Add conversions between Jeff and QCO ([#1479], [#1548]) ([**@denialhaag**]) +- ✨ Add conversions between Jeff and QCO ([#1479], [#1548], [#1565]) ([**@denialhaag**]) - ✨ Add a `place-and-route` pass for mapping circuits to architectures with restricted topologies ([#1537], [#1547]) ([**@MatthiasReumann**]) - ✨ Add initial infrastructure for new QC and QCO MLIR dialects ([#1264], [#1330], [#1402], [#1428], [#1430], [#1436], [#1443], [#1446], [#1464], [#1465], [#1470], [#1471], [#1472], [#1474], [#1475], [#1506], [#1510], [#1513], [#1521], [#1548], [#1550], [#1554]) @@ -331,6 +331,7 @@ _📚 Refer to the [GitHub Release Notes](https://github.com/munich-quantum-tool +[#1565]: https://github.com/munich-quantum-toolkit/core/pull/1565 [#1554]: https://github.com/munich-quantum-toolkit/core/pull/1554 [#1550]: https://github.com/munich-quantum-toolkit/core/pull/1550 [#1549]: https://github.com/munich-quantum-toolkit/core/pull/1549 From 6641a97ece429c6f0ca3d0a3983e90343027c749 Mon Sep 17 00:00:00 2001 From: Daniel Haag <121057143+denialhaag@users.noreply.github.com> Date: Tue, 17 Mar 2026 11:13:12 +0100 Subject: [PATCH 5/8] Update to most recent version of jeff-mlir --- cmake/ExternalDependencies.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/ExternalDependencies.cmake b/cmake/ExternalDependencies.cmake index 85e2816b47..b984056e53 100644 --- a/cmake/ExternalDependencies.cmake +++ b/cmake/ExternalDependencies.cmake @@ -41,7 +41,7 @@ if(BUILD_MQT_CORE_MLIR) FetchContent_Declare( jeff-mlir GIT_REPOSITORY https://github.com/PennyLaneAI/jeff-mlir.git - GIT_TAG e76be7dd40e6f1e5b1d74ce34b547816d1b67390) + GIT_TAG 0a1eca9ecb71162429b7574043eb32493870bcc1) list(APPEND FETCH_PACKAGES jeff-mlir) endif() From f994deb29498fe87a3bbe34c72339071ff848fcc Mon Sep 17 00:00:00 2001 From: Daniel Haag <121057143+denialhaag@users.noreply.github.com> Date: Tue, 17 Mar 2026 11:17:20 +0100 Subject: [PATCH 6/8] Return early if native conversions fail --- mlir/lib/Conversion/JeffToQCO/JeffToQCO.cpp | 1 + mlir/lib/Conversion/QCOToJeff/QCOToJeff.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/mlir/lib/Conversion/JeffToQCO/JeffToQCO.cpp b/mlir/lib/Conversion/JeffToQCO/JeffToQCO.cpp index 02ebdbf81d..0f2cc15a91 100644 --- a/mlir/lib/Conversion/JeffToQCO/JeffToQCO.cpp +++ b/mlir/lib/Conversion/JeffToQCO/JeffToQCO.cpp @@ -919,6 +919,7 @@ struct JeffToQCO final : impl::JeffToQCOBase { pm.addPass(createJeffToNative()); if (pm.run(module).failed()) { signalPassFailure(); + return; } } diff --git a/mlir/lib/Conversion/QCOToJeff/QCOToJeff.cpp b/mlir/lib/Conversion/QCOToJeff/QCOToJeff.cpp index 3c07286e49..f9eb8904fa 100644 --- a/mlir/lib/Conversion/QCOToJeff/QCOToJeff.cpp +++ b/mlir/lib/Conversion/QCOToJeff/QCOToJeff.cpp @@ -1346,6 +1346,7 @@ struct QCOToJeff final : impl::QCOToJeffBase { pm.addPass(createNativeToJeff()); if (pm.run(module).failed()) { signalPassFailure(); + return; } } From 7545b71998c1d37f90a4b3a35b600b2b492abae8 Mon Sep 17 00:00:00 2001 From: Daniel Haag <121057143+denialhaag@users.noreply.github.com> Date: Wed, 18 Mar 2026 12:25:53 +0100 Subject: [PATCH 7/8] Use functions for populating conversion patterns --- cmake/ExternalDependencies.cmake | 2 +- .../mlir/Conversion/JeffToQCO/JeffToQCO.h | 3 --- .../mlir/Conversion/QCOToJeff/QCOToJeff.h | 3 --- mlir/lib/Conversion/JeffToQCO/JeffToQCO.cpp | 16 +++++----------- mlir/lib/Conversion/QCOToJeff/QCOToJeff.cpp | 17 ++++++----------- 5 files changed, 12 insertions(+), 29 deletions(-) diff --git a/cmake/ExternalDependencies.cmake b/cmake/ExternalDependencies.cmake index b984056e53..3debbd1e45 100644 --- a/cmake/ExternalDependencies.cmake +++ b/cmake/ExternalDependencies.cmake @@ -41,7 +41,7 @@ if(BUILD_MQT_CORE_MLIR) FetchContent_Declare( jeff-mlir GIT_REPOSITORY https://github.com/PennyLaneAI/jeff-mlir.git - GIT_TAG 0a1eca9ecb71162429b7574043eb32493870bcc1) + GIT_TAG 41d02b95ec509d586f4c9bd690b6f453a53918e6) list(APPEND FETCH_PACKAGES jeff-mlir) endif() diff --git a/mlir/include/mlir/Conversion/JeffToQCO/JeffToQCO.h b/mlir/include/mlir/Conversion/JeffToQCO/JeffToQCO.h index 14c945e2b5..f2c41b31d9 100644 --- a/mlir/include/mlir/Conversion/JeffToQCO/JeffToQCO.h +++ b/mlir/include/mlir/Conversion/JeffToQCO/JeffToQCO.h @@ -10,9 +10,6 @@ #pragma once -#include -#include -#include #include namespace mlir { diff --git a/mlir/include/mlir/Conversion/QCOToJeff/QCOToJeff.h b/mlir/include/mlir/Conversion/QCOToJeff/QCOToJeff.h index 937a4f19cd..b5fca4bd30 100644 --- a/mlir/include/mlir/Conversion/QCOToJeff/QCOToJeff.h +++ b/mlir/include/mlir/Conversion/QCOToJeff/QCOToJeff.h @@ -10,9 +10,6 @@ #pragma once -#include -#include -#include #include namespace mlir { diff --git a/mlir/lib/Conversion/JeffToQCO/JeffToQCO.cpp b/mlir/lib/Conversion/JeffToQCO/JeffToQCO.cpp index 0f2cc15a91..cd3f1a29d0 100644 --- a/mlir/lib/Conversion/JeffToQCO/JeffToQCO.cpp +++ b/mlir/lib/Conversion/JeffToQCO/JeffToQCO.cpp @@ -21,6 +21,8 @@ #include #include #include +#include +#include #include #include #include @@ -30,7 +32,6 @@ #include #include #include -#include #include #include #include @@ -914,22 +915,14 @@ struct JeffToQCO final : impl::JeffToQCOBase { MLIRContext* context = &getContext(); auto* module = getOperation(); - { - PassManager pm(context); - pm.addPass(createJeffToNative()); - if (pm.run(module).failed()) { - signalPassFailure(); - return; - } - } - ConversionTarget target(*context); RewritePatternSet patterns(context); const JeffToQCOTypeConverter typeConverter(context); // Configure conversion target target.addIllegalDialect(); - target.addLegalDialect(); + target.addLegalDialect(); target.addDynamicallyLegalOp([&](func::FuncOp op) { return !(op.getSymName() == getEntryPointName(module) && @@ -938,6 +931,7 @@ struct JeffToQCO final : impl::JeffToQCOBase { target.addLegalOp(); // Register operation conversion patterns + jeff::populateJeffToNativeConversionPatterns(patterns); patterns.add< ConvertJeffQubitAllocOpToQCO, ConvertJeffQubitFreeOpToQCO, ConvertJeffQubitFreeZeroOpToQCO, ConvertJeffQubitMeasureOpToQCO, diff --git a/mlir/lib/Conversion/QCOToJeff/QCOToJeff.cpp b/mlir/lib/Conversion/QCOToJeff/QCOToJeff.cpp index f9eb8904fa..8796e834df 100644 --- a/mlir/lib/Conversion/QCOToJeff/QCOToJeff.cpp +++ b/mlir/lib/Conversion/QCOToJeff/QCOToJeff.cpp @@ -19,7 +19,10 @@ #include #include #include +#include #include +#include +#include #include #include #include @@ -28,7 +31,6 @@ #include #include #include -#include #include #include #include @@ -1341,15 +1343,6 @@ struct QCOToJeff final : impl::QCOToJeffBase { MLIRContext* context = &getContext(); auto* module = getOperation(); - { - PassManager pm(context); - pm.addPass(createNativeToJeff()); - if (pm.run(module).failed()) { - signalPassFailure(); - return; - } - } - ConversionTarget target(*context); RewritePatternSet patterns(context); QCOToJeffTypeConverter typeConverter(context); @@ -1357,7 +1350,8 @@ struct QCOToJeff final : impl::QCOToJeffBase { LoweringState state; // Configure conversion target - target.addIllegalDialect(); + target.addIllegalDialect(); target.addLegalDialect(); target.addDynamicallyLegalOp( @@ -1365,6 +1359,7 @@ struct QCOToJeff final : impl::QCOToJeffBase { target.addLegalOp(); // Register operation conversion patterns + jeff::populateNativeToJeffConversionPatterns(patterns); patterns.add< ConvertQCOAllocOpToJeff, ConvertQCODeallocOpToJeff, ConvertQCOMeasureOpToJeff, ConvertQCOResetOpToJeff, From e32243e93f564fc75fb119b503a3d6748c55ffb9 Mon Sep 17 00:00:00 2001 From: Daniel Haag <121057143+denialhaag@users.noreply.github.com> Date: Wed, 18 Mar 2026 21:22:01 +0100 Subject: [PATCH 8/8] Update to stable version Co-authored-by: Lukas Burgholzer Signed-off-by: Daniel Haag <121057143+denialhaag@users.noreply.github.com> --- cmake/ExternalDependencies.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/ExternalDependencies.cmake b/cmake/ExternalDependencies.cmake index 3debbd1e45..d3b33cb291 100644 --- a/cmake/ExternalDependencies.cmake +++ b/cmake/ExternalDependencies.cmake @@ -41,7 +41,7 @@ if(BUILD_MQT_CORE_MLIR) FetchContent_Declare( jeff-mlir GIT_REPOSITORY https://github.com/PennyLaneAI/jeff-mlir.git - GIT_TAG 41d02b95ec509d586f4c9bd690b6f453a53918e6) + GIT_TAG c7e0d0340e470c9097a79a430b633b97dcd864e9) list(APPEND FETCH_PACKAGES jeff-mlir) endif()