Work Is Underway To Upstream LLVM Clang's CUDA Toolchain For AMDGPU/HIP
Written by Michael Larabel in AMD on 6 April 2018 at 03:00 AM EDT. 16 Comments
AMD --
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:
This patch let CUDA toolchain support HIP language mode. It includes:

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.
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.

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.

About The Author
Author picture

Michael Larabel is the principal author of and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 10,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 automated benchmarking software. He can be followed via Twitter or contacted via

Related AMD News
Popular News This Week