Skip to content

Conversation

@burgholzer
Copy link
Member

Description

This PR removed the legacy MLIR code around the MQTRef and MQTOpt dialects from the main branch of MQT Core in anticipation of the v4 release.
The respective functionality still remains around in the stable v3.x branch.
Ongoing contributions targeting the old dialects should target the v3.x branch.
Any new contribution shall target the new dialects from here on out.
We will gradually port over the important bits and pieces from the old dialect infrastructure.

This PR also updates the RtD documentation to show the new dialects, which is something that we apparently missed or ignored when merging the dialect redesign PR.
Since we are using a modern version of MLIR now for generating the docs, some of the workarounds have been removed as well.

Checklist:

  • The pull request only contains commits that are focused and relevant to this change.
  • I have added appropriate tests that cover the new/changed functionality.
  • I have updated the documentation to reflect these changes.
  • I have added entries to the changelog for any noteworthy additions, changes, fixes, or removals.
  • I have added migration instructions to the upgrade guide (if needed).
  • The changes follow the project's style guidelines and introduce no new warnings.
  • The changes are fully tested and pass the CI checks.
  • I have reviewed my own code changes.

Signed-off-by: burgholzer <burgholzer@me.com>
Signed-off-by: burgholzer <burgholzer@me.com>
Signed-off-by: burgholzer <burgholzer@me.com>
@burgholzer burgholzer added this to the MLIR Support milestone Jan 8, 2026
@burgholzer burgholzer self-assigned this Jan 8, 2026
@burgholzer burgholzer added refactor Anything related to code refactoring major Major version update c++ Anything related to C++ code MLIR Anything related to MLIR labels Jan 8, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 8, 2026

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

💤 Files selected but had no reviewable changes (1)
  • noxfile.py

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

This PR removes the MQTOpt and MQTRef MLIR dialects entirely, along with all associated conversion passes, transpilation infrastructure, transformation passes, and test suites. Documentation is updated to reference QC and QCO dialects instead. MLIR version handling is removed from CMake setup, and test infrastructure for the removed dialects is eliminated.

Changes

