Workshop: LLVM-HPC2023: The Ninth Workshop on the LLVM Compiler Infrastructure in HPC
Authors: Anton Rydahl (Lawrence Livermore National Laboratory), Joseph Huber (Advanced Micro Devices (AMD) Inc), and Ethan Luis McDonough and Johannes Doerfert (Lawrence Livermore National Laboratory)
Abstract: With the advent of GPU computing, executing large program sections on accelerators has become increasingly important. Efforts are being made to support the C standard library, LIBC, on GPUs via LLVM machinery. Therefore, the C standard math library, LIBM, must be supported on GPUs. So far, LLVM frontends, such as Clang, have relied on GPU vendor implementations of LIBM functionality wrapped into (mostly) LIBM-compatible forwarding functions.
We propose a novel LIBM for GPUs reusing a collection of LLVM target-agnostic implementations and built-ins alongside vendor implementations of most single and double-precision floating point math functions. Our approach allows selecting between individual implementations based on the GPU target as opposed to the current approach, which serves only the single third-party library implementation. Our extensive numerical analysis highlights the various implementations' differences in performance and precision. Our solution allows users to choose the implementation that maximizes speed while meeting their specific precision requirements.
Back to LLVM-HPC2023: The Ninth Workshop on the LLVM Compiler Infrastructure in HPC Archive Listing