Closed paul0403 closed 1 week ago
A minimal frontend example to reproduce this error (as of main branch https://github.com/PennyLaneAI/catalyst/commit/b405fbbfc68c955a9e16263e6245b3c732a2de83):
dev = qml.device("lightning.qubit", wires=2)
@qml.qnode(dev)
def f():
qml.StatePrep(
np.array([complex(1, 0), complex(0, 0), complex(0, 0), complex(0, 0)]),
wires=[0, 1],
)
return qml.probs()
@qml.qnode(dev)
def g():
qml.StatePrep(
np.array([complex(1, 0), complex(0, 0), complex(0, 0), complex(0, 0)]),
wires=[0, 1],
)
return qml.probs()
@qjit
def main():
return f(), g()
main()
malloc(): unaligned tcache chunk detected
Quick note: this is an mlir issue and not a jax issue so I know this wouldn't help, but I checked it anyway, and swapping out jax.numpy.array
for np.array
results in the same error.
The following mlir has multiple functions using set_state on the same device shared object file and it crashes:
However, if we do one of the two following, then there won't be a crash:
cp librtd_lightning.so librtd_lightning_1.so && cp librtd_lightning.so librtd_lightning_2.so
, and use these copies inquantum.device
remove all the
quantum.set_state
, i.e.