Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QuakeSynthesizer cannot handle std::vector<char> argument type #1384

Closed
3 of 4 tasks
1tnguyen opened this issue Mar 13, 2024 · 1 comment · Fixed by #1395
Closed
3 of 4 tasks

QuakeSynthesizer cannot handle std::vector<char> argument type #1384

1tnguyen opened this issue Mar 13, 2024 · 1 comment · Fixed by #1395
Assignees

Comments

@1tnguyen
Copy link
Collaborator

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 there is a kernel argument of type std::vector<char>, QuakeSynthesizer couldn't perform the synthesis. This affects the hardware backends and remote backends (nvqc).

Steps to reproduce the bug

#include <cudaq.h>
void f(const std::vector<char>& k) __qpu__ {
  cudaq::qubit q;
  for (int i = 0; i < k.size(); ++i)
    rx(1.0*k[i], q);
}

int main() {
  std::vector<char> x { 1, 2};  
  auto counts = cudaq::sample(f, x);
  counts.dump();
  return 0;
}

Run with:

nvq++ --target quantinuum --emulate test.cpp
./a.out

Error:

loc("test.cpp":2:1): error: 'func.func' op synthesis failed for vector<integral-type>.
loc("test.cpp":2:1): error: argument(s) still in use after synthesis.
terminate called after throwing an instance of 'std::runtime_error'
  what():  Could not successfully apply quake-synth.
Aborted (core dumped)

Expected behavior

Successful synthesis.

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

Not a regression

Environment

  • CUDA Quantum version: main
  • Python version: 3.10
  • C++ compiler: gcc-12
  • Operating system: Ubuntu22.04

Suggestions

No response

@schweitzpgi
Copy link
Collaborator

FWIW, this isn't really a valid kernel signature. The vector must be pass by value according to the spec.

void f(const std::vector<char>& k) __qpu__ { // error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants