Skip to content

🐛 Preserve symbolic Euler chains in target synthesis - #2559

Open
simon1hofmann wants to merge 4 commits into
mainfrom
codex/symbolic-target-fusion
Open

simon1hofmann wants to merge 4 commits into
mainfrom
codex/symbolic-target-fusion

Conversation

@simon1hofmann

@simon1hofmann simon1hofmann commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

🤖 AI text below 🤖

Description

Allow symbolic circSU2 circuits to compile for an SX/X/RZ/CZ target and export
to Qiskit with their original parameters still bindable. Extend direct symbolic
synthesis to compatible X-outer Euler chains as well.

  • Reuse ZXZ/ZYZ chain angles directly in the u, zyz, zxz, and zsxx
    bases, and XZX/XYX chain angles in xzx, xyx, and r. Either outer
    rotation may be absent. Reuse the existing emitters without inverse
    trigonometry or conditional expressions, preserving global phase and the
    existing synthesis gate-count bounds.
  • Fuse single-qubit runs directly into non-U target bases after placement and
    classical-read cleanup. This avoids the intermediate U phase corrections.
  • Retain the existing optimizer for U-based and unrestricted targets. Other
    symbolic chain shapes keep their existing synthesis path; this is not a
    general symbolic atan2 export fix.
  • Test controlled rotations with phase-sensitive matrix comparisons, all 56
    compatible chain/basis combinations, and symbolic compile–export–bind cases.
    Check X-outer chains through both target compilation and synthesis-only APIs.

No new dependencies or Python API changes are required.

Results

The two skipped Benchpress Summit circSU2 workloads pass through the MQT
adapter on fake_torino: circular EfficientSU2, three repetitions, default
compilation options. Both runs preserve the input and parameter identities,
export successfully, bind zero/mixed values after export, and pass target
validation.

These measurements were recorded before the XZX/XYX extension:

Qubits Parameters CZ Compilation, two runs Export, two runs
89 712 609 0.732 / 0.734 s 0.062 / 0.063 s
100 800 651 0.918 / 0.927 s 0.075 / 0.075 s

These are local diagnostic timings, not a cross-tool performance comparison.
The Benchpress skip markers are unchanged pending integration of this fix.

Validation

Based on main dc78630f9; Release build on macOS ARM64 with LLVM/MLIR 23.1.0,
Python 3.14.3 and Qiskit 2.5.2.

Latest validation for 1a9a1da5d, including the XZX/XYX extension:

  • C++ optimization and target-synthesis tests: 264 passed (203 + 61).
  • Python compiler/API tests in test/python/test_mlir.py: 98 passed, including
    the original small/full-size circSU2 regressions and six new X-outer-chain
    compile/synthesize–export–bind cases.
  • Controlled-chain regressions check full matrices at zero, π, 2π, and mixed
    angles, together with basis membership and synthesis gate-count bounds.
  • Whole-changed-file C++ lint with Clang-Tidy 23: passed with no findings.
  • Repository lint and git diff --check: passed.
  • CI for the latest commit is still in progress at the time of this update.

Earlier validation, before the XZX/XYX extension:

  • Core Python compiler/export tests: 511 passed.
  • Benchpress: 353 passed (101 MQT unit tests and 252 small/medium QASMBench
    functional cases). Timing disabled; excludes large circuits and the eight
    bwt_n21/factor247_n15 topology cases.
  • C++ optimization, target synthesis and Euler/fusion tests: 331 passed.
  • C++ compiler tests: 222 passed; ConvertsUnknownDeviceFailureToError fails
    because the local QDMI error lacks the expected diagnostic text. This was
    also observed before the fix; a separate native main build was not used to
    establish baseline status.

Native tests ran directly with local shared-library paths. The latest local
build uses deferred GoogleTest discovery to avoid the post-link discovery
failure; no repository build policy was changed.

OpenAI Codex assisted with implementation, tests, review and this description.

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.
  • 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.

If PR contains AI-assisted content:

  • Any agent that created, edited, or submitted GitHub content was explicitly authorized for that scope, as required by our AI Usage Guidelines.
  • Every agent-authored or agent-edited public text body begins with the visible disclosure 🤖 *AI text below* 🤖 (titles are exempt).
  • I have disclosed AI assistance in the PR description.
  • I confirm that I have personally reviewed and understood all AI-generated content, and accept full responsibility for it.

🤖 *AI text below* 🤖

Reuse direct Euler angles and synthesize into the target basis after
placement. This avoids inverse trigonometry and cancelling U phase
corrections for symbolic circSU2 circuits while retaining classical
read sharing and the existing U-target optimizer.

Assisted-by: GPT-5 via Codex
@simon1hofmann simon1hofmann added bug Something isn't working c++ Anything related to C++ code MLIR Anything related to MLIR labels Sep 14, 2026
@simon1hofmann simon1hofmann self-assigned this Sep 14, 2026
🤖 *AI text below* 🤖

Reuse the existing Euler emitters for symbolic XZX and XYX chains in
compatible XZX, XYX, and R bases, including shortened chains. Preserve
phase and gate-count bounds without inverse trigonometry.

Cover controlled matrix equality and late-bound Qiskit export through
both target pipelines. Initialize the test fixture in its constructor.

Assisted-by: GPT-5 via Codex
@codecov

codecov Bot commented Sep 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

🤖 *AI text below* 🤖

Use designated fields for the symbolic angle initializer. Exercise the
compiler-target basis overload in the existing seven-basis regression,
covering the previously missed U and ZXZ switch cases.

Assisted-by: GPT-5 via Codex
🤖 *AI text below* 🤖

Add the trailing commas required by clang-tidy. Extend the existing symbolic Euler regression with isolated rotations to exercise the RX-to-R conversion.

Assisted-by: GPT-5 via Codex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working c++ Anything related to C++ code MLIR Anything related to MLIR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant