Skip to content

Fixing PPR decomposition in qml.transforms.decompose#2803

Open
lazypanda10117 wants to merge 13 commits into
mainfrom
lazypanda10117/ppr-bug-fix
Open

Fixing PPR decomposition in qml.transforms.decompose#2803
lazypanda10117 wants to merge 13 commits into
mainfrom
lazypanda10117/ppr-bug-fix

Conversation

@lazypanda10117
Copy link
Copy Markdown
Member

@lazypanda10117 lazypanda10117 commented May 6, 2026

Adding support for decomposing PauliRot using the (python-based) graph decomposition system. Previously, the following example would not work, leaving the PauliRot op unchanged in the IR.

qp.capture.enable()
qp.decomposition.enable_graph()

@qp.qjit(keep_intermediate=2)
@qp.decompose(gate_set=[qml.RZ, qml.MultiRZ, qml.RX, qml.GlobalPhase])
@qp.qnode(qml.device("lightning.qubit", wires=1))
def circuit():
  qp.PauliRot(0.5, pauli_word="X", wires=[0])
  return qp.expval(qml.Z(0))

print(circuit.mlir_opt)

This PR also re-enables skipped tests that previously failed due to PauliRot decomposition.

[[sc-119011]]

@lazypanda10117 lazypanda10117 changed the base branch from main to v0.15.0-rc May 6, 2026 22:03
@lazypanda10117 lazypanda10117 changed the base branch from v0.15.0-rc to main May 6, 2026 22:03
@lazypanda10117 lazypanda10117 force-pushed the lazypanda10117/ppr-bug-fix branch from 625215b to 36d8025 Compare May 6, 2026 22:10
@lazypanda10117 lazypanda10117 requested review from kipawaa, maliasadi and sengthai and removed request for sengthai May 7, 2026 19:06
@lazypanda10117 lazypanda10117 marked this pull request as ready for review May 7, 2026 22:19
@codecov
Copy link
Copy Markdown

codecov Bot commented May 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.95%. Comparing base (139e8f9) to head (a708424).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2803   +/-   ##
=======================================
  Coverage   96.95%   96.95%           
=======================================
  Files         169      169           
  Lines       18875    18884    +9     
  Branches     1799     1801    +2     
=======================================
+ Hits        18300    18309    +9     
  Misses        409      409           
  Partials      166      166           

☔ View full report in Codecov by Sentry.
📢 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.

Copy link
Copy Markdown
Contributor

@kipawaa kipawaa left a comment

Choose a reason for hiding this comment

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

Great to see this support added! It looks good, I'd just like to see a couple more tests

Comment thread mlir/lib/Quantum/Transforms/decompose_lowering.cpp
Comment thread mlir/lib/Quantum/Transforms/DecomposeLoweringPatterns.cpp
Comment thread frontend/test/lit/test_decomposition.py
Comment thread frontend/test/lit/test_decomposition.py
@maliasadi
Copy link
Copy Markdown
Member

@lazypanda10117 please create a PR targeting the rc branch to raise an error 🐛

Copy link
Copy Markdown
Contributor

@kipawaa kipawaa left a comment

Choose a reason for hiding this comment

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

Great, thank you!

@lazypanda10117 lazypanda10117 requested a review from a team May 14, 2026 18:37
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.

3 participants