Repository navigation
✨ Synthesize native parameterized gate sets - #2578
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
b645256 to
b0e5e64
Compare
b0e5e64 to
3882f97
Compare
6e9c79b to
a98fa36
Compare
4b5c952 to
8a98480
Compare
997d943 to
999ab53
Compare
Share angle cancellation and bounded sums across single- and two-qubit rotations. Combine commuting symbolic Pauli generators through native Clifford frames, preserve generated phases at large finite angles, and remove unobservable measurement frames. Shorten native half turns. Reuse target capability checks, remove a redundant fusion entry point, permit erased top-level Qiskit inputs, and trim overlapping tests and superseded design records. Keep constant-led runs with numerical fusion. Assisted-by: GPT-6 via Codex
Use the existing MLIR evaluator for asin, atan, and atan2 produced by symbolic compilation. This fixes QASM3 submission of controlled fractional powers. Cover signed zero and atan2 quadrants in the scalar evaluation test. Check commuting Pauli composition with full matrices, reversed native placements, phase corrections, and bounded RZZ angles in the C++ suite. These paths were previously exercised only by Python integration tests. Assisted-by: GPT-6 via Codex
|
🤖 AI text below 🤖 The latest synthesis evaluation compares upstream main 400/400 circuit/target combinations produce validated native exports, versus 271/400 on main. Main cannot represent the bounded IBM contract, cannot synthesize the fixed-R IonQ contract or some symbolic Pauli cases, and has one export failure. Unsupported cases are excluded from ratios. The corpus contains 24 Core benchmarks—GHZ, QFT, W state, QPE, Grover, multiplexer, QFT adder, and Bernstein–Vazirani at three sizes—plus 18 scalable numeric/symbolic kernels and eight identity microcases. Eight native contracts cover IQM, IBM, IonQ, Rigetti, and an exploratory fixed-RX/iSWAP basis. The latter is not a claim about an online Rigetti device. IBM fractional RX is unrestricted in the tested contract; RZZ is bounded to For each jointly supported target below, the median uses the same 39 paired Core/scalable cases, excluding microcases. Ratios are PR / main; lower is better.
Some representative results:
On all 271 jointly validated cases, total native one- and two-qubit gate counts never increase. There are tradeoffs: numeric IQM W-state/Pauli-layer workloads take up to about 20% longer while using roughly two-thirds fewer R gates. Seven total circuit depths increase; the largest non-micro increase is QPE-16 on CZ targets, 1,108 → 1,210 (+9.2%). Two-qubit depth never increases. Non-RZ one-qubit count increases in one exploratory iSWAP case, 98 → 99, while its total one-qubit count falls. Measurements use Release LLVM/MLIR 23.1 builds, Python 3.14.7, Qiskit 2.5.2, and NumPy 2.5.3 on DGX Spark arm64: one pinned CPU, one thread, one warm-up, and five timed repetitions. Targets have all-to-all connectivity to isolate synthesis. Import, cloning, export, and validation are outside synthesis timing. These results do not measure routing or hardware fidelity; timing differences of a few percent should not be overinterpreted. Validation uses full complex matrices for small synthetic circuits, sampled statevectors for larger circuits, three symbolic bindings, and 512 seeded DD shots against Core benchmark reference distributions. Maximum matrix/state error is 1.49e-14. Sampled checks are weaker than full-unitary equivalence. CI follow-up: all required hosted checks now pass at Raw measurements · Figure/data index · Reproduction bundle, including frozen inputs, scripts, samples, native IR, metadata, and PNG/PDF/SVG figures |
Record the 24–156-qubit comparison, approximation diagnostics, pass profiles, and reproduction artifacts for PR #2578. Assisted-by: GPT-6 via Codex
|
🤖 AI text below 🤖 Repeated the earlier evaluation at 24, 36, 54, 104, and 156 qubits. IQM, IonQ, and fixed-RX/CZ contracts stop at 54; IBM and unrestricted RX/RZ/RZZ extend to 156. The 68 frozen inputs give 398 circuit/target combinations per revision. PR: 398/398 native exports pass gate/angle checks. Main: 267/398. No compilation timeouts. Main has 68 unsupported bounded contracts and 63 synthesis failures. These are native-conformance checks, not full-width equivalence proofs.
The larger instances expose three priorities:
The metadata-verification optimization is worth keeping. It explains much of the symbolic speedup. A SymbolDCE-only diagnostic leaves the 1,248-parameter IR unchanged but takes 106.0 ms on main versus 4.16 ms on the PR. Main repeats quadratic cross-argument checks during verification; the PR consolidates them. Symbolic EfficientSU2-156 export also improves from 257.1 to 48.5 ms. Unused device capacity is not a material bottleneck in these probes: a 24-qubit circuit takes 11.73/11.69 ms on 24-/54-qubit IQM targets, and 13.97/14.16 ms on 24-/156-qubit IBM targets. Peak worker RSS is 848 MiB main / 811 MiB PR, including Python, compilation, export, and validation. The baseline remains Every export is checked against native aliases, arity, fixed parameters, and bounds; symbolic circuits use three bindings. Eight additional wide DD sampling checks pass, while two 30-second simulation checks time out (IBM CZ QPE-156 and fractional QFT-adder-156). Both compile successfully. No full-width equivalence proof is claimed. Full report and source locations · Raw measurements · Method and reproduction instructions · Reproduction bundle with frozen inputs, raw samples, diagnostics, and PNG/PDF/SVG figures |
Use the Weyl fidelity floor across direct Pauli and numeric native synthesis. Merge Z frames on native RZ targets after local fusion, without expanding physical rotations or isolated parameter expressions. Keep the shared constant cache informed of every rewrite. Let module cleanup own canonicalization and dead symbols after inlining. Assisted-by: GPT-6 via Codex
Small interactions may now be approximated away. Check the shared fidelity floor, phase, and removal of negligible entanglers instead of requiring exact preservation. Fold the small-angle cases into the existing boundary test. Assisted-by: GPT-6 via Codex
|
🤖 AI text below 🤖 Implemented in
Repeated the frozen 24–156-qubit experiment: 398/398 native exports pass their gate and angle checks, versus 267 on main. Across the seven targets, median per-case synthesis times are 5–9% lower than the previous PR in this run.
Two-qubit counts and two-qubit depth never increase versus the previous PR. Small regressions remain: total 1Q counts increase in 12 cases (at most 1.3%), non-RZ 1Q counts in 38 (at most 4%, from 25 to 26), and total depth in 21 (at most 2.3%). The report includes every case and timing ratio. Pass profiles show the remaining costs: module canonicalization and dead-value analysis account for about one third and one sixth of QFT-156 pass time. Native synthesis accounts for about half of Grover-54 pass time. Broader pipeline and exporter changes remain follow-up work. Angle probes confirm the shared cutoff, and the 156-qubit CZ-star probe reduces 155 RZ gates to one. Validation: the complete local C++ suite has 3,922 passes and one existing skip; 791 Python MLIR/Qiskit tests and 400 smaller semantic/export cases pass. Bench passes 180 optional compiler tests and 269 benchmark tests. Repository lint and whole-file C++ lint pass. The two failing CI tests with stale exact-preservation assertions were consolidated into fidelity, phase, and zero-entangler checks; the new CI run is pending. Measurements use Release LLVM/MLIR 23.1, Qiskit 2.5.2, one pinned CPU, five timed samples, and all-to-all targets. Main was measured during this evaluation; previous-PR samples are historical. Contended runs were discarded, and three pairs with over 30% sample spread were repeated on both compilers. Large-width checks establish native conformance, not full semantic equivalence. Routing, calibration, and hardware execution are excluded. Full report · Methods and provenance · Raw results · Reproduction bundle |
Forward repeated tensor slots in one chain rewrite instead of repeatedly commuting inserts past extracts. Defer target liveness cleanup until after placement, while retaining it in standalone QCO cleanup. Use matrix precision for Euler shortcuts so reconstruction roundoff does not introduce extra native gates. Fixed target angle checks are unchanged. Assisted-by: GPT-6 via Codex
|
🤖 AI text below 🤖 Implemented the cleanup and numerical fixes in The easy gate regressions came from matrix-reconstruction roundoff, not virtual-RZ accounting. Euler emission now uses matrix precision while fixed target capability checks remain unchanged. For example, W-36 / IBM CX drops from 181 to 175 SX gates. Multiplexer-24 keeps the eight-CX saving and returns to 25 SX gates. The main canonicalization hotspot was repeated tensor insert/extract shuffling: QFT-156 needed 24,178 chain rewrites and 1.29 million extract-fold attempts. The existing pattern now normalizes that chain in one rewrite. Target compilation runs dead-value analysis once, after placement. Iteration caps stay unchanged: the expensive work happened inside the worklist, and control-flow cleanup still needs convergence. Fresh paired timings, five samples after warm-up:
Grover is essentially unchanged; its retained late liveness pass and native synthesis dominate. The report includes all ten paired cases and pass profiles. All 398 large cases pass native conformance. These fixes reduce physical 1Q counts in 40 cases, increase no gate counts, and preserve all 2Q depths. Three total depths increase by one. Relative to the older pre-refinement measurements, a few symbolic SU2 cases still use three extra physical rotations; removing RZ from the depth metric does not eliminate that difference. The report separates those local-decomposition trade-offs from numerical variation. Validation: 3,922 C++ tests passed with one existing skip; 791 Python integration tests and 400 smaller semantic/export checks passed. Repository and whole-file C++ lint passed. Bench passes 180 optional-integration tests, 269 benchmark tests, lint, and lock validation. Large-width native conformance is not a full semantic-equivalence proof; timings exclude routing and hardware execution. |
Make the graph-region pointer check explicit and add the required initializer trailing comma. Whole-file lint covers the complete cleanup commit, including the newly changed tensor and pipeline files. Assisted-by: GPT-6 via Codex
Reuse the analytic three-entangler template for symbolic Cartan triples and merge equal diagonal interactions across pair boundaries before lowering. Move classical load and condition propagation into one scoped walk. Batch control-flow tensor scalarization, index modifier wire mappings once, and visit definitions before users during cleanup to avoid repeated scans. Validate phase, native bounds, wire order, classical invalidation, and loop signatures. Repeat the complete frozen small and large benchmark suites against upstream main; keep experiment artifacts outside the source PR. Assisted-by: GPT-6 via Codex
|
🤖 AI text below 🤖 Implemented in c9123b1: three-entangler symbolic Cartan synthesis, diagonal merging across pair boundaries, scoped classical simplification, batched tensor scalarization, indexed modifier mappings, and top-down cleanup. Repeated the complete frozen suite against main On common large cases, median synthesis time is 21% lower for IQM, 22% lower for IBM CZ, and 35% lower for IBM CX. Two-qubit count, two-qubit depth, and single-qubit count excluding RZ never increase. The existing depth tradeoff remains: some QPE/QFT-adder cases have greater depth excluding RZ, up to 17.3%; all large-case counts and depths match the previous PR evaluation. The new symbolic Cartan witness uses three rather than four fixed entanglers. On IQM this trades four additional R gates for one fewer CZ. The diagonal inverse witness falls from six to two CZ gates. Cleanup stress tests improve by 5.7×–70×; those are microbenchmark results, separate from synthesis timings. Local validation: 3,925 CTest entries with one existing optional skip, 985 Python tests, repository and whole-file C++ lint, and generated MLIR documentation. Final lint-only edits were rebuilt and retested; the archive retains the exact measured patch and final source patch. Hosted CI is separate. Full report, plots, raw samples, and reproduction archive. Counting all single-qubit gates, including RZ: the following plots give every gate unit weight. They reuse the same measurements. Total one-qubit count never increases across the 538 common cases. Depth including RZ never increases in the large suite; one small Rigetti RX/iSWAP case ( |
|
@simon1hofmann @denialhaag I believe the results pretty much speak for themselves. The code can now properly handle many cases of symbolic synthesis and is much more optimized to trim down the number of single-qubit gates, while at the same time being >20% faster. @simon1hofmann maybe you could run this through benchpress and compare with your latest results/4.0. Other than that, I do not think this needs an in-depth review given the extensive amount of iteration I did on this. However, it certainly can't hurt, if the two of you have a quick look. I also made sure to update the MQT Bench PR in tandem with this PR so that we have all the right features to support the IonQ gateset, the AQT gateset, as well as the latest IBM architectures. I've come to the conclusion that it likely makes sense to refresh the available architectures in MQT Bench to reflect current architectures. I believe there is little use in maintaining architectures that are no longer in use. I also tried very hard to avoid adding new gates here when we already have gates that can express the respective functionality with fixed angles. Fractional gates by IBM also add the first case of gates that have a limited angle domain. I am not quite sure yet the overall design for that is perfect (and it definitely cannot be communicated through QDMI at the moment), but I iterated on it quite a bit and it seems to be working. I am pretty much done with this for now. |
denialhaag
left a comment
There was a problem hiding this comment.
Really cool to see these improvements! Thanks a lot, @burgholzer and @simon1hofmann! 🙂
I took some time to scroll through the changes and left a comment whenever something caught my eye. Most of the comments are inspiration for follow-up PRs. None of them are dealbrakers. Let me know what you think!
|
🤖 AI text below 🤖 Ran the full QASMBench medium suite through Benchpress with Core 4.0.0, main The figure uses all 92 cases for outcomes and the same 88 nonconditional cases for both timing and CZ bars. The four
PR #2578 versus main
There is a slow-case regression in this run: summing the per-case median compilation times gives 673.07 s on main versus 721.26 s on the PR (+7.2%), primarily from
These slow cases used one timed round, so the regression needs repeated measurements before attributing it to a particular change. This is a full compilation-pipeline measurement, including mapping/routing, not the synthesis-only workload in the earlier reports. Method and limits
|
|
@simon1hofmann looks convincing to me. I'd run one more Codex iteration based on Daniel's comments, creating follow-ups where reasonable, and then likely merge the PR. |
Sounds good to me. I will also run another sanity check in my session I originally used to work on the core and bench PR :) |
Found nothing in the core PR, just one concern in MQT Bench that I posted there: munich-quantum-toolkit/bench#1027 (comment) |
Nice. That sounds isolated enough so that it can be fixed locally in Bench. I'll kick off my run here, and if nothing big comes up, merge |
Clarify API summaries, native-attribute documentation, and rotation formulas. Keep modifier helpers inside their namespace and name the classical control simplifier for its scope. Document bounded queries and Pauli return arity. Broader follow-ups are tracked in #2671, #2672, #2673, #2674, and #2675. Assisted-by: GPT-6 via Codex
|
4bc6bde contains the easy fixes. Follow-ups have been created. Let's get this merge once CI is green |






















