Skip to content

Support dynamic control values in captured qp.ctrl - #3373

Merged
JerryChen97 merged 11 commits into
mainfrom
fix-captured-dynamic-control-values
Oct 21, 2026
Merged

JerryChen97 merged 11 commits into
mainfrom
fix-captured-dynamic-control-values

Conversation

@JerryChen97

Copy link
Copy Markdown
Contributor

Fixes captured qp.ctrl callables with mixed static and runtime Boolean control values. The interpreter reads control values after the control wires, and lowering passes them to the existing SSA ctrlvals.

Requires PennyLaneAI/pennylane#10356. The new operand layout also applies to static controls, so the two changes need coordinated merging and compatible dependency versions. This overlaps #3366's work_wire_type changes.

Validation:

  • 21 targeted Catalyst tests passed with the matching PennyLane patch, including all four reported cases for both Boolean inputs against default.qubit.
  • SSA FileCheck passed, including existing static-control checks.
  • Formatting passed; Pylint has no new findings.

Local execution used native artifacts from aa5eb08a7. The branch is now based on 631b95e4a; the Python patch is unchanged, but the newer native passes were not rebuilt locally.

[sc-133997]

Assisted by Codex. WIP; human review is in progress.

@JerryChen97 JerryChen97 added the wip PRs that are a Work-In-Progress label Oct 20, 2026
@JerryChen97

Copy link
Copy Markdown
Contributor Author

Need PennyLaneAI/pennylane#10356 to get in first

Comment thread frontend/test/lit/test_qref/test_flat_circuits.py Outdated
Comment thread frontend/test/pytest/from_plxpr/test_capture_integration.py Outdated
@paul0403

Copy link
Copy Markdown
Member

Remember to bump PL version tomorrow! @JerryChen97 I'll approve then after CI is green

@JerryChen97 JerryChen97 self-assigned this Oct 21, 2026
@JerryChen97

Copy link
Copy Markdown
Contributor Author

Not sure how much we care about non-boolean, but let me prepare one more fix to simply bool(v) if concrete 😓 @paul0403

@paul0403

Copy link
Copy Markdown
Member

Not sure how much we care about non-boolean, but let me prepare one more fix to simply bool(v) if concrete 😓 @paul0403

You mean one more fix in PL?

@JerryChen97

Copy link
Copy Markdown
Contributor Author

Not sure how much we care about non-boolean, but let me prepare one more fix to simply bool(v) if concrete 😓 @paul0403

You mean one more fix in PL?

Yes. But actually I do suggest remove such tests from Catalyst. If it's in Pennylane things will be much easier....

@paul0403

Copy link
Copy Markdown
Member

Not sure how much we care about non-boolean, but let me prepare one more fix to simply bool(v) if concrete 😓 @paul0403

You mean one more fix in PL?

Yes. But actually I do suggest remove such tests from Catalyst. If it's in Pennylane things will be much easier....

Let's just do what the current system does for now I guess

@JerryChen97

Copy link
Copy Markdown
Contributor Author

Not sure how much we care about non-boolean, but let me prepare one more fix to simply bool(v) if concrete 😓 @paul0403

You mean one more fix in PL?

This is the fix needed: https://github.com/PennyLaneAI/pennylane/pull/10367/changes#diff-4d674c6197f96fff76100645d95e27af0e6bddf23dad921ddf5d5150f70b746dL303

Comment thread .dep-versions Outdated
Comment thread doc/requirements.txt Outdated
Co-authored-by: Yushao Chen (Jerry) <chenys13@outlook.com>
@JerryChen97
JerryChen97 requested a review from paul0403 October 21, 2026 17:35
@codecov

codecov Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.15%. Comparing base (8deabe8) to head (641c2c0).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3373   +/-   ##
=======================================
  Coverage   96.14%   96.15%           
=======================================
  Files         177      177           
  Lines       21582    21587    +5     
  Branches     2153     2153           
=======================================
+ Hits        20751    20756    +5     
  Misses        643      643           
  Partials      188      188           

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

@JerryChen97 JerryChen97 changed the title WIP: Support dynamic control values in captured qp.ctrl Support dynamic control values in captured qp.ctrl Oct 21, 2026
@JerryChen97 JerryChen97 added review ready and removed wip PRs that are a Work-In-Progress labels Oct 21, 2026
Comment thread frontend/test/pytest/from_plxpr/test_capture_integration.py Outdated
Comment thread frontend/test/pytest/from_plxpr/test_capture_integration.py
@JerryChen97
JerryChen97 requested a review from paul0403 October 21, 2026 18:57
@JerryChen97
JerryChen97 merged commit 8cbbea2 into main Oct 21, 2026
38 checks passed
@JerryChen97
JerryChen97 deleted the fix-captured-dynamic-control-values branch October 21, 2026 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants