Compile error when using cudaq::adjoint
on quantum kernels with non-trivial for
loop conditions
#2536
Open
3 of 4 tasks
Required prerequisites
Describe the bug
cudaq::adjoint
works when the specified kernel contains a trivial loop condition (i.e. a numeric variable). However,nvq++
does not compile the code when the loop conditions contains arithmetic expressions (e.g. variable + 1) or function/method calls (e.g.qview.size()
). The issue appears to be present in version 0.9.1 but not 0.9.0.Steps to reproduce the bug
Create
adj.cpp
:Compile it:
The same error can be obtained by using the qview size as the loop condition:
No error appears when using a simpler loop condition, such as
i < size
.On another note, transforming the
for
loop into awhile
loop results in another error:Expected behavior
I expect to be able to use loop conditions more complex than a plain variable comparison. This is handy when applying multi-qubit gates over a qvector, such as when creating the GHZ state, that is defined in the examples as follows:
Is this a regression? If it is, put the last known working version (or commit) here.
0.9.0
Environment
cu12-0.9.1
Docker image)Suggestions
No response
The text was updated successfully, but these errors were encountered: