You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
nvq++ correctly compiles a quantum kernel with a std::vector parameter. However, if this std::vector is then passed to another kernel inside the original one, compilation fails.
Steps to reproduce the bug
Create vect.cpp:
#include<cudaq.h>
#include<vector>
__qpu__ voidApplyMaskedX(cudaq::qview<> qc, std::vector<int> mask)
{
int s = qc.size();
for (int i = 0; i < s; i++)
{
if (mask[i] == 1)
{
x(qc[i]);
}
}
}
structRunKernel
{
__qpu__ autooperator()(std::vector<int> mask)
{
cudaq::qvector qc(mask.size());
ApplyMaskedX(qc, mask);
mz(qc);
}
};
intmain()
{
std::vector<int> mask = {1, 0, 1, 0, 0};
auto res = cudaq::sample(1000, RunKernel{}, mask);
res.dump();
}
Compile it:
$ nvq++ vect.cpp
loc("vect.cpp":21:26):error: /cuda-quantum/lib/Frontend/nvqpp/ConvertExpr.cpp:2950: not yet implemented: C++ constructor (non-default)
vect.cpp:21:26: error: C++ constructor (non-default) is not yet supported
ApplyMaskedX(qc, mask);
^
The code compiles and runs if the innermost kernel is inlined inside the outer one as follows:
// includes...structRunKernel
{
__qpu__ autooperator()(std::vector<int> mask)
{
cudaq::qvector qc(mask.size());
int s = qc.size();
for (int i = 0; i < s; i++)
{
if (mask[i] == 1)
{
x(qc[i]);
}
}
mz(qc);
}
};
// main...
Expected behavior
I expect to be able to pass outer std::vector parameters to sub-kernels to write composable functions.
Is this a regression? If it is, put the last known working version (or commit) here.
0.9.0
Environment
CUDA-Q version: 0.9.1 (pre-built binaries and cu12-0.9.1 Docker image)
Operating system: Ubuntu 22.04.5 LTS
Suggestions
No response
The text was updated successfully, but these errors were encountered:
Required prerequisites
Describe the bug
nvq++
correctly compiles a quantum kernel with astd::vector
parameter. However, if thisstd::vector
is then passed to another kernel inside the original one, compilation fails.Steps to reproduce the bug
Create
vect.cpp
:Compile it:
The code compiles and runs if the innermost kernel is inlined inside the outer one as follows:
Expected behavior
I expect to be able to pass outer
std::vector
parameters to sub-kernels to write composable functions.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: