Skip to content

Conversation

@paul0403
Copy link
Member

@paul0403 paul0403 commented Dec 11, 2025

Context:
Some decomposition test cases have been disabled previously due to incompatibility with the new qml.PauliRot lowering rules. With the new implementation and fixes in #2284, we try re-enabling the test cases, but encounter various issues in the frontend pytest and lit tests.

Currently, 5 pytests in pytest/from_plxpr/test_decompose_transform.py and 2 lit tests in lit/test_decomposition.py still fail.

Benefits: Reenabling tests that shouldn't have been skipped.

Related GitHub Issues:
#2284
PennyLaneAI/pennylane#8765

@qml.qnode(qml.device("lightning.qubit", wires=2))
# SKIP-CHECK-DAG: %0 = transform.apply_registered_pass "decompose-lowering"
# SKIP-CHECK{LITERAL}: func.func public @circuit_17() -> tensor<f64> attributes {decompose_gatesets
def circuit_17():
Copy link
Member Author

Choose a reason for hiding this comment

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

This test somehow is flaky, in the sense that the graph decomp solution is not deterministic. Sometimes it contains a ppr op (despite ppr not being in the target gate set).

Copy link
Member Author

Choose a reason for hiding this comment

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

@qml.qnode(qml.device("lightning.qubit", wires=4))
# SKIP-CHECK: %0 = transform.apply_registered_pass "decompose-lowering"
# SKIP-CHECK: func.func public @circuit_18(%arg0: tensor<3xf64>) -> tensor<f64> attributes {decompose_gatesets
def circuit_18():
Copy link
Member Author

Choose a reason for hiding this comment

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

ditto

@PennyLaneAI PennyLaneAI deleted a comment from codecov bot Dec 11, 2025
@PennyLaneAI PennyLaneAI deleted a comment from github-actions bot Dec 11, 2025
@github-actions
Copy link
Contributor

Hello. You may have forgotten to update the changelog!
Please edit doc/releases/changelog-dev.md on your branch with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

resources = qml.specs(with_qjit, level="device")()["resources"].gate_types
assert resources == expected_resources

@pytest.mark.xfail(
Copy link
Member Author

Choose a reason for hiding this comment

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

Note that there are 5 other tests in this file skipped to push out jax update, due to the same paulirot issue.

Copy link
Member Author

Choose a reason for hiding this comment

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

The remaining 5 pytests fail with the following error inside --decompose-lowering pass:

circuit_18_1/1_QuantumCompilationStage/1_SplitMultipleTapesPass.mlir:322:25: error: 'tensor.from_elements' op failed to verify that operand types match result element type
      %out_qubits_9:2 = quantum.multirz(%extracted_8) %8, %9 : !quantum.bit, !quantum.bit
                        ^
circuit_18_1/1_QuantumCompilationStage/1_SplitMultipleTapesPass.mlir:322:25: note: see current operation: %21 = "tensor.from_elements"(%17, %18) : (i64, i64) -> tensor<1xi64>

Apparantly multirz had some issues, and the new pauli rot rule is the first rule that contains a multirz in the body so this was never hit.

Copy link
Member Author

@paul0403 paul0403 Dec 11, 2025

Choose a reason for hiding this comment

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

Actually no, here's the list of their corresponding errors for the 5 remaining skipped pytests (all were passing as of the previous stable release):

  • test_ftqc_rotxzx: pennylane has no module named ftqc
  • test_multi_qubits: aforementioned tensor.from_elements error
  • test_adjoint: ValueError: Could not capture _OperatorNode(op=TemporaryAND, num_work_wire_not_available=1, work_wire_dependent=False, min_work_wires=0) without the number of wires.. After adding "TemporaryAND", "ChangeOpBasis", "Prod" to the special list (@lazypanda10117 ), we discovered that the root cause is still the aforementioned tensor.from_elements error
  • test_ctrl: aforementioned tensor.from_elements error
  • test_template_qft: aforementioned tensor.from_elements error

@lazypanda10117 lazypanda10117 changed the base branch from main to lazypanda10117/two-stage-pauli-rot-lowering December 16, 2025 15:11
@lazypanda10117 lazypanda10117 changed the base branch from lazypanda10117/two-stage-pauli-rot-lowering to main December 16, 2025 16:48
@lazypanda10117 lazypanda10117 self-requested a review December 16, 2025 16:56
@paul0403
Copy link
Member Author

closing in favor of #2326

@paul0403 paul0403 closed this Dec 29, 2025
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