š `qjit` capture skips measurement diagonalization for devices that only support PauliZ
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 68/100
Research direction
Start by reading the measurement compilation path that invokes diagonalize_measurements and how qjit handles device observable capabilities. Reproduce the issue with the supplied one wire lightning.qubit example and inspect the QuantumCompilationStage IR. Done means the unsupported PauliX observable is converted to a supported PauliZ measurement with a Hadamard, and the assertion passes.
Written by the indexing model from the issue text.
Description
When a device supports Hadamard gates but can only measure PauliZ, Iād expect qp.expval(qp.X(0)) to compile to a Hadamard followed by a PauliZ measurement. With capture enabled, qjit warns that it skips diagonalize_measurements and emits a PauliX measurement that the device cannot execute.
This reproduces on PennyLane 2.0.0.dev3 and Catalyst 0.16.0.dev162 by restricting the observables that lightning.qubit advertises to qjit:
from dataclasses import replace
import pennylane2 as qp
from catalyst.debug import get_compilation_stage
dev = qp.device("lightning.qubit", wires=1)
dev.qjit_capabilities = replace(
dev.capabilities, observables={"PauliZ": dev.capabilities.observables["PauliZ"]}
)
@qp.qjit(keep_intermediate=True)
@qp.qnode(dev)
def circuit():
return qp.expval(qp.X(0))
ir = get_compilation_stage(circuit, "QuantumCompilationStage")
assert "PauliX" not in ir
The assertion fails. The compiled program still contains %2 = quantum.namedobs %1[ PauliX] : !quantum.obs.
- Dominant language
- Python
- Stars
- 234
- Forks
- 84
- Avg merge
- 3d 11h
- Merged PRs (30d)
- 78
Getting set up
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up ā it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from PennyLaneAI/catalyst
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
PennyLaneAI/catalyst#3489 Ā·
Maintainers usually reply within 1 day
-
Fix platform tag for macOS wheelsMay be free again @sarehaskari17 claimed this 107 days ago, and no pull request is open. OpenCI/Build enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
PennyLaneAI/catalyst#2907 Ā· 2 comments Ā·
Maintainers usually reply within 1 day
-
The docs page for `CompileOptions` is missing a description for the `target` attributePossibly taken @daxsh2803 claimed this 68 days ago. Opendocumentation
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
PennyLaneAI/catalyst#2653 Ā·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 57/100
PennyLaneAI/catalyst#3497 Ā·
Maintainers usually reply within 1 day
-
Bug: `create_encode_subroutine` omits the Z correction, so `qecl.encode ["zero"]` does not prepare the logical zero statePossibly taken @pragati903 claimed this 18 days ago. Openbug good first issue
PennyLaneAI/catalyst#3492 Ā· 1 assignee Ā·
Maintainers usually reply within 1 day
All issues in PennyLaneAI/catalyst
Similar issues
-
auto-reported bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
stix-atlas.json: the same relationship id is used for several different mitigates relationshipsOpen
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
backend bug
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
nolte/kamerplanter#3193 Ā·
Maintainers usually reply within 1 day
-
soup prune-prompt exits 1 after writing its output on a file over 100,000 rows, and reports a capped row count otherwisePossibly taken @abdulwaarith0 claimed this today. Openneeds-triage
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
MakazhanAlpamys/Soup#3690 Ā· 1 comment Ā·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day