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
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
It seems like cudaq-quake fails to translate calls to cudaq::compute_action to quake, when the action operand contains a for loop. The following code example demonstrates this:
#include<cudaq.h>structentry {
autooperator()() __qpu__ {
cudaq::qubit p;
cudaq::qubit q;
cudaq::compute_action(
[&]() { x(p); },
[&]() {
for (size_t i = 0; i < 1; ++i) { y(q); }
});
}
};
intmain() {
auto counts = cudaq::sample(entry{});
counts.dump();
return0;
}
Actually having quantum logic in the code is not needed, the following also fails:
#include<cudaq.h>structentry {
autooperator()() __qpu__ {
cudaq::compute_action(
[&]() { },
[&]() {
for (size_t i = 0; i < 1; ++i) { }
});
}
};
intmain() {
auto counts = cudaq::sample(entry{});
counts.dump();
return0;
}
Running the command cudaq-quake --emit-llvm-file a.cpp fails with the following error: error: 'quake.compute_action' op operand #0 must be Proxy for a C++ callable instance in cc, but got 'i64'
When inspecting the quake code, it seems like the quake.compute_action doesn't access the correct argument, but instead if accesses the result of the addition from the loop step.
Steps to reproduce the bug
Create a file called a.cpp with the following content:
#include<cudaq.h>structentry {
autooperator()() __qpu__ {
cudaq::qubit p;
cudaq::qubit q;
cudaq::compute_action(
[&]() { x(p); },
[&]() {
for (size_t i = 0; i < 1; ++i) { y(q); }
});
}
};
intmain() {
auto counts = cudaq::sample(entry{});
counts.dump();
return0;
}
Try to run cudaq-quake --emit-llvm-file a.cpp
Expected behavior
The command should succeed and an appropriate quake file should be created
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
The text was updated successfully, but these errors were encountered:
Required prerequisites
Describe the bug
It seems like cudaq-quake fails to translate calls to
cudaq::compute_action
to quake, when the action operand contains a for loop. The following code example demonstrates this:Actually having quantum logic in the code is not needed, the following also fails:
Running the command
cudaq-quake --emit-llvm-file a.cpp
fails with the following error:error: 'quake.compute_action' op operand #0 must be Proxy for a C++ callable instance in cc, but got 'i64'
When inspecting the quake code, it seems like the
quake.compute_action
doesn't access the correct argument, but instead if accesses the result of the addition from the loop step.Steps to reproduce the bug
cudaq-quake --emit-llvm-file a.cpp
Expected behavior
The command should succeed and an appropriate quake file should be created
Is this a regression? If it is, put the last known working version (or commit) here.
Not a regression
Environment
Suggestions
No response
The text was updated successfully, but these errors were encountered: