✨ Add MQT Core compilation and QIR export - #1027
Draft
simon1hofmann wants to merge 4 commits into
Draft
Conversation
Assisted-by: GPT-6 via Codex
Assisted-by: GPT-6 via Codex
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Assisted-by: GPT-6 via Codex
Include the MQT Core coverage report in the combined CI upload. Assisted-by: GPT-6 via Codex
This was referenced Sep 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 AI text below 🤖
Description
MQT Bench currently sends all compilation requests through Qiskit. This adds an optional MQT Core compiler selected with
compiler="mqt"in Python or--compiler mqtin the CLI. Qiskit remains the default compiler, and both paths returnQuantumCircuitobjects.The change adds Core compilation at the independent, native-gate, and mapped levels, QIR export as LLVM text or bitcode, compiler provenance in exports, mirror support, an optional dependency extra, and a dedicated CI test session. The CLI also defaults to optimization level 2 when that option is omitted.
Usage
From a checkout of this PR:
python -m pip install -e ".[mqt]"The level-specific functions
get_benchmark_indep,get_benchmark_native_gates, andget_benchmark_mappedaccept the same compiler option. The algorithm level does not compile.The Core CLI filename contains
_mqt_and omits Qiskit's optimization level. QASM headers and QPY metadata record the compiler version. Qiskit recompilation updates an existing compiler record.INDEPNATIVEGATESMAPPEDQIR and LLVM output
The same
mqtextra enables QIR export for circuits generated with either compiler. QIR uses LLVM IR; the output choices are:qirorllvm.ll)--save.qir-bitcode.bc)save_circuitalso acceptsqir_profile. The default isbase; useadaptivefor measurement feedback and supported classical control flow. LLVM text records the Bench header and Core exporter version using;comments. Bitcode contains Core's QIR metadata without the Bench header.Current limitations
>=4,<5and Qiskit>=2.5,<2.6. Circuit generation and the public circuit representation still use Qiskit. Import preparation converts permutation gates to swaps with Qiskit's permutation utility and expands existing composite controlled-gate definitions before Core compilation.opt_levelat its default of2. Core uses its own fixed pipeline; this is not an equivalence to Qiskit optimization level 2. Values0,1, and3are rejected for Core compilation.TranspileLayoutmetadata.Validation
Tested locally with Python 3.13, MQT Core 4.0.0, and Qiskit 2.5.2 on macOS:
uvx nox -s mqt: 78 passed in a separate environment, using the new CI session.uvx nox -s lint: passed, including formatting, type checking, dependency-lock validation, and workflow checks.coverage-mqt.xml, uploads it with the other Python reports, and waits for it before the combined Codecov upload. The XML report generation was also verified locally.Local coverage from the full suite with
--cov=mqt.bench --cov-branch:The tests also cover controlled matrix gates, custom array-valued instruction definitions, unsupported opaque instructions, the import depth limit, nested physical-site validation, dependency import failures, and file/stream/CLI error handling. The QASM stream error handler is included in coverage rather than excluded.
Regression coverage includes unitary equivalence across six gate sets, directed routing and measurement order, parameter identity, classical feed-forward, mirrors without Qiskit transpilation, unsupported targets, optional-dependency errors, CLI exports, and the native-import abort caused by array-valued permutation parameters. QIR tests execute both LLVM text and bitcode through Core's DDSIM runtime, verify measurement ordering and Adaptive feedback, and cover CLI output, stream types, invalid profiles, unbound parameters, missing dependencies, and file preservation on lowering failure. These checks do not establish a performance or circuit-quality advantage over Qiskit.
Codex assisted with the implementation, tests, documentation, and this description. The QIR/LLVM additions need human review, and GitHub CI must run on the updated branch; this PR remains a draft.
Checklist
If PR contains AI-assisted content:
🤖 *AI text below* 🤖(titles are exempt).