Cohort / File(s) Summary
CMake & Build Configuration
cmake/SetupMLIR.cmake, mlir/CMakeLists.txt, mlir/include/mlir/Conversion/CMakeLists.txt, mlir/include/mlir/Dialect/CMakeLists.txt, mlir/lib/Conversion/CMakeLists.txt, mlir/lib/Dialect/CMakeLists.txt
Removed MLIR_VERSION_MAJOR version handling; removed test subdirectory inclusion; removed MQTOpt/MQTRef subdirectory additions and four conversion pass entries from build configuration
Documentation Updates
docs/mlir/index.md, docs/mlir/Conversions.md, docs/mlir/QC.md, docs/mlir/QCO.md, docs/mlir/MQTOpt.md, docs/mlir/MQTRef.md
Updated index to reference QC/QCO instead of MQTRef/MQTOpt, removed "Register Handling" section; replaced conversion references; created new QC.md and QCO.md; deleted MQTOpt.md and MQTRef.md
MQTOpt Dialect Removal (Headers)
mlir/include/mlir/Dialect/MQTOpt/*
Removed entire MQTOpt dialect definition, operations, interfaces, and traits; deleted dialect header, ops definition (*.td), interfaces, and related CMakeLists; eliminated CommonTraits.h/.td and StdOps.td.inc with standard unitary operation definitions
MQTOpt Dialect Removal (Implementation & Transforms)
mlir/lib/Dialect/MQTOpt/IR/MQTOptOps.cpp, mlir/lib/Dialect/MQTOpt/Transforms/*
Removed dialect initialization, type/operation registrations, and all transformation passes (GateElimination, SwapReconstruction, LiftMeasurements, QuantumSink, MergeRotationGates, ReuseQubits, MQTCoreRoundTrip) with their pattern implementations
MQTOpt Transpilation Infrastructure Removal
mlir/include/mlir/Dialect/MQTOpt/Transforms/Transpilation/*, mlir/lib/Dialect/MQTOpt/Transforms/Transpilation/*
Removed entire routing/placement/transpilation system: Architecture, Router (NaiveRouter, AStarHeuristicRouter), Layout/ThinLayout, Unit/LayeredUnit/SequentialUnit, Stack, Common utilities, and SC-specific passes (PlacementPass, NaiveRoutingPass, AStarRoutingPass, RoutingVerificationPass)
MQTRef Dialect Removal
mlir/include/mlir/Dialect/MQTRef/*, mlir/lib/Dialect/MQTRef/*
Removed MQTRef dialect definition, operations, interfaces, type definitions, and translation infrastructure (ImportQuantumComputation); deleted all related CMakeLists and implementation files
Conversion Pass Removal (Headers)
mlir/include/mlir/Conversion/MQTOptToMQTRef/*, mlir/include/mlir/Conversion/MQTRefToMQTOpt/*, mlir/include/mlir/Conversion/MQTRefToQIR/*, mlir/include/mlir/Conversion/QIRToMQTRef/*
Removed pass declarations, TableGen definitions, and CMakeLists for all four conversion paths connecting MQTOpt↔MQTRef and reference→QIR
Conversion Pass Removal (Implementation)
mlir/lib/Conversion/MQTOptToMQTRef/*, mlir/lib/Conversion/MQTRefToMQTOpt/*, mlir/lib/Conversion/MQTRefToQIR/*, mlir/lib/Conversion/QIRToMQTRef/*
Removed conversion pass implementations with type converters, operation patterns, and lowering logic; deleted CMakeLists files
Test Suite Removal
mlir/test/CMakeLists.txt, mlir/test/Conversion/*.mlir, mlir/test/Dialect/MQTOpt/*
Removed lit test configuration; deleted conversion test suites (mqtopt-to-mqtref, mqtref-to-mqtopt, mqtref-to-qir, qir-to-mqtref) and all MQTOpt dialect feature/transformation tests

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • 🗺️ MLIR Dialect Redesign #1264: Performs the same MLIR dialect redesign—removing MQTOpt/MQTRef entries and activating QC/QCO in matching Conversion and Dialect CMakeLists—directly aligned with this PR's structural changes.
  • ✨ Add WireIterator #1310: Adds mlir/include/mlir/Dialect/MQTOpt/IR/WireIterator.h and related functionality that this PR deletes entirely, creating a direct code-level conflict.
  • ✨ Add --arch option to MLIR Routing Pass #1279: Modifies the Architecture lookup API and routing pass options that this PR removes completely, affecting the same API surface area.

Suggested reviewers

  • ystade

🐰 A rabbit hops through the code today,
Old dialects swept far away,
QC and QCO take their place so bright,
Refactoring done with all its might!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title '🔥 Remove legacy MLIR code' clearly describes the main objective of removing legacy MLIR code and is concise, specific, and directly related to the changeset.
Description check ✅ Passed The PR description comprehensively covers the purpose (removing legacy MLIR code for v4 release), context (functionality remains in v3.x), direction for contributors, and additional changes (documentation updates and workaround removals). All checklist items are marked complete.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
docs/mlir/Conversions.md (1)

1-17: All referenced conversion documentation files are missing from the repository.

The file includes three conversion documentation files that do not exist:

  • Conversions/MLIRQCToQCO.md
  • Conversions/MLIRQCOToQC.md
  • Conversions/MLIRQCToQIR.md

The docs/mlir/Conversions/ directory itself is also missing. These include statements will fail during documentation build. Either add the missing conversion documentation files or remove/defer the include statements.

🤖 Fix all issues with AI agents
In @docs/mlir/QC.md:
- Around line 1-11: QC.md references missing include files
Dialects/MLIRQCDialect.md and Dialects/MLIRQCInterfaces.md which will break
builds; either create the missing Dialects/ directory and add those two markdown
files with the expected content (matching the include names) or remove/replace
the two ```{include} ...``` directives in docs/mlir/QC.md (the include lines for
Dialects/MLIRQCDialect.md and Dialects/MLIRQCInterfaces.md) so the document no
longer references non-existent files.

In @docs/mlir/QCO.md:
- Around line 1-11: The documentation includes refer to missing files
Dialects/MLIRQCODialect.md and Dialects/MLIRQCOInterfaces.md which will break
the build; either create those two Markdown files under docs/mlir/Dialects/ with
the expected content (module overview and interface docs) or update the include
directives in docs/mlir/QCO.md to point to the actual locations of
MLIRQCODialect.md and MLIRQCOInterfaces.md, preserving the :heading-offset: 1
option for the interfaces include and keeping the file-level tocdepth setting.
📜 Review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5f66420 and 75f3b6d.

📒 Files selected for processing (126)
  • cmake/SetupMLIR.cmake
  • docs/mlir/Conversions.md
  • docs/mlir/MQTOpt.md
  • docs/mlir/MQTRef.md
  • docs/mlir/QC.md
  • docs/mlir/QCO.md
  • docs/mlir/index.md
  • mlir/CMakeLists.txt
  • mlir/include/mlir/Conversion/CMakeLists.txt
  • mlir/include/mlir/Conversion/MQTOptToMQTRef/CMakeLists.txt
  • mlir/include/mlir/Conversion/MQTOptToMQTRef/MQTOptToMQTRef.h
  • mlir/include/mlir/Conversion/MQTOptToMQTRef/MQTOptToMQTRef.td
  • mlir/include/mlir/Conversion/MQTRefToMQTOpt/CMakeLists.txt
  • mlir/include/mlir/Conversion/MQTRefToMQTOpt/MQTRefToMQTOpt.h
  • mlir/include/mlir/Conversion/MQTRefToMQTOpt/MQTRefToMQTOpt.td
  • mlir/include/mlir/Conversion/MQTRefToQIR/CMakeLists.txt
  • mlir/include/mlir/Conversion/MQTRefToQIR/MQTRefToQIR.h
  • mlir/include/mlir/Conversion/MQTRefToQIR/MQTRefToQIR.td
  • mlir/include/mlir/Conversion/QIRToMQTRef/CMakeLists.txt
  • mlir/include/mlir/Conversion/QIRToMQTRef/QIRToMQTRef.h
  • mlir/include/mlir/Conversion/QIRToMQTRef/QIRToMQTRef.td
  • mlir/include/mlir/Dialect/CMakeLists.txt
  • mlir/include/mlir/Dialect/Common/IR/CommonTraits.h
  • mlir/include/mlir/Dialect/Common/IR/CommonTraits.td
  • mlir/include/mlir/Dialect/Common/IR/StdOps.td.inc
  • mlir/include/mlir/Dialect/MQTOpt/CMakeLists.txt
  • mlir/include/mlir/Dialect/MQTOpt/IR/CMakeLists.txt
  • mlir/include/mlir/Dialect/MQTOpt/IR/MQTOptDialect.h
  • mlir/include/mlir/Dialect/MQTOpt/IR/MQTOptInterfaces.td
  • mlir/include/mlir/Dialect/MQTOpt/IR/MQTOptOps.td
  • mlir/include/mlir/Dialect/MQTOpt/IR/WireIterator.h
  • mlir/include/mlir/Dialect/MQTOpt/Transforms/CMakeLists.txt
  • mlir/include/mlir/Dialect/MQTOpt/Transforms/LiftMeasurementsPasses.h
  • mlir/include/mlir/Dialect/MQTOpt/Transforms/Passes.h
  • mlir/include/mlir/Dialect/MQTOpt/Transforms/Passes.td
  • mlir/include/mlir/Dialect/MQTOpt/Transforms/Transpilation/Architecture.h
  • mlir/include/mlir/Dialect/MQTOpt/Transforms/Transpilation/Common.h
  • mlir/include/mlir/Dialect/MQTOpt/Transforms/Transpilation/LayeredUnit.h
  • mlir/include/mlir/Dialect/MQTOpt/Transforms/Transpilation/Layout.h
  • mlir/include/mlir/Dialect/MQTOpt/Transforms/Transpilation/Router.h
  • mlir/include/mlir/Dialect/MQTOpt/Transforms/Transpilation/SequentialUnit.h
  • mlir/include/mlir/Dialect/MQTOpt/Transforms/Transpilation/Stack.h
  • mlir/include/mlir/Dialect/MQTOpt/Transforms/Transpilation/Unit.h
  • mlir/include/mlir/Dialect/MQTRef/CMakeLists.txt
  • mlir/include/mlir/Dialect/MQTRef/IR/CMakeLists.txt
  • mlir/include/mlir/Dialect/MQTRef/IR/MQTRefDialect.h
  • mlir/include/mlir/Dialect/MQTRef/IR/MQTRefInterfaces.td
  • mlir/include/mlir/Dialect/MQTRef/IR/MQTRefOps.td
  • mlir/include/mlir/Dialect/MQTRef/Translation/ImportQuantumComputation.h
  • mlir/lib/Conversion/CMakeLists.txt
  • mlir/lib/Conversion/MQTOptToMQTRef/CMakeLists.txt
  • mlir/lib/Conversion/MQTOptToMQTRef/MQTOptToMQTRef.cpp
  • mlir/lib/Conversion/MQTRefToMQTOpt/CMakeLists.txt
  • mlir/lib/Conversion/MQTRefToMQTOpt/MQTRefToMQTOpt.cpp
  • mlir/lib/Conversion/MQTRefToQIR/CMakeLists.txt
  • mlir/lib/Conversion/MQTRefToQIR/MQTRefToQIR.cpp
  • mlir/lib/Conversion/QIRToMQTRef/CMakeLists.txt
  • mlir/lib/Conversion/QIRToMQTRef/QIRToMQTRef.cpp
  • mlir/lib/Dialect/CMakeLists.txt
  • mlir/lib/Dialect/MQTOpt/CMakeLists.txt
  • mlir/lib/Dialect/MQTOpt/IR/CMakeLists.txt
  • mlir/lib/Dialect/MQTOpt/IR/MQTOptOps.cpp
  • mlir/lib/Dialect/MQTOpt/Transforms/CMakeLists.txt
  • mlir/lib/Dialect/MQTOpt/Transforms/DeadGateEliminationPattern.cpp
  • mlir/lib/Dialect/MQTOpt/Transforms/FromQuantumComputationPattern.cpp
  • mlir/lib/Dialect/MQTOpt/Transforms/GateElimination.cpp
  • mlir/lib/Dialect/MQTOpt/Transforms/GateEliminationPattern.cpp
  • mlir/lib/Dialect/MQTOpt/Transforms/LiftMeasurementsAboveControlsPattern.cpp
  • mlir/lib/Dialect/MQTOpt/Transforms/LiftMeasurementsAboveGatesPatterns.cpp
  • mlir/lib/Dialect/MQTOpt/Transforms/LiftMeasurementsPass.cpp
  • mlir/lib/Dialect/MQTOpt/Transforms/MQTCoreRoundTrip.cpp
  • mlir/lib/Dialect/MQTOpt/Transforms/MergeRotationGates.cpp
  • mlir/lib/Dialect/MQTOpt/Transforms/MergeRotationGatesPattern.cpp
  • mlir/lib/Dialect/MQTOpt/Transforms/QuantumSinkPass.cpp
  • mlir/lib/Dialect/MQTOpt/Transforms/QuantumSinkPushPattern.cpp
  • mlir/lib/Dialect/MQTOpt/Transforms/QuantumSinkShiftPattern.cpp
  • mlir/lib/Dialect/MQTOpt/Transforms/ReplaceBasisStateControlsWithIfPattern.cpp
  • mlir/lib/Dialect/MQTOpt/Transforms/ReuseQubitsPass.cpp
  • mlir/lib/Dialect/MQTOpt/Transforms/ReuseQubitsPattern.cpp
  • mlir/lib/Dialect/MQTOpt/Transforms/SwapReconstructionAndElision.cpp
  • mlir/lib/Dialect/MQTOpt/Transforms/SwapReconstructionAndElisionPattern.cpp
  • mlir/lib/Dialect/MQTOpt/Transforms/ToQuantumComputationPattern.cpp
  • mlir/lib/Dialect/MQTOpt/Transforms/Transpilation/Architecture.cpp
  • mlir/lib/Dialect/MQTOpt/Transforms/Transpilation/Common.cpp
  • mlir/lib/Dialect/MQTOpt/Transforms/Transpilation/LayeredUnit.cpp
  • mlir/lib/Dialect/MQTOpt/Transforms/Transpilation/SequentialUnit.cpp
  • mlir/lib/Dialect/MQTOpt/Transforms/Transpilation/sc/AStarRoutingPass.cpp
  • mlir/lib/Dialect/MQTOpt/Transforms/Transpilation/sc/NaiveRoutingPass.cpp
  • mlir/lib/Dialect/MQTOpt/Transforms/Transpilation/sc/PlacementPass.cpp
  • mlir/lib/Dialect/MQTOpt/Transforms/Transpilation/sc/RoutingVerificationPass.cpp
  • mlir/lib/Dialect/MQTRef/CMakeLists.txt
  • mlir/lib/Dialect/MQTRef/IR/CMakeLists.txt
  • mlir/lib/Dialect/MQTRef/IR/MQTRefOps.cpp
  • mlir/lib/Dialect/MQTRef/Translation/CMakeLists.txt
  • mlir/lib/Dialect/MQTRef/Translation/ImportQuantumComputation.cpp
  • mlir/test/CMakeLists.txt
  • mlir/test/Conversion/mqtopt-to-mqtref.mlir
  • mlir/test/Conversion/mqtref-to-mqtopt.mlir
  • mlir/test/Conversion/mqtref-to-qir.mlir
  • mlir/test/Conversion/qir-to-mqtref.mlir
  • mlir/test/Dialect/MQTOpt/IR/dialect_features.mlir
  • mlir/test/Dialect/MQTOpt/Transforms/Transpilation/basics.mlir
  • mlir/test/Dialect/MQTOpt/Transforms/Transpilation/grover_5.mlir
  • mlir/test/Dialect/MQTOpt/Transforms/Transpilation/invalid-arch-option.mlir
  • mlir/test/Dialect/MQTOpt/Transforms/Transpilation/missing-arch-option.mlir
  • mlir/test/Dialect/MQTOpt/Transforms/Transpilation/routing-placement.mlir
  • mlir/test/Dialect/MQTOpt/Transforms/Transpilation/routing-verification.mlir
  • mlir/test/Dialect/MQTOpt/Transforms/branch-opt.mlir
  • mlir/test/Dialect/MQTOpt/Transforms/gate-elimination.mlir
  • mlir/test/Dialect/MQTOpt/Transforms/lift-measurements.mlir
  • mlir/test/Dialect/MQTOpt/Transforms/merge-rotation-gates.mlir
  • mlir/test/Dialect/MQTOpt/Transforms/reuse-qubits-with-measurement-lifting.mlir
  • mlir/test/Dialect/MQTOpt/Transforms/reuse-qubits.mlir
  • mlir/test/Dialect/MQTOpt/Transforms/swap-reconstruction-and-elision.mlir
  • mlir/test/Dialect/MQTOpt/Transforms/to-quantum-computation.mlir
  • mlir/test/Dialect/MQTRef/IR/dialect_features.mlir
  • mlir/test/lit.cfg.py
  • mlir/test/lit.site.cfg.py.in
  • mlir/tools/CMakeLists.txt
  • mlir/tools/quantum-opt/CMakeLists.txt
  • mlir/tools/quantum-opt/quantum-opt.cpp
  • mlir/unittests/CMakeLists.txt
  • mlir/unittests/dialect/CMakeLists.txt
  • mlir/unittests/dialect/test_wireiterator.cpp
  • mlir/unittests/translation/CMakeLists.txt
  • mlir/unittests/translation/test_translation.cpp
💤 Files with no reviewable changes (107)
  • mlir/include/mlir/Dialect/MQTRef/IR/MQTRefInterfaces.td
  • mlir/include/mlir/Conversion/QIRToMQTRef/CMakeLists.txt
  • mlir/lib/Dialect/MQTRef/CMakeLists.txt
  • mlir/lib/Dialect/MQTOpt/CMakeLists.txt
  • mlir/lib/Conversion/CMakeLists.txt
  • mlir/include/mlir/Conversion/CMakeLists.txt
  • mlir/include/mlir/Conversion/MQTRefToMQTOpt/MQTRefToMQTOpt.td
  • mlir/include/mlir/Dialect/MQTOpt/Transforms/Transpilation/Unit.h
  • mlir/include/mlir/Conversion/MQTOptToMQTRef/MQTOptToMQTRef.h
  • mlir/include/mlir/Dialect/MQTRef/Translation/ImportQuantumComputation.h
  • mlir/test/Dialect/MQTOpt/Transforms/Transpilation/grover_5.mlir
  • mlir/test/Dialect/MQTOpt/Transforms/Transpilation/missing-arch-option.mlir
  • docs/mlir/MQTOpt.md
  • mlir/include/mlir/Conversion/MQTRefToQIR/MQTRefToQIR.td
  • mlir/include/mlir/Conversion/QIRToMQTRef/QIRToMQTRef.td
  • mlir/include/mlir/Conversion/MQTOptToMQTRef/MQTOptToMQTRef.td
  • mlir/include/mlir/Dialect/MQTOpt/IR/CMakeLists.txt
  • mlir/lib/Conversion/MQTRefToMQTOpt/CMakeLists.txt
  • mlir/test/Dialect/MQTOpt/IR/dialect_features.mlir
  • mlir/lib/Dialect/MQTOpt/Transforms/ReplaceBasisStateControlsWithIfPattern.cpp
  • mlir/include/mlir/Conversion/MQTRefToQIR/MQTRefToQIR.h
  • mlir/include/mlir/Dialect/MQTRef/IR/CMakeLists.txt
  • mlir/lib/Dialect/MQTOpt/Transforms/GateElimination.cpp
  • mlir/lib/Dialect/MQTOpt/Transforms/LiftMeasurementsPass.cpp
  • mlir/lib/Dialect/MQTOpt/IR/CMakeLists.txt
  • mlir/include/mlir/Conversion/MQTRefToQIR/CMakeLists.txt
  • mlir/include/mlir/Dialect/MQTOpt/IR/MQTOptInterfaces.td
  • mlir/lib/Dialect/MQTOpt/Transforms/DeadGateEliminationPattern.cpp
  • mlir/lib/Dialect/MQTRef/IR/CMakeLists.txt
  • mlir/include/mlir/Conversion/QIRToMQTRef/QIRToMQTRef.h
  • mlir/include/mlir/Conversion/MQTOptToMQTRef/CMakeLists.txt
  • mlir/lib/Dialect/MQTRef/Translation/CMakeLists.txt
  • mlir/lib/Dialect/MQTOpt/Transforms/ReuseQubitsPass.cpp
  • mlir/lib/Conversion/MQTRefToQIR/CMakeLists.txt
  • mlir/lib/Dialect/MQTOpt/Transforms/Transpilation/sc/AStarRoutingPass.cpp
  • mlir/lib/Conversion/MQTOptToMQTRef/CMakeLists.txt
  • mlir/test/Conversion/mqtref-to-qir.mlir
  • mlir/lib/Dialect/MQTOpt/Transforms/Transpilation/Common.cpp
  • mlir/include/mlir/Dialect/MQTOpt/Transforms/LiftMeasurementsPasses.h
  • mlir/lib/Dialect/MQTOpt/Transforms/MergeRotationGatesPattern.cpp
  • mlir/lib/Dialect/MQTOpt/Transforms/MergeRotationGates.cpp
  • mlir/test/Dialect/MQTOpt/Transforms/Transpilation/routing-placement.mlir
  • mlir/include/mlir/Dialect/Common/IR/CommonTraits.td
  • mlir/lib/Dialect/MQTOpt/Transforms/Transpilation/sc/RoutingVerificationPass.cpp
  • mlir/test/CMakeLists.txt
  • mlir/include/mlir/Dialect/MQTRef/CMakeLists.txt
  • mlir/lib/Dialect/MQTOpt/Transforms/GateEliminationPattern.cpp
  • mlir/include/mlir/Conversion/MQTRefToMQTOpt/MQTRefToMQTOpt.h
  • mlir/lib/Dialect/MQTOpt/Transforms/SwapReconstructionAndElisionPattern.cpp
  • mlir/test/Dialect/MQTOpt/Transforms/lift-measurements.mlir
  • mlir/test/Dialect/MQTOpt/Transforms/Transpilation/invalid-arch-option.mlir
  • mlir/test/Conversion/qir-to-mqtref.mlir
  • mlir/include/mlir/Dialect/Common/IR/CommonTraits.h
  • mlir/lib/Dialect/MQTOpt/Transforms/LiftMeasurementsAboveGatesPatterns.cpp
  • mlir/lib/Dialect/MQTOpt/Transforms/ToQuantumComputationPattern.cpp
  • mlir/CMakeLists.txt
  • mlir/include/mlir/Dialect/MQTOpt/CMakeLists.txt
  • mlir/test/Dialect/MQTOpt/Transforms/merge-rotation-gates.mlir
  • mlir/include/mlir/Dialect/MQTRef/IR/MQTRefDialect.h
  • mlir/test/Dialect/MQTOpt/Transforms/gate-elimination.mlir
  • mlir/test/Conversion/mqtopt-to-mqtref.mlir
  • mlir/include/mlir/Dialect/MQTOpt/Transforms/Transpilation/LayeredUnit.h
  • docs/mlir/MQTRef.md
  • mlir/include/mlir/Dialect/MQTRef/IR/MQTRefOps.td
  • mlir/lib/Dialect/MQTOpt/Transforms/QuantumSinkPass.cpp
  • mlir/test/Dialect/MQTOpt/Transforms/Transpilation/routing-verification.mlir
  • mlir/lib/Dialect/MQTOpt/Transforms/MQTCoreRoundTrip.cpp
  • mlir/include/mlir/Dialect/CMakeLists.txt
  • mlir/test/Dialect/MQTOpt/Transforms/branch-opt.mlir
  • mlir/include/mlir/Dialect/MQTOpt/Transforms/Transpilation/Common.h
  • mlir/lib/Dialect/MQTOpt/Transforms/LiftMeasurementsAboveControlsPattern.cpp
  • mlir/lib/Dialect/CMakeLists.txt
  • mlir/include/mlir/Dialect/MQTOpt/IR/WireIterator.h
  • mlir/include/mlir/Dialect/MQTOpt/IR/MQTOptDialect.h
  • mlir/include/mlir/Dialect/MQTOpt/Transforms/Transpilation/SequentialUnit.h
  • mlir/test/Dialect/MQTOpt/Transforms/Transpilation/basics.mlir
  • mlir/lib/Conversion/QIRToMQTRef/CMakeLists.txt
  • mlir/include/mlir/Conversion/MQTRefToMQTOpt/CMakeLists.txt
  • cmake/SetupMLIR.cmake
  • mlir/test/Conversion/mqtref-to-mqtopt.mlir
  • mlir/lib/Dialect/MQTOpt/Transforms/QuantumSinkShiftPattern.cpp
  • mlir/lib/Dialect/MQTOpt/Transforms/SwapReconstructionAndElision.cpp
  • mlir/lib/Dialect/MQTOpt/Transforms/CMakeLists.txt
  • mlir/include/mlir/Dialect/MQTOpt/Transforms/CMakeLists.txt
  • mlir/lib/Conversion/MQTOptToMQTRef/MQTOptToMQTRef.cpp
  • mlir/include/mlir/Dialect/MQTOpt/Transforms/Passes.h
  • mlir/lib/Dialect/MQTOpt/Transforms/Transpilation/LayeredUnit.cpp
  • mlir/lib/Dialect/MQTOpt/Transforms/Transpilation/sc/NaiveRoutingPass.cpp
  • mlir/lib/Dialect/MQTOpt/Transforms/Transpilation/SequentialUnit.cpp
  • mlir/lib/Dialect/MQTRef/Translation/ImportQuantumComputation.cpp
  • mlir/lib/Conversion/MQTRefToMQTOpt/MQTRefToMQTOpt.cpp
  • mlir/include/mlir/Dialect/MQTOpt/Transforms/Transpilation/Architecture.h
  • mlir/lib/Conversion/MQTRefToQIR/MQTRefToQIR.cpp
  • mlir/include/mlir/Dialect/MQTOpt/Transforms/Transpilation/Stack.h
  • mlir/lib/Conversion/QIRToMQTRef/QIRToMQTRef.cpp
  • mlir/include/mlir/Dialect/MQTOpt/Transforms/Transpilation/Router.h
  • mlir/include/mlir/Dialect/MQTOpt/IR/MQTOptOps.td
  • mlir/lib/Dialect/MQTOpt/Transforms/FromQuantumComputationPattern.cpp
  • mlir/include/mlir/Dialect/MQTOpt/Transforms/Passes.td
  • mlir/lib/Dialect/MQTRef/IR/MQTRefOps.cpp
  • mlir/include/mlir/Dialect/Common/IR/StdOps.td.inc
  • mlir/lib/Dialect/MQTOpt/Transforms/QuantumSinkPushPattern.cpp
  • mlir/lib/Dialect/MQTOpt/IR/MQTOptOps.cpp
  • mlir/lib/Dialect/MQTOpt/Transforms/ReuseQubitsPattern.cpp
  • mlir/lib/Dialect/MQTOpt/Transforms/Transpilation/Architecture.cpp
  • mlir/lib/Dialect/MQTOpt/Transforms/Transpilation/sc/PlacementPass.cpp
  • mlir/include/mlir/Dialect/MQTOpt/Transforms/Transpilation/Layout.h
🧰 Additional context used
🧠 Learnings (12)
📓 Common learnings
Learnt from: denialhaag
Repo: munich-quantum-toolkit/core PR: 1360
File: .github/workflows/reusable-mlir-tests.yml:40-43
Timestamp: 2025-12-05T17:45:37.602Z
Learning: In the munich-quantum-toolkit/core repository, patch releases of LLVM dependencies don't require documentation updates, changelog entries, or additional tests beyond what's validated by passing CI checks.
Learnt from: DRovara
Repo: munich-quantum-toolkit/core PR: 1108
File: mlir/lib/Dialect/MQTOpt/Transforms/DeadGateEliminationPattern.cpp:42-45
Timestamp: 2025-10-09T13:28:29.237Z
Learning: In the MQTOpt MLIR dialect, linear types enforce single-use semantics where each qubit value can only be consumed once, preventing duplicate deallocations and making RAUW operations safe when replacing output qubits with corresponding input qubits in transformation patterns.
Learnt from: MatthiasReumann
Repo: munich-quantum-toolkit/core PR: 1301
File: mlir/lib/Dialect/MQTOpt/Transforms/Transpilation/LayeredUnit.cpp:84-85
Timestamp: 2025-12-04T06:59:40.314Z
Learning: In the MQTOpt MLIR routing passes (NaiveRoutingPassSC, AStarRoutingPassSC), the input IR is guaranteed to contain only 1-qubit and 2-qubit gates. All 3+-qubit gates must be decomposed before routing; otherwise the input IR is invalid. This invariant allows skipTwoQubitBlock in LayeredUnit.cpp to safely assert wires.size() == 2.
Learnt from: burgholzer
Repo: munich-quantum-toolkit/core PR: 1356
File: cmake/SetupMLIR.cmake:32-33
Timestamp: 2026-01-04T21:41:30.252Z
Learning: In the munich-quantum-toolkit/core repository, the project provides its own pre-built LLVM/MLIR distributions that are compiled with LLVM_ENABLE_RTTI=ON and LLVM_ENABLE_EH=ON. Users are directed to these distributions via the upgrade guide and installation instructions to avoid ABI compatibility issues. The mid-term goal is to eliminate RTTI and exception handling dependencies entirely.
Learnt from: li-mingbao
Repo: munich-quantum-toolkit/core PR: 1396
File: mlir/lib/Conversion/QCOToQC/QCOToQC.cpp:1040-1050
Timestamp: 2026-01-07T12:29:02.062Z
Learning: In the QCOToQC conversion pass (mlir/lib/Conversion/QCOToQC/QCOToQC.cpp), ConvertQCOFuncCallOp assumes that if a func::CallOp has qubit results, then all arguments and results are qubits (no mixed classical/quantum types). The conversion is scoped to handle all-qubit function calls only.
Learnt from: DRovara
Repo: munich-quantum-toolkit/core PR: 1108
File: mlir/test/Dialect/MQTOpt/Transforms/lift-measurements.mlir:269-288
Timestamp: 2025-10-09T13:20:11.483Z
Learning: In the MQT MLIR dialect, the `rz` gate should not be included in the `DIAGONAL_GATES` set for the `ReplaceBasisStateControlsWithIfPattern` because its operator matrix does not have the required shape | 1 0 | / | 0 x | for the targets-as-controls optimization. It is only included in `LiftMeasurementsAboveGatesPatterns` where the matrix structure requirement differs.
Learnt from: denialhaag
Repo: munich-quantum-toolkit/core PR: 1264
File: mlir/include/mlir/Dialect/QCO/IR/QCOOps.td:259-259
Timestamp: 2025-12-17T17:44:31.349Z
Learning: In the QCO dialect (mlir/include/mlir/Dialect/QCO/IR/QCOOps.td), GPhaseOp intentionally uses `MemoryEffects<[MemWrite]>` instead of `Pure` to prevent the remove-dead-values pass from eliminating it. Since GPhaseOp is a zero-target operation with no result values, it would otherwise be removed by DCE, even though it has a meaningful effect on the global quantum state.
Learnt from: li-mingbao
Repo: munich-quantum-toolkit/core PR: 1396
File: mlir/lib/Conversion/QCOToQC/QCOToQC.cpp:1070-1085
Timestamp: 2026-01-07T12:29:16.380Z
Learning: In the QCOToQC conversion pass (mlir/lib/Conversion/QCOToQC/QCOToQC.cpp), the ConvertQCOFuncFuncOp pattern assumes that when a func.func operation is matched for conversion, all of its arguments are qco.qubit types (never mixed qubit/classical). The pattern unconditionally converts all arguments to qc::QubitType based on this assumption.
📚 Learning: 2025-12-05T17:45:37.602Z
Learnt from: denialhaag
Repo: munich-quantum-toolkit/core PR: 1360
File: .github/workflows/reusable-mlir-tests.yml:40-43
Timestamp: 2025-12-05T17:45:37.602Z
Learning: In the munich-quantum-toolkit/core repository, patch releases of LLVM dependencies don't require documentation updates, changelog entries, or additional tests beyond what's validated by passing CI checks.

Applied to files:

  • docs/mlir/QC.md
  • docs/mlir/index.md
  • docs/mlir/QCO.md
📚 Learning: 2026-01-07T12:29:02.062Z
Learnt from: li-mingbao
Repo: munich-quantum-toolkit/core PR: 1396
File: mlir/lib/Conversion/QCOToQC/QCOToQC.cpp:1040-1050
Timestamp: 2026-01-07T12:29:02.062Z
Learning: In the QCOToQC conversion pass (mlir/lib/Conversion/QCOToQC/QCOToQC.cpp), ConvertQCOFuncCallOp assumes that if a func::CallOp has qubit results, then all arguments and results are qubits (no mixed classical/quantum types). The conversion is scoped to handle all-qubit function calls only.

Applied to files:

  • docs/mlir/Conversions.md
  • docs/mlir/index.md
📚 Learning: 2026-01-07T12:29:16.380Z
Learnt from: li-mingbao
Repo: munich-quantum-toolkit/core PR: 1396
File: mlir/lib/Conversion/QCOToQC/QCOToQC.cpp:1070-1085
Timestamp: 2026-01-07T12:29:16.380Z
Learning: In the QCOToQC conversion pass (mlir/lib/Conversion/QCOToQC/QCOToQC.cpp), the ConvertQCOFuncFuncOp pattern assumes that when a func.func operation is matched for conversion, all of its arguments are qco.qubit types (never mixed qubit/classical). The pattern unconditionally converts all arguments to qc::QubitType based on this assumption.

Applied to files:

  • docs/mlir/Conversions.md
📚 Learning: 2025-12-08T23:44:44.157Z
Learnt from: burgholzer
Repo: munich-quantum-toolkit/core PR: 1264
File: mlir/lib/Dialect/Quartz/IR/Operations/StandardGates/PhaseOp.cpp:0-0
Timestamp: 2025-12-08T23:44:44.157Z
Learning: In MLIR code (mlir/ directories), avoid using const qualifiers on core MLIR data types like Value, Type, Attribute, Operation*, Block*, Region*, etc. in function parameters and signatures. MLIR's design rationale explicitly discourages const for these types. See https://mlir.llvm.org/docs/Rationale/UsageOfConst/ for details.

Applied to files:

  • docs/mlir/Conversions.md
📚 Learning: 2026-01-04T21:41:30.252Z
Learnt from: burgholzer
Repo: munich-quantum-toolkit/core PR: 1356
File: cmake/SetupMLIR.cmake:32-33
Timestamp: 2026-01-04T21:41:30.252Z
Learning: In the munich-quantum-toolkit/core repository, the project provides its own pre-built LLVM/MLIR distributions that are compiled with LLVM_ENABLE_RTTI=ON and LLVM_ENABLE_EH=ON. Users are directed to these distributions via the upgrade guide and installation instructions to avoid ABI compatibility issues. The mid-term goal is to eliminate RTTI and exception handling dependencies entirely.

Applied to files:

  • docs/mlir/Conversions.md
  • docs/mlir/index.md
📚 Learning: 2025-10-09T13:28:29.237Z
Learnt from: DRovara
Repo: munich-quantum-toolkit/core PR: 1108
File: mlir/lib/Dialect/MQTOpt/Transforms/DeadGateEliminationPattern.cpp:42-45
Timestamp: 2025-10-09T13:28:29.237Z
Learning: In the MQTOpt MLIR dialect, linear types enforce single-use semantics where each qubit value can only be consumed once, preventing duplicate deallocations and making RAUW operations safe when replacing output qubits with corresponding input qubits in transformation patterns.

Applied to files:

  • docs/mlir/index.md
📚 Learning: 2025-12-14T16:51:52.504Z
Learnt from: burgholzer
Repo: munich-quantum-toolkit/core-plugins-catalyst PR: 23
File: .readthedocs.yaml:13-18
Timestamp: 2025-12-14T16:51:52.504Z
Learning: In the munich-quantum-toolkit/core-plugins-catalyst repository, LLVM and MLIR toolchains are required for the documentation build because `uv run` includes a full build of the package, which compiles C++/MLIR extensions using scikit-build-core.

Applied to files:

  • docs/mlir/index.md
📚 Learning: 2025-12-08T23:41:55.972Z
Learnt from: burgholzer
Repo: munich-quantum-toolkit/core PR: 1264
File: mlir/lib/Dialect/QIR/Builder/QIRProgramBuilder.cpp:96-117
Timestamp: 2025-12-08T23:41:55.972Z
Learning: In the QIR (Quantum Intermediate Representation) Builder (mlir/lib/Dialect/QIR/Builder/QIRProgramBuilder.cpp), the `ptrCache` is intentionally shared between qubit and result pointer creation (in `staticQubit()` and `measure()` methods) because QIR uses opaque pointers and `inttoptr` conversions for both qubits and results. For any given index N, the LLVM IR pointer representation is identical whether it represents a qubit or a result, so the pointer only needs to be created once and can be safely reused across both contexts.

Applied to files:

  • docs/mlir/index.md
📚 Learning: 2025-10-09T13:14:10.178Z
Learnt from: DRovara
Repo: munich-quantum-toolkit/core PR: 1108
File: mlir/lib/Dialect/MQTOpt/Transforms/ReplaceBasisStateControlsWithIfPattern.cpp:219-221
Timestamp: 2025-10-09T13:14:10.178Z
Learning: The MQT Core project (munich-quantum-toolkit/core repository) uses the C++20 standard, not C++17. C++20 features such as abbreviated function templates (e.g., `const auto&` parameters) are supported and valid in this codebase.

Applied to files:

  • docs/mlir/index.md
📚 Learning: 2025-12-09T00:55:11.926Z
Learnt from: denialhaag
Repo: munich-quantum-toolkit/core PR: 1264
File: mlir/lib/Dialect/Flux/IR/Operations/StandardGates/BarrierOp.cpp:45-54
Timestamp: 2025-12-09T00:55:11.926Z
Learning: In the Flux dialect (mlir/lib/Dialect/Flux), qubits follow single-user/linear-type semantics where each qubit value can only be consumed once, similar to MQTOpt. This invariant makes it safe to dereference getUsers().begin() in canonicalization patterns like MergeSubsequentBarrier in BarrierOp.cpp, as there will be at most one user per qubit output.

Applied to files:

  • docs/mlir/index.md
📚 Learning: 2025-10-09T13:13:51.224Z
Learnt from: DRovara
Repo: munich-quantum-toolkit/core PR: 1108
File: mlir/lib/Dialect/MQTOpt/Transforms/ReplaceBasisStateControlsWithIfPattern.cpp:171-180
Timestamp: 2025-10-09T13:13:51.224Z
Learning: In MQT Core MLIR, UnitaryInterface operations guarantee 1-1 correspondence between input and output qubits in the same order. When cloning or modifying unitary operations (e.g., removing controls), this correspondence is maintained by construction, so yielding getAllInQubits() in else-branches matches the result types from the operation's outputs.

Applied to files:

  • docs/mlir/index.md
🔇 Additional comments (3)
docs/mlir/index.md (3)

7-14: Documentation update correctly reflects dialect renaming.

The changes appropriately update references from the legacy MQTRef and MQTOpt dialects to the new QC and QCO dialects. The descriptions are accurate: QC uses reference semantics for compatibility, QCO uses value semantics for optimizations, and the conversion documentation reflects the new dialect relationships (QC↔QCO and QC→QIR).


24-28: Work-in-progress note is appropriately placed.

The addition of the note indicating this page is a work in progress is fitting given the significant documentation restructuring from the legacy dialect removal.


7-14: Documentation cross-references are correctly configured and all referenced files exist.

The Sphinx {doc} cross-references to QC, QCO, and Conversions are valid. The toctree entries in lines 19-21 match the documentation filenames, and all referenced files contain substantive content.

@codecov
Copy link

codecov bot commented Jan 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Signed-off-by: burgholzer <burgholzer@me.com>
@burgholzer burgholzer merged commit 3dd3d2b into main Jan 9, 2026
31 of 33 checks passed
@burgholzer burgholzer deleted the remove-old-mlir-code branch January 9, 2026 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Anything related to C++ code major Major version update MLIR Anything related to MLIR refactor Anything related to code refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants