Repository navigation
🐛 Lower nested modifiers in controlled composites - #2594
Merged
burgholzer merged 3 commits intoSep 25, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
simon1hofmann
added this pull request to stack #2596
September 21, 2026 09:54
simon1hofmann
marked this pull request as ready for review
September 21, 2026 11:43
burgholzer
force-pushed
the
codex/nested-controlled-modifiers
branch
from
September 25, 2026 21:03
e8cb4cc to
c756dfd
Compare
10 tasks done
🤖 *AI text below* 🤖 Reuse inverse and disjoint integer-power unrolling inside eligible controlled composites. Preserve width and native-target guards without adding a pipeline pass or early rotation merging. Cover both target pipelines, the OpenQASM reproducer, phase, wire order, and unsupported powers. Stack on #2565 to address #2588. Assisted-by: GPT-6 via Codex
🤖 *AI text below* 🤖 Use verified linear QCO inputs to detect overlapping body wires without reconstructing wire IDs. Iterate inverse bodies without a temporary vector and use one unrollModifier overload family with a consistent no-match result. Preserve the integer-power limit, native target guards, and wire mappings. Assisted-by: GPT-6 via Codex
🤖 *AI text below* 🤖 Share the OpenQASM matrix cases across both target pipelines and keep one case for each unsupported-power boundary. Permit constant hoisting instead of freezing incidental IR layout; native synthesis owns rotation cost checks. Retain phase, wire order, inverse ordering, control scope, and target limits. Assisted-by: GPT-6 via Codex
burgholzer
force-pushed
the
codex/nested-controlled-modifiers
branch
from
September 25, 2026 22:43
c756dfd to
7ae617f
Compare
burgholzer
approved these changes
Sep 25, 2026
burgholzer
left a comment
Member
There was a problem hiding this comment.
This one also looks good! Just trimmed down tests and docs again. Let's get this in. Two more PRs merged, one more issue closed ![]()
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
Fixes #2588. Stacked on #2565 (
codex/bench-controlled-gates).Target compilation and synthesis currently reject a controlled composite when an inverse or power modifier wraps its body. Reuse the existing inverse and power-unrolling helpers inside eligible controls, then simplify the resulting modifiers in the existing multi-control decomposition pass.
The shared unrolling helpers require verified linear QCO IR. This avoids rebuilding wire identities, copying inverse bodies, and maintaining a separate control wrapper. Inverse bodies retain reverse gate order. Constant integer powers are distributed only when body operations act on disjoint wires. Width thresholds and native-target support remain respected. No new pipeline pass, early rotation merging, dependencies, or frontend-specific handling are added.
Usage and limitations
The existing
compile_for_target(...)andsynthesize_for_target(...)APIs now accept supported nested forms such asctrl @ inv @ compositeand integer powers of disjoint composite bodies.Fractional powers, runtime exponents, and powers of overlapping body operations are not distributed. Such inputs still need an existing simplification or native synthesis path; this does not add arbitrary large-unitary synthesis or repeated expansion of circuit bodies.
Validation
c92ffa7a6and reviewed together with the stacked PR.Hosted checks for the updated heads are pending.
Codex assisted with implementation, tests, documentation, and this description.
Checklist
If PR contains AI-assisted content:
🤖 *AI text below* 🤖(titles are exempt).