catalyst icon indicating copy to clipboard operation
catalyst copied to clipboard

Failure to qjit two workflows transformed by `clifford_t_decomposition` and gridsynth when using AOT capture

Open albi3ro opened this issue 1 month ago • 3 comments

@qml.qjit()
@partial(qml.transforms.clifford_t_decomposition, method="gridsynth")
@qml.qnode(qml.device('lightning.qubit', wires=1))
def c():
    qml.H(0)
    #qml.RZ(x, 0)
    qml.RZ(0.5, 0)
    return qml.expval(qml.X(0))

@qml.qjit()
@partial(qml.transforms.clifford_t_decomposition, method="gridsynth")
@qml.qnode(qml.device('lightning.qubit', wires=1))
def c2(x):
    qml.RZ(x, 0)
    return qml.expval(qml.X(0))

c2(0.5)

If one qnode with AOT capture transformed by clifford_t_decomposition with grid_synth has already been defined, another new qnode transformed by the same transform cannot be compiled.

This does not happen if the first qjit object is captured on the first call. It does not matter if the second workflow is AOT or lazily captured.

While it looks like method="sk" is causing concretization problems with parametrized inputs, it does not cause failures with AOT capture.

This is mostly just really weird.

albi3ro avatar Oct 16 '25 15:10 albi3ro