Skip to content

Add support for lowering adjoint and control with Operator2#2980

Open
mudit2812 wants to merge 63 commits into
mainfrom
operator2-adj-ctrl
Open

Add support for lowering adjoint and control with Operator2#2980
mudit2812 wants to merge 63 commits into
mainfrom
operator2-adj-ctrl

Conversation

@mudit2812

@mudit2812 mudit2812 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Context:
Follow up for supporting lowering of Operator2

Description of the Change:

  • Add support for translating adjoint and control to Catalyst jaxpr and MLIR.
  • Change the adjoint input of qref/quantum.operator from a property to an attribute.
    • Without this change, adjoint was not able to be lowered. There weren't any errors; the value of adjoint was just not being propagated by the Python binding.

Note to reviewers:
There is currently a bug with qp.ctrl + qp.qjit(capture=True) + Operator2, which is being fixed in this PR: PennyLaneAI/pennylane#9754. Until that is merged, the CI for this PR will keep failing. But, I've confirmed locally that all tests pass when using the PL-side bug fix branch, so I don't think test failures need to block reviews.

Benefits:

Possible Drawbacks:

Related GitHub Issues:

[sc-123426]

@mudit2812 mudit2812 marked this pull request as ready for review June 29, 2026 17:45
Base automatically changed from handle-operator2 to main June 30, 2026 15:21
@mudit2812 mudit2812 force-pushed the operator2-adj-ctrl branch from 7425779 to 592b2a9 Compare June 30, 2026 18:13
Base automatically changed from operator2-custom-op to main July 2, 2026 20:24
@mudit2812 mudit2812 requested review from albi3ro and kipawaa July 3, 2026 16:02
Comment thread frontend/catalyst/from_plxpr/qref_operator2_primitives.py Outdated
Comment thread frontend/test/lit/test_operator.py Outdated
@codecov

codecov Bot commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.96%. Comparing base (d99fa8e) to head (341f314).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2980      +/-   ##
==========================================
- Coverage   96.96%   96.96%   -0.01%     
==========================================
  Files         167      167              
  Lines       19349    19346       -3     
  Branches     1799     1801       +2     
==========================================
- Hits        18761    18758       -3     
  Misses        433      433              
  Partials      155      155              

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

@mudit2812 mudit2812 requested a review from albi3ro July 6, 2026 16:04
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.

2 participants