LLVM Working On "HIPSPV" So AMD HIP Code Can Turn Into SPIR-V And Run On OpenCL
Written by Michael Larabel in LLVM on 14 December 2021 at 05:37 AM EST. 18 Comments
Upstreaming progress is being made on a new "HIPSPV" toolchain for AMD's HIP path so that SPIR-V kernels can be executed and ultimately allowing for execution by OpenCL drivers. This HIPSPV effort driven outside of AMD aims to be able to allow HIP code to work on other GPU drivers such as those from Intel.

AMD's HIP is their C++ Runtime API and kernel language for portable applications on AMD and NVIDIA GPUs from a single source tree. HIP has been AMD's answer to NVIDIA's CUDA by aiming to make it easy to port CUDA code to run on AMD Radeon / Instinct hardware. With tools like their open-source HIPIFY they even aim to make it easy and automated as possible for converting CUDA sources to HIP.

HIP is part of AMD's Radeon Open eCosystem "ROCm" driver stack for GPU computing. HIP/ROCm leverages the open-source LLVM compiler stack and from there generates AMD GPU device code for execution.

Being worked on now by other developers is "HIPSPV" as a new complementary HIP toolchain for LLVM. With HIPSPV rather than going to the AMDGPU back-end, HIPSPV aims to generate SPIR-V code from HIP. Those generated SPIR-V modules in turn could then run atop an OpenCL driver assuming all the necessary extensions and other requirements are in place. SPIR-V, of course, being The Khronos Group's modern intermediate representation for compute/graphics used now across OpenCL / OpenGL / Vulkan across vendors.

There has been prior efforts around converting HIP to SPIR-V for Intel GPU execution while now HIPSPV is working its way toward upstream LLVM. Henry Linjamäki of Tampere University of Technology in Finland has been leading this HIPSPV effort with more details via this llvm-dev posting.

Yesterday this HIP toolchain refactoring work landed as a prerequisite for landing HIPSPV. The actual HIPSPV work and related patches are still pending.

HIPSPV intends to make use of LLVM's new SPIR-V back-end that should soon be merged while for the moment it's making use of the external LLVM SPIR-V translator.

It will be very interesting to see how well HIPSPV works in practice and how robust the toolchain support is for getting HIP converted to SPIR-V and how easily it will run atop OpenCL environments. Besides being beneficial to Intel with their Compute-Runtime / Level Zero for then handling HIP/CUDA codes, HIPSPV could also be beneficial for HIP on other open-source OpenCL drivers potentially like Mesa's Clover and the like. With software like Blender now offering AMD HIP support, it will be interesting to see if HIPSPV could work here, etc. Interesting times ahead and great seeing all the continued open-source innovations around LLVM.
Related News
About The Author
Author picture

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter or contacted via MichaelLarabel.com.

Popular News This Week