Depth calculation can be improved
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 15/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Ferma
- Stack tecnologico
- python
- Ambito
- compilers, quantum-computing
Direzione di ricerca
Start with the linked Catalyst pull request #3426 and PennyLane pull request #10440; both contain candidate implementations, and the issue says they are large and AI-generated. Check the proposed dependency summaries against the two examples, especially the expected depths of 100 and 44, then review the stated platform, version, and workload coverage gaps. The issue considers the work done when the metric semantics and analysis cost have been reviewed and integration coverage is added.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
The PBC resource analysis can overestimate circuit depth. In particular, adding subroutine depths can incorrectly serialize operations on independent qubits. To unlock my work, I have created two branches that potentially solve this issue (AI generated, very big PR 😅). I'm sharing the details in case this is useful.
- Catalyst implementation: https://github.com/PennyLaneAI/catalyst/pull/3426
- PennyLane integration: https://github.com/PennyLaneAI/pennylane/pull/10440
Example 1: Independent sequences on two qubits
import pennylane as qp
from catalyst import qjit
from catalyst.passes import to_ppr
@qjit(
target="mlir",
pipelines=[("pipe", ["quantum-compilation-stage"])],
)
@to_ppr
@qp.qnode(qp.device("lightning.qubit", wires=2))
def circuit():
for _ in range(100):
qp.T(0)
for _ in range(100):
qp.T(1)
resources = qp.analyze(circuit, level=1)().resources
print(resources.qubit_disjoint_depth)
For the sequence of 100 gates on each wire, the expected qubit-disjoint depth is 100, rather than 200.
Each qubit has 100 sequential operations, but the two sequences are independent and can occupy the same 100 logical layers. Their order in the Python source does not introduce a quantum dependency between the wires.
Example 2: Deterministic synthesis
The same principle should apply when the independent sequences are generated by synthesis.
import numpy as np
import pennylane as qp
from catalyst import qjit
from catalyst.passes import to_ppr
PBC = {
"PPR_8": 100,
"PPR_4": 10,
"PPR_2": 1,
"GlobalPhase": 0,
"PauliMeasure": 2,
"PauliMeasureMP": 2,
"MidMeasure": 2,
"MidMeasureMP": 2,
"MidCircuitMeasure": 2,
}
epsilon = 1e-4
syllables_per_rz = 0.58 * np.log2(1 / epsilon) + 3.7
PBC_RZ = PBC | {"RZ": 110 * syllables_per_rz}
@qjit(
capture=True,
target="mlir",
pipelines=[("pipe", ["quantum-compilation-stage"])],
)
@to_ppr
@qp.transforms.gridsynth(
method="deterministic",
epsilon=epsilon,
ppr_basis=True,
)
@qp.transform(pass_name="symbol-dce")
@qp.decompose(gate_set=PBC_RZ)
@qp.qnode(qp.device("null.qubit", wires=2))
def circuit():
qp.RX(0.2, wires=0)
qp.RY(0.2, wires=1)
resources = qp.analyze(circuit, level="user")().resources
assert resources.extra["qubit_disjoint_depth_status"] == "exact"
print(resources.qubit_disjoint_depth)
With the tested PR revisions, this prints 44 with status exact. Placing both rotations on the same qubit gives 86, reflecting the additional sequential dependencies.
This example deliberately uses method="deterministic". The original mixed-fallback variant is not covered by this deterministic-depth guarantee.
Proposed solution
Catalyst tracks per-qubit dependencies and composes them across function calls and supported loops. This preserves parallelism between independent operations while respecting dependencies on shared qubits.
The implementation:
- Replaces scalar depth aggregation with dependency summaries.
- Reuses summaries across compatible function calls.
- Composes invariant loop summaries without fully unrolling the loop.
- Resolves supported classical computations when their values determine the quantum dependency graph.
- Supports deterministic PPR synthesis by analyzing the sequence produced by the synthesis runtime.
- Reports
exactwhen the complete logical depth can be determined, andunavailableotherwise.
PennyLane consumes the certified total instead of reconstructing depth by summing child results. Unsupported cases return None with an explicit status. The new path also leaves any_commuting_depth unavailable, since an exact qubit-disjoint schedule does not establish commuting depth.
Larger workflow validation
The tested ODMR configuration reports exact depths of:
to-ppr: 3,034,595,019ppr-to-ppm: 6,046,959,517
These results demonstrate the application of dependency analysis to a larger workflow. They do not establish a compilation-speed improvement.
Scope and tradeoffs
The intended metric is the logical depth of the emitted PBC dependency graph. It measures the parallelism already present in that graph; it does not optimize the circuit or predict physical execution time.
Exact analysis requires additional computation and memory. Dense dependency summaries retain quadratic storage and cubic composition time in the general worst case, although summary reuse improves important repeated patterns.
Resolving classical computations and synthesis also introduces integration and maintenance requirements. Unknown inputs, unsupported control flow, or analysis limits can produce unavailable, so downstream consumers must handle missing depth values explicitly.
Before merging, the implementation should receive integration coverage across supported platforms and PennyLane/Catalyst versions, together with review of the metric's semantics and analysis cost on representative workloads.
- Lingua principale
- Python
- Stelle
- 234
- Fork
- 84
- Merge medio
- 3g 11h
- PR unite (30g)
- 78
Preparare l'ambiente
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di PennyLaneAI/catalyst
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
PennyLaneAI/catalyst#3489 ·
I maintainer di solito rispondono entro 1 giorno
-
Fix platform tag for macOS wheelsForse di nuovo libera @sarehaskari17 l’ha presa 107 giorni fa e non c’è nessuna pull request aperta. ApertaCI/Build enhancement good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
PennyLaneAI/catalyst#2907 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
The docs page for `CompileOptions` is missing a description for the `target` attributeForse già presa @daxsh2803 l’ha presa 68 giorni fa. Apertadocumentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
PennyLaneAI/catalyst#2653 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
PennyLaneAI/catalyst#3550 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 57/100
PennyLaneAI/catalyst#3497 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di PennyLaneAI/catalyst
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
521xueweihan/HelloGitHub#4729 ·
-
auto-reported bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
cliproxy-quota: a tab around a credential email skips own-accounts and paced-accounts matchingApertaneeds-triage type:bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
pollen-robotics/reachy_mini_conversation_app#631 ·
I maintainer di solito rispondono entro 7 giorni
-
stix-atlas.json: the same relationship id is used for several different mitigates relationshipsAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100