LLVM Makes Progress On Using ClangIR To Compile GPU Kernels

Written by Michael Larabel in LLVM on 11 September 2024 at 06:04 AM EDT. 2 Comments
LLVM
ClangIR is a new IR for LLVM's Clang compiler built atop MLIR. Thanks to this year's Google Summer of Code, there has been progress on being able to compile GPU kernels using ClangIR as another improvement for heterogeneous programming with this open-source compiler stack.

Student developer Zhi Ma took to the effort of enabling GPU kernel support with ClangIR over the summer. The project was centered around enabling OpenCL C language support in ClangIR that can then be targeted to SPIR-V for executing atop OpenCL/Vulkan drivers. This ultimately aims to further improve LLVM's support around SYCL and NVIDIA CUDA too.

GSoC 2024 led to working on address space support in ClangIR, OpenCL language and SPIR-V target integration, adding vector type support, kernel and module metadata emission, and more.

This project for GPU kernel support in ClangIR was a success and has been summed up on the LLVM blog. The main takeaway from the project is:
"The project successfully met its primary goals. OpenCL kernels from the Polybench-GPU benchmark suite can now be compiled using ClangIR into LLVM IR for SPIR-V. All patches have been merged into the main ClangIR repository, and the project’s progress has been well-documented in the overview issue. I believe the work not only advanced OpenCL support but also laid a solid foundation for future enhancements, such as SYCL and CUDA support in ClangIR.

We have successfully compiled and executed all 20 OpenCL C benchmarks from the polybenchGpu repository, passing the built-in result validation."

Those wishing to learn more about ClangIR can do so via GitHub.
Related News
About The Author
Michael Larabel

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, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week