Show Your Support: Have you heard of Phoronix Premium? It's what complements advertisements on this site for our premium ad-free service. For less than $4 USD per month, you can help support our site while the funds generated allow us to keep doing Linux hardware reviews, performance benchmarking, maintain our community forums, and much more.
LLVM's HIPSPV Coming Together For AMD HIP To SPIR-V For OpenCL Execution
HIPSPV is quite interesting for being able to leverage AMD HIP in non-AMD environments or even potentially using say Mesa's Clover OpenCL driver for HIP kernels rather than being bound to the AMD ROCm stack for HIP that doesn't always play well on all Linux distributions and has a limited scope of Radeon GPU support.
How well HIPSPV will work in practice and how robust the support will mature to for taking HIP to SPIR-V kernels remains to be seen, but given that HIP has been about being able to take original CUDA code and HIP'ify it to get it running elsewhere, if HIPSPV works well it could really be a big deal for opening up the access even more.
Tampere University of Technology has been working on this HIPSPV back-end for going to SPIR-V rather than ROCm's HIP approach of going through the LLVM AMDGPU shader back-end. The developers involved with this effort are currently focused on Intel GPU execution with the Intel Compute-Runtime OpenCL / Level Zero stack.
Since originally writing about HIPSPV for throwing light on this project, the actual HIPSPV toolchain has now been merged into upstream LLVM. The HIPSPVToolChain allows for emitting HIP device code as a SPIR-V binary. Currently this toolchain relies on the external SPIRV-LLVM-Translator but as previously covered an LLVM SPIR-V proper back-end is nearing upstream too. Meanwhile merged today is this patch enabling the actual SPIR-V emission for HIP. The code also adds a "--offload" option for being able to specify the offload target -- including adding a new "generic" target.
The fourth and final patch of the series is still pending but looking like it too will be merged shortly and that is adding an option to LLC for emitting SPIR-V.
This initial HIPSPV support will be found in LLVM 14.0 due out around March of 2022 and at that point we'll see how well the support has matured for being practical and useful for more GPUs/drivers.