✨ Add MQT Core compilation and QIR export - #1027
Draft
simon1hofmann wants to merge 10 commits into
Draft
simon1hofmann wants to merge 10 commits into
simon1hofmann wants to merge 10 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Assisted-by: GPT-6 via Codex
Assisted-by: GPT-6 via Codex
Assisted-by: GPT-6 via Codex
Include the MQT Core coverage report in the combined CI upload. Assisted-by: GPT-6 via Codex
🤖 *AI text below* 🤖 Pin Core main plus the controlled-composite fix and expose CompilationOptions with a fixed seed and mapping trial count, including mirror recompilation. Remove circuit preprocessing and parameter remapping now handled by Core. Configure MLIR for CI source builds and cover option forwarding, reproducibility, and parameter-vector identity. Assisted-by: GPT-6 via Codex
🤖 *AI text below* 🤖 Use the Core fix that handles composite controls within the existing decomposition pass and avoids extra single-qubit merging. Assisted-by: GPT-6 via Codex
simon1hofmann
force-pushed
the
feat/mqt-core-compiler
branch
from
September 17, 2026 08:49
509d184 to
df2aeca
Compare
🤖 *AI text below* 🤖 The reusable lint job configures sccache without installing it when stub checks are disabled, so building Core for ty fails. Run the existing ty hook in the Core job, which already provides MLIR and builds the dependency. Require that job whenever either tests or lint are requested. Assisted-by: GPT-6 via Codex
🤖 *AI text below* 🤖 Pin the integrated Core changes for native trapped-ion gates and generic fixed RX/RY/RZ capabilities while preserving controlled-composite support. Restore Rigetti pulse names during target validation and cover symbolic parameters, native semantics, and rejected target definitions. Assisted-by: GPT-6 via Codex
🤖 *AI text below* 🤖 Use canonical native definitions so Core preserves numeric and symbolic pulses through repeated compilation. Omit capabilities wider than the input circuit at the native-gate level. Pin Core with the matching import and fixed-parameter compatibility fixes. Assisted-by: GPT-6 via Codex
🤖 *AI text below* 🤖 Pin the rebased integration branch with the fixed-parameter and native-gate CI tests. Keep the dependency lockfile and documented revision aligned. Assisted-by: GPT-6 via Codex
This branch has not been deployed
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, first install LLVM/MLIR 23.1 or newer and set
MLIR_DIRusing Core’s build instructions. The extra builds Core from commit1a0c32f7cf3e264af9143146bf764fd669aa772d, combining Core main with controlled composites (#2565), generic fixed-parameter targets (#2575), and native trapped-ion gates (#2578). These APIs are not in Core 4.0.0:python -m pip install -e ".[mqt]"The level-specific functions
get_benchmark_indep,get_benchmark_native_gates, andget_benchmark_mappedaccept the same compiler and options arguments. The algorithm level does not compile.Bench defaults to compilation seed
10and four mapping trials. Pass Core’sCompilationOptionsto override those defaults:Options also apply to mirror recompilation. Supplied objects replace Bench’s defaults;
CompilationOptions()retains Core’s default seeds and CPU-dependent trial count. Timing, statistics, and routing search-memory controls are available through the same object.compiler_optionsis rejected for Qiskit compilation or the algorithm level. The benchmark-generation seed remains separate.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
1a0c32f7cf3e264af9143146bf764fd669aa772dand Qiskit>=2.5,<2.6. Installing Core currently requires a C++20 compiler and LLVM/MLIR 23.1 or newer. Replace the development pin with a release requirement before publishing Bench. Circuit generation and the public circuit representation still use Qiskit. Core imports permutations and array-valued definitions and preserves parameter identity/vector membership. Core handles MCMT definitions and controlled arithmetic composites within its existing decomposition pass, without extra pipeline passes or single-qubit merge calls; Bench passes circuits directly to Core without recursive preprocessing.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 or expose initial-placement controls.Validation
Tested locally with Python 3.13, Core
1a0c32f7cf3e264af9143146bf764fd669aa772d, and Qiskit 2.5.2 on macOS:Coverage from the full suite:
The existing Core CI job runs the optional compiler tests and type checks and uploads its coverage with the other Python reports. Hosted CI for this pin update is pending.
Codex assisted with the implementation, tests, documentation, and this description. The PR remains a draft.
Checklist
If PR contains AI-assisted content:
🤖 *AI text below* 🤖(titles are exempt).