2

Using clang, I am able to compile OpenCL-C++ kernels (using clang -c). I am trying to load these compiled kernels into my OpenCL application, but am at a loss how to achieve that. I am using Ubuntu 22.04, with an Intel CPU and an Nvidia GPU. The GPU unfortunately does not support SPIR-V injection via clCreateProgramWithIL - if it did, I would happily take that route. I also cannot use clCreateProgamWithSource, because that unfortunately does not support C++ features inside the kernels.

Is there any way I can compile OpenCL-C++ kernels using clang and then load them into my OpenCL application? Or is there a way I can still use clCreateProgramWithSource with C++ features inside the kernels, maybe? Either way would work well! (There has been a similar question here but focusing on macOS, which has its own OpenCL implementation and compiler, as far as I know.)

4
  • Does this answer your question: stackoverflow.com/questions/73179473/… ? Commented Jan 17, 2023 at 23:17
  • Yes, that does help, thank you so much! I have yet to encounter a device that actually supports cl_ext_cxx_for_opencl but in the meantime I was able to go the SPIR-V route and managed to load C++ OpenCL kernels into my application going that little detour. Commented Jan 18, 2023 at 13:27
  • @mikulcak Can you share how you managed to get spirv to run on nvidia gpu, please? Commented Jul 9, 2023 at 21:54
  • That's not possible, unfortunately. The Nvidia implementation of the OpenCL standard does not support that particular extension. I ended up running the SPIR-V kernels on the integrated graphics on my Intel CPU. Commented Jul 11, 2023 at 9:02

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.