NVIDIA / cuda-quantum

C++ and Python support for the CUDA Quantum programming model for heterogeneous quantum-classical workflows
https://nvidia.github.io/cuda-quantum/
Other
566 stars 192 forks source link

Compiler fails to synthesize nested vector parameters #2001

Open bmhowe23 opened 4 months ago

bmhowe23 commented 4 months ago

Required prerequisites

Describe the bug

https://nvidia.github.io/cuda-quantum/latest/using/backends/platform.html#supported-kernel-arguments says that nested vectors (at least singly nested vectors like vector<vector<int>>) should be supported, but that only works in Remote MQPU library mode. Compiling with --enable-mlir causes the run to fail with an error message: error: 'func.func' op synthesis: unsupported argument type.

Note that running on NVQC implicitly enables MLIR mode, so this bug means that nested vector parameters do not work with NVQC.

Steps to reproduce the bug

This can already be seen with an example in the repo:

$ nvq++ --enable-mlir --target remote-mqpu --remote-mqpu-url localhost:3030 targettests/Remote-Sim/nested_vectors.cpp
$ ./a.out
loc("nested_vectors.cpp":17:3): error: 'func.func' op synthesis: unsupported argument type
terminate called after throwing an instance of 'std::runtime_error'
  what():  Could not successfully apply quake-synth.
Aborted

Expected behavior

The above example should run without issues, similar to when running without --enable-mlir.

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

Not a regression

Environment

Suggestions

No response

bmhowe23 commented 4 months ago

Note: https://github.com/NVIDIA/cuda-quantum/issues/1809 is similar to this issue, but it is not the same. That issue is probably unique to Python, and the example given in that issue does not require synthesis to run.