Skip to content

Support Ctrl symbolic rules in graph-decomposition - #3213

Open
maliasadi wants to merge 21 commits into
mainfrom
decomp/add_ctrl_sym_rules
Open

maliasadi wants to merge 21 commits into
mainfrom
decomp/add_ctrl_sym_rules

Conversation

@maliasadi

@maliasadi maliasadi commented Sep 10, 2026

Copy link
Copy Markdown
Member

Context:
A follow-up PR to #3204; adding support for the symbolic rules PL registers for C(Op) here.

Description of the Change:

Benefits:

Possible Drawbacks:

Related GitHub Issues:
[sc-130374]

@maliasadi maliasadi changed the title Decomp/add ctrl sym rules Support Ctrl symbolic rules in graph-decomposition Sep 10, 2026
Base automatically changed from decomp/fix_sym_rules to main September 14, 2026 21:23
@codecov

codecov Bot commented Sep 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.75000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 95.63%. Comparing base (d023a97) to head (a5ca4bc).

Files with missing lines Patch % Lines
...tend/catalyst/decomposition/decomposition_rules.py 98.75% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3213      +/-   ##
==========================================
- Coverage   95.63%   95.63%   -0.01%     
==========================================
  Files         177      177              
  Lines       20949    20994      +45     
  Branches     2112     2118       +6     
==========================================
+ Hits        20035    20077      +42     
- Misses        725      728       +3     
  Partials      189      189              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

the base op's id (`2C(S){}{wires:1}{}`), not the wrapper's own arguments. The number of controls
an operator instance carries now reaches the rule closure from lowering, so `<n>C(...)` rules are
synthesized at trace time rather than only on demand.

@maliasadi maliasadi Sep 15, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll merge this when addressing other suggestions

Suggested change
The id a distributed rule declares for each gate it produces is now *generated* with its
modifiers, through the same `build_graph_op_id` builder the rest of the frontend uses, instead of
being spliced into a finished id string. The modifiers are placed canonically by construction, so
a resource that is already symbolic composes (`Adjoint(C(X))` spells `C(Adjoint(X))`) rather than
being rejected as out of order.
A rule may also *produce* a multi-controlled gate. The control count a resource carries is now
kept when the closure explores it through its base, so the `<n>C(...)` node that resource names
gets rules of its own instead of only `C(...)`; an operator reached again under more controls
pays just for the variants it is still missing. The name paired with such an id is spelled the
way PennyLane's registry spells it, since a multi-controlled id reads `<n>C(...)` and PennyLane
names every controlled operator `C(...)` whatever its control count.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant