Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to compile OpenCL Kernels to SPIR-V using Clang

I need compile OpenCL kernels in SPIR-V to use with Vulkan, I tried with Google CLSPV https://github.com/google/clspv, but the problem occur with vectorization, functions like vload8 doesn't work. So I need compile OpenCL kernels in SPIR-V using clang.

like image 691
Alex Avatar asked Dec 23 '22 04:12

Alex


2 Answers

I'm the project lead for Clspv. Jesse is right overall.

The lack of support for vectors of length 8 and 16 is deliberately out of scope for now.
That's because Vulkan itself does not support that.
We haven't added the support to mimic such support, and don't have plans to do so even in the medium term.
There is more info on an old closed issue:
https://github.com/google/clspv/issues/8

like image 139
David Neto Avatar answered Jan 05 '23 16:01

David Neto


Clspv is the only toolchain I'm aware of that compiles OpenCL C to Vulkan-compatible SPIR-V. You'll need to file an issue against Clspv; attaching a kernel that fails to compile properly would help a lot.

like image 35
Jesse Hall Avatar answered Jan 05 '23 16:01

Jesse Hall