🤖 AI text below 🤖
Description
Compile native parameterized gate sets through existing R and Pauli rotation operations. This builds on #2575 and supplies the compiler support for munich-quantum-toolkit/bench#1027.
Numeric and runtime synthesis share Euler plans and analytical Pauli decompositions. RX/RY/RZ, RXX/RYY/RZX/RZZ, single-controlled Pauli rotations, and controlled phase retain runtime parameters. A two-qubit Pauli rotation needs one unrestricted native entangler or two fixed entanglers, including square-root iSWAP. Commuting symbolic rotations combine before lowering; two independent commuting products share a Clifford-entangler pair, and three products reuse the analytic three-entangler template. Equal diagonal interactions merge across pair boundaries before lowering. Constant resynthesis uses the same average gate fidelity floor of
1 - 1e-12across direct Pauli, fractional, and fixed-entangler paths. Small nonlocal angles may disappear; this is a per-decomposition bound, not a whole-circuit budget. Unbound angles remain exact. Cost estimation and emission share the decomposition choices.IQM's R/CZ basis uses at most two R gates per single-qubit unitary. Z frames propagate through diagonal entanglers on both equatorial and native RZ targets, and enter R axes where available; measurement and reset discard their incoming frames. Other boundaries preserve frames and phase. Propagation follows local fusion so merging virtual Z gates does not add physical rotations. Isolated native RZ parameters remain unchanged. RX/RZ targets prefer ZXZ, while fixed RX/RY/R quarter-turn targets emit native gates directly and use available half turns. Same-generator composition shares inverse cancellation and balanced angle sums. Generated phases and rotation terms are normalized before accumulation to preserve small corrections beside large finite angles.
Operation capabilities retain inclusive parameter bounds alongside fixed values. Pauli entanglers covering
[0, pi/2]use local corrections for numeric angles; unknown runtime angles use two supportedpi/2rotations. Binding before compilation enables fractional gates directly. Bounds survive target import, MLIR serialization, export, and submission checks. Qiskit's public predicates conservatively identify the supported interval.CompilerTarget.NativeOperations.from_qiskitimports capabilities independently of placement; the ordinary target constructor supplies topology.Qiskit import/export preserves the radian aliases
GPI(phi) = i R(pi, phi)andGPI2(phi) = R(pi/2, phi). They remain fixed-R capabilities inside Core. Targets advertise virtual RZ explicitly; providers own hardware phase tracking. No new ion-specific IR gates, MS operation, or provider dependency is needed. Core's native bridge requires Qiskit 2.5.x. Export preserves used parameter identities, permits unused top-level inputs to disappear, and retains expression-budget and custom-gate formal-parameter checks.Bundled SC compilation models include
mqt.sc.ibm.heron(156 qubits) andmqt.sc.ibm.nighthawk(120 qubits, 12-by-10 grid), using IBM Runtime topology snapshots without calibration data. Fractional Heron is exercised through Qiskit targets because QDMI v1 cannot encode RZZ bounds.The remaining work from #2649 is integrated, with credit to @simon1hofmann. Target capabilities determine fusion behavior without a separate policy or runtime-entangler field. Classical loads and known branch conditions use a scoped scan before cleanup. Tensor-chain normalization and control-flow scalarization process all eligible slots together; modifier rewrites index wire mappings once. Top-down cleanup avoids repeated scans after value forwarding. Target liveness cleanup runs once after placement. Euler emission uses matrix precision for numerical shortcuts; fixed target capability checks retain their stricter tolerance. Redundant fusion entry points, overlapping tests, and superseded design records have been removed.
Closes #2614.
Validation
Assisted by GPT-6 via Codex.
Checklist
If PR contains AI-assisted content:
🤖 *AI text below* 🤖(titles are exempt).