Work Is Underway To Upstream LLVM Clang's CUDA Toolchain For AMDGPU/HIP
A long available tool has been AMD's ROCm HIP that allows converting CUDA code to portable C++ code that in turn can be executed on Radeon GPUs. There is now work on getting the upstream LLVM Clang compiler's CUDA toolchain support to also support HIP.
HIP's hipify tool can convert CUDA code to HIP for execution on NVIDIA/AMD GPUs. HIP also consists of a portable C++ language for execution across GPU vendors. Those not familiar with HIP can learn more via its ROCm tool repository.
What initially got me digging into the LLVM/Clang upstreaming work was seeing on Thursday: [CUDA] Add amdgpu sub archs. Clang's CUDA code now not only listing NVIDIA GPU micro-architectures but also the Radeon GPU generations backed by the LLVM AMDGPU compiler back-end.
HIP/HIP-ify has made use of LLVM/Clang already, but has relied upon out-of-tree changes.
Tracing things back, it's part of an ongoing effort to allow LLVM Clang's CUDA toolchain to support the HIP language mode and AMDGPU device support. There's this code review part of the process. Its summary:
It's great seeing more of the AMD/ROCm code being upstreamed, especially now on the Clang side. With Linux 4.17 is also the big piece for initial dGPU support in AMDKFD kernel driver to start allowing ROCm -- including ROCm OpenCL -- to begin working off an unmodified, upstream kernel. With more pieces in upstream, deploying ROCm across different Linux distributions will become much easier.
HIP's hipify tool can convert CUDA code to HIP for execution on NVIDIA/AMD GPUs. HIP also consists of a portable C++ language for execution across GPU vendors. Those not familiar with HIP can learn more via its ROCm tool repository.
What initially got me digging into the LLVM/Clang upstreaming work was seeing on Thursday: [CUDA] Add amdgpu sub archs. Clang's CUDA code now not only listing NVIDIA GPU micro-architectures but also the Radeon GPU generations backed by the LLVM AMDGPU compiler back-end.
HIP/HIP-ify has made use of LLVM/Clang already, but has relied upon out-of-tree changes.
Tracing things back, it's part of an ongoing effort to allow LLVM Clang's CUDA toolchain to support the HIP language mode and AMDGPU device support. There's this code review part of the process. Its summary:
This patch let CUDA toolchain support HIP language mode. It includes:Hopefully this will help the adoption of HIP with getting this support upstreamed into the LLVM Clang CUDA code, albeit it's not all merged yet. This is official AMD work with the LLVM patches being led by AMD's Yaxun Liu.
Add file type hip for toolchain.
Create specific compiler jobs for HIP.
Choose specific header/libraries for HIP.
Use clang-offload-bindler to create binary for device ISA.
It's great seeing more of the AMD/ROCm code being upstreamed, especially now on the Clang side. With Linux 4.17 is also the big piece for initial dGPU support in AMDKFD kernel driver to start allowing ROCm -- including ROCm OpenCL -- to begin working off an unmodified, upstream kernel. With more pieces in upstream, deploying ROCm across different Linux distributions will become much easier.
12 Comments