Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Async runtime fails to go back to sane state after exception #1451

Open
erick-xanadu opened this issue Jan 13, 2025 · 0 comments
Open

Async runtime fails to go back to sane state after exception #1451

erick-xanadu opened this issue Jan 13, 2025 · 0 comments

Comments

@erick-xanadu
Copy link
Contributor

erick-xanadu commented Jan 13, 2025

Issue description

  • Expected behavior: After executing a qnode which raises an exception, it is expected that executing a second qnode will have a fresh environment.

  • Actual behavior: Something is not being reset correctly when raising an exception. This can be easily verified by running the async tests for exceptions before running the async tests that succeed. If the order changes, some tests which are expected to succeed will raise an error.

  • Reproduces how often: 100%

import pennylane as qml

@qml.qjit(async_qnodes=True)
@qml.qnode(qml.device("lightning.qubit", wires=2))
def foo(a, b):
  qml.CNOT(wires=[a, b])
  return qml.state()

print(foo(0, 1)) # Different wires, async shouldn't happen.

try:
  foo(0, 0) # Same wires, will result in an exception
except:
  ...


print(foo(0, 1)) # Different wires, async shouldn't happen.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant