NVIDIA/cuda-quantum

Compiler doesn't raise an error when using kernel.h(q[0])

poojarao8 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

In the code snippet below, the compiler doesn't raise an error for kernel.h(q[0]). Even though no error is raised, this operation doesn't seem to be get executed.

Steps to reproduce the bug

import cudaq

cudaq.set_target("nvidia")

@cudaq.kernel
def test_state(N: int):
    q = cudaq.qvector(N)
    kernel.h(q[0])

counts = cudaq.sample(test_state, 10)
counts.dump()

Output is: { 0000000000:1000 }

Expected behavior

It should raise an error.

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

Not a regression

Environment

  • CUDA Quantum version:
  • Python version:
  • C++ compiler:
  • Operating system:

Suggestions

No response