Skip to content

✨ Canonicalize adjacent controlled gates - #2752

Merged
burgholzer merged 1 commit into
mainfrom
codex/controlled-gate-canonicalization
Oct 13, 2026
Merged

burgholzer merged 1 commit into
mainfrom
codex/controlled-gate-canonicalization

Conversation

@burgholzer

@burgholzer burgholzer commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

🤖 AI text below 🤖

Description

Adjacent controlled inverse gates and constant rotations currently remain hidden in separate control regions. This joins only matching control/target wires with single-unitary bodies, letting the existing gate canonicalizers cancel inverse pairs or merge rotations. Target-bound rotations remain separate so native fixed-angle constraints are preserved.

Extracted independently from the keynote branch (#2685), based directly on main; no dependency on the other extracted changes. Tests compare full unitaries, including controlled phase, two-target gates, reversed wire order, and target constraints. Both positive regressions fail on upstream before the fix.

Validation: all 584 QCO IR tests (including 19 modifier canonicalization tests), whole-file C++ lint, and repository lint pass locally. Independent ponytail review found no findings. Hosted CI is pending.

AI assistance covered extraction, independent review, regression fixes, validation, and this description within the user-authorized scope. Human acceptance/review remains.

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.

Expose matching controlled inverse pairs and constant rotations to the
existing gate canonicalizers. Preserve target constraints and wire order,
with full-unitary regressions for controlled phase and multi-target gates.

Assisted-by: GPT-6 via Codex
@burgholzer burgholzer added enhancement Improvement of existing feature c++ Anything related to C++ code MLIR Anything related to MLIR labels Oct 13, 2026
@burgholzer burgholzer self-assigned this Oct 13, 2026
@codecov

codecov Bot commented Oct 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@burgholzer burgholzer added this to the v4.1.0 - QDMI 1.4 / MQSF milestone Oct 13, 2026
@burgholzer
burgholzer merged commit db75a1d into main Oct 13, 2026
25 checks passed
@burgholzer
burgholzer deleted the codex/controlled-gate-canonicalization branch October 13, 2026 18:25
@burgholzer burgholzer mentioned this pull request Oct 13, 2026
8 of 10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Anything related to C++ code enhancement Improvement of existing feature MLIR Anything related to MLIR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant