qir-alliance / qcor

C++ compiler for heterogeneous quantum-classical computing built on Clang and XACC
http://docs.aide-qc.org
MIT License
97 stars 39 forks source link

QPU Lambdas need to be able to use __qpu__ kernels #136

Open 1tnguyen opened 3 years ago

1tnguyen commented 3 years ago

Ideally, users wouldn't need to capture but can just use these kernels, e.g. from an included header file, etc.

divshacker commented 2 years ago

Hello, Please tell me how to proceed with this?

1tnguyen commented 2 years ago

I'd suggest that you take a look at the _qpu_lambda class implementation in https://github.com/qir-alliance/qcor/blob/master/runtime/kernel/quantum_kernel.hpp first. It is quite a complicated class, involving the JIT engine (QJIT). The feature mentioned in this task is to find a way to inject other kernels (e.g., defined as standalone __qpu__ kernels) into the JIT compilation context of the _qpu_lambda.

We don't have a solution for this yet. So please feel free to propose an implementation.