Controlled pauli rot crashes with capture

Open
#2,681 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
52/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
python
Domain
compilers

Research direction

Start by running the reported qml.qjit(capture=True) reproducer with qml.ctrl(qml.PauliRot(...)) on lightning.qubit, then compare it with the stated working variants without capture or control. Trace the capture compilation path around the MLIR dialect-conversion failure and add a regression test showing that the controlled Pauli rotation compiles and runs without crashing.

Written by the indexing model from the issue text.

Description

bug

Controlled pauli rot crashes with capture:

@qml.qjit(capture=True)
@qml.qnode(qml.device('lightning.qubit', wires=3))
def aloha(i: int):
    qml.ctrl(qml.PauliRot(0.1, ["Z", "X"],wires=[1, 2]), control=0)
    return qml.probs()

print(aloha(0))
catalyst.utils.exceptions.CompileError: catalyst failed with error code -6: catalyst: /home/paul.wang/catalyst_new/catalyst/mlir/llvm-project/mlir/lib/Transforms/Utils/DialectConversion.cpp:2159: 
virtual void mlir::ConversionPatternRewriter::replaceOp(mlir::Operation *, mlir::ValueRange): Assertion `op->getNumResults() == newValues.size() && "incorrect # of replacement values"' failed.

Works fine without capture, or without control

Dominant language
Python
Stars
234
Forks
84
Avg merge
3d 11h
Merged PRs (30d)
78

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from PennyLaneAI/catalyst

All issues in PennyLaneAI/catalyst

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.