NVIDIA/cuda-quantum

reset of qubit in kernel mode is giving error

marwafar opened this issue · 0 comments

Required prerequisites

  • Consult the security policy. If reporting a security vulnerability, do not report the bug using this form. Use the process described in the policy to report the issue.
  • Make sure you've read the documentation. Your issue may be addressed there.
  • Search the issue tracker to verify that this hasn't already been reported. +1 or comment there if it has.
  • If possible, make a PR with a failing test to give us a starting point to work on!

Describe the bug

When running this code snippet from the doc

@cudaq.kernel()
def kernel():
   q = cudaq.qubit()
   h(q)
   reg1 = mz(q)
   reset(q)
   x(q)

cudaq.sample(kernel).dump()

It gives this error

cudaq.kernel.ast_bridge.CompilerError: reset.py:8: error: unhandled function call - reset, known kernels are dict_keys([]) (offending source -> reset(q))

However, when commenting reset, it works and give the expected answer.

Steps to reproduce the bug

@cudaq.kernel()
def kernel():
   q = cudaq.qubit()
   h(q)
   reg1 = mz(q)
   reset(q)
   x(q)

cudaq.sample(kernel).dump()

Expected behavior

It should reset the qubit and print
{
global : { 1:1000 }
reg1 : { 0:501 1:499 }
}

Is this a regression? If it is, put the last known working version (or commit) here.

Not a regression

Environment

  • CUDA Quantum version: latest (May 6)
  • Python version: python 3
  • C++ compiler:
  • Operating system:

Suggestions

No response