This project compares the LLVM LIBC math implementations from <LLVM_ROOT>/libc/src/math/generic
to the HIP math implementations and the __builtin
math functions.
The src
and include
folders contain C++
templates and source files for running the math functions on uniformly distributed ranges of input. To compile the project, one must first install LLVM with LIBC configured to include either generic or __builtin
functions in libmgpu.a
. The two scripts install_builtin_math.sh
and install_libc_math.sh
can be used to build and install LLVM with LIBC configured to use generic or __builtin
implementations, respectively.
To run the make
, environment variables specifying the math function to be tested, return type, and input arguments must be configured. To make and run all __builtin
functions on the device, use the shell scripts
source install_builtin_math.sh
./gpu_builtin.sh
To run install multiple versions of LIBC and test all the different versions, type
source driver.sh
To see the results, please navigate to ./figures/error_plots.md or ./figures/timing_histograms.md. The former compares the output of the functions executed on the GPU using vendor and LIBC functions for an equidistantly spaced range of inputs. The latter compares the walltime of running the functions in GPU kernels.
patches
contains a patch that can be used to update the LLVM main branch to only include __builtin
functions in the GPU match archive libmgpu.a
.