🐛 Fix and simplify QCO decomposition - #2478
Open
simon1hofmann wants to merge 2 commits into
Open
Conversation
Keep single-qubit fusion, numerical Weyl failure, native-target synthesis, and small rotations correct on valid QCO IR. Reuse embedded matrix kernels, cache pending matrices, and reduce multi-controlled planning and runtime rotation arithmetic. Retain the modifier-matrix contract already merged in #2464. Preserve phase, numerical tolerances, supported widths, and gate-cost contracts with semantic regressions. Assisted-by: Codex
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
burgholzer
added a commit
that referenced
this pull request
Sep 8, 2026
Preserve small interactions with stable beta extraction and use the analytic prefix instead of searching equivalent basis gates. Reuse matrix reconstruction and attach fixed-basis local factors directly. Repair native operand orientation without requiring a synthesis basis. Skip generic CX/CZ-cost fusion for this target to avoid increasing native gate counts, and document the per-unitary optimality limit. Leave the shared decomposition failure and fusion work to #2478. Assisted-by: GPT-6 via Codex
12 tasks
Keep the typed target environment and generated pass factories from main. Adapt the affected regression tests and preserve the numerical failure contract in the pass definition. Assisted-by: Codex
burgholzer
added a commit
that referenced
this pull request
Sep 8, 2026
Preserve small interactions with stable beta extraction and use the analytic prefix instead of searching equivalent basis gates. Reuse matrix reconstruction and attach fixed-basis local factors directly. Repair native operand orientation without requiring a synthesis basis. Skip generic CX/CZ-cost fusion for this target to avoid increasing native gate counts, and document the per-unitary optimality limit. Leave the shared decomposition failure and fusion work to #2478. Assisted-by: GPT-6 via Codex
burgholzer
added a commit
that referenced
this pull request
Sep 9, 2026
* ✨ Add optimal square-root iSWAP synthesis Synthesize numeric two-qubit blocks with zero to three square-root iSWAP gates and expose the fixed gate as a compiler target capability. Assisted-by: GPT-6 via Codex * 📝 Remove unnecessary synthesis documentation Remove the added guide and glossary sections and modification comments. Assisted-by: GPT-6 via Codex * ♻️ Fold square-root iSWAP tests into Weyl tests Keep two-qubit Weyl synthesis coverage in the existing test file. Assisted-by: GPT-6 via Codex * 📝 Simplify square-root iSWAP reference comment Keep the equation reference next to the interleaving rotations. Assisted-by: GPT-6 via Codex * ♻️ Simplify square-root iSWAP synthesis details Inline the margin calculation, shorten comments, and format the gate matrix by row. Assisted-by: GPT-6 via Codex * ♻️ Use the explicit Weyl decomposition type Remove the KAK alias from square-root iSWAP synthesis. Assisted-by: GPT-6 via Codex * 🎨 Format the square-root iSWAP test matrix Keep each matrix row on a separate line with row comments. Assisted-by: GPT-6 via Codex * ♻️ Keep Python coverage focused on bindings Move the target enum check into the existing MLIR tests and leave gate-count and synthesis correctness coverage to C++. Assisted-by: GPT-6 via Codex * 🧪 Remove redundant Python target enum test Assisted-by: GPT-6 via Codex * 📝 Fold sqrt(iSWAP) into synthesis changelog Assisted-by: GPT-6 via Codex * 📝 Preserve existing changelog wording Assisted-by: GPT-6 via Codex * 🐛 Include parameter utilities in compiler target Assisted-by: GPT-6 via Codex * 🐛 Qualify complex type in Weyl tests Assisted-by: GPT-6 via Codex * 🐛 Stabilize sqrt(iSWAP) synthesis near CNOT Use a rationalized half-angle formula to avoid cancellation near zero rotations. Resolve the clang-tidy diagnostics in synthesis and its tests. Assisted-by: GPT-6 via Codex * 🎨 Add trailing comma in placement test Assisted-by: GPT-6 via Codex * 🐛 Fix and simplify square-root iSWAP synthesis Preserve small interactions with stable beta extraction and use the analytic prefix instead of searching equivalent basis gates. Reuse matrix reconstruction and attach fixed-basis local factors directly. Repair native operand orientation without requiring a synthesis basis. Skip generic CX/CZ-cost fusion for this target to avoid increasing native gate counts, and document the per-unitary optimality limit. Leave the shared decomposition failure and fusion work to #2478. Assisted-by: GPT-6 via Codex * 📝 Remove unnecessary square-root iSWAP guide section * 🐍 Align the Python SQRTISWAP enum spelling Assisted-by: GPT-6 via Codex * 🎨 Wrap the combined synthesis changelog entry Assisted-by: GPT-6 via Codex --------- Co-authored-by: Lukas Burgholzer <burgholzer@me.com>
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
Fix decomposition and fusion on valid QCO IR, and remove repeated work without adding pass-local IR verification or relaxing numerical tolerances.
Updated against
mainat4c5e45855, including #2464 and the target-environment API. Its centralized modifier-matrix handling is retained unchanged at the getters; this PR optimizes the shared composer while preserving full-width, idle-target, zero-target, ordered-yield, and width-limit behavior. The duplicate getter fix was dropped. The update keeps the parameterless target pass factories and adapts the affected regression tests to the typed target environment. Numerical-failure documentation remains in the pass definition.C++ API note:
decomposeUnitary2QWeylnow returns an optional result.TwoQubitWeylDecomposition::tryCreateprovides the recoverable path;createretains its success-required contract. Related decomposition work in #2467 and #2468 is not duplicated.No new dependencies. Detailed audit notes and standalone experimental probes are excluded from the PR.
Validation
uvx nox -s lint: passed.uvx nox -s cpp-lint: passed across all 15 changed C++ implementation/test files, with zero findings.mlir-docgeneration: passed.7.1e-9to2.5e-17before integration with main; the native regression suites were rerun for this update. The standalone probes were not rerun.Local clang-tidy is 23.0.0git, not CI's 23.1.1. Hosted CI must rerun on the updated head. Local coverage, Python binding tests, and a full Sphinx build were not rerun for this update; results from the previous head are not claimed for the new commit.
Checklist
AI assistance: Codex assisted with the audit, implementation, tests, independent review, and PR preparation. A human must review the contribution before accepting or merging it.
🤖 *AI text below* 🤖(titles are exempt).