News: 0001490917

  ARM Give a man a fire and he's warm for a day, but set fire to him and he's warm for the rest of his life (Terry Pratchett, Jingo)

LLVM Makes Progress On Using ClangIR To Compile GPU Kernels

([LLVM] 6 Hours Ago LLVM + ClangIR + GPU Kernels)


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 [1]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 [2]via GitHub .



[1] https://blog.llvm.org/posts/2024-08-29-gsoc-opencl-c-support-for-clangir/

[2] https://llvm.github.io/clangir//



A1B2C3

Mustafif Khan

Writing is easy; all you do is sit staring at the blank sheet of paper until
drops of blood form on your forehead.
-- Gene Fowler