[all-commits] [llvm/llvm-project] 8060d9: [libc] Begin implementing a 'libmgpu.a' for math o...
Joseph Huber via All-commits
all-commits at lists.llvm.org
Wed Jun 14 10:59:35 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 8060d96aed7c2ee8be188fb7619a0cbb863d4f8c
https://github.com/llvm/llvm-project/commit/8060d96aed7c2ee8be188fb7619a0cbb863d4f8c
Author: Joseph Huber <jhuber6 at vols.utk.edu>
Date: 2023-06-14 (Wed, 14 Jun 2023)
Changed paths:
M libc/config/gpu/entrypoints.txt
M libc/config/gpu/headers.txt
M libc/src/math/CMakeLists.txt
A libc/src/math/gpu/CMakeLists.txt
A libc/src/math/gpu/round.cpp
A libc/src/math/gpu/roundf.cpp
A libc/src/math/gpu/roundl.cpp
A libc/src/math/gpu/vendor/CMakeLists.txt
A libc/src/math/gpu/vendor/amdgpu/amdgpu.h
A libc/src/math/gpu/vendor/amdgpu/declarations.h
A libc/src/math/gpu/vendor/amdgpu/platform.h
A libc/src/math/gpu/vendor/common.h
A libc/src/math/gpu/vendor/nvptx/declarations.h
A libc/src/math/gpu/vendor/nvptx/nvptx.h
A libc/src/math/gpu/vendor/sin.cpp
Log Message:
-----------
[libc] Begin implementing a 'libmgpu.a' for math on the GPU
This patch adds an outline to begin adding a `libmgpu.a` file for
provindg math on the GPU. Currently, this is most likely going to be
wrapping around existing vendor libraries and placing them in a more
usable format. Long term, we would like to provide our own
implementations of math functions that can be used instead.
This patch works by simply forwarding the calls to the standard C math
library calls like `sin` to the appropriate vendor call like `__nv_sin`.
Currently, we will use the vendor libraries directly and link them in
via `-mlink-builtin-bitcode`. This is necessary because of bizarre
interactions with the generic bitcode, `-mlink-builtin-bitcode`
internalizes and only links in the used symbols, furthermore is
propagates the target's default attributes and its the only "truly"
correct way to pull in these vendor bitcode libraries without error.
If the vendor libraries are not availible at build time, we will still
create the `libmgpu.a`, but we will expect that the vendor library
definitions will be provided by the user's compilation as is made
possible by https://reviews.llvm.org/D152442.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D152486
Commit: f205fbbb011e828f3daac4238435ac2baeb40fec
https://github.com/llvm/llvm-project/commit/f205fbbb011e828f3daac4238435ac2baeb40fec
Author: Joseph Huber <jhuber6 at vols.utk.edu>
Date: 2023-06-14 (Wed, 14 Jun 2023)
Changed paths:
M libc/config/gpu/entrypoints.txt
M libc/src/__support/FPUtil/FMA.h
A libc/src/__support/FPUtil/gpu/FMA.h
M libc/src/__support/macros/properties/cpu_features.h
Log Message:
-----------
[libc] Add support for FMA in the GPU utilities
This adds the generic FMA utilities for the GPU. We implement these
through the builtins which map to the FMA instructions in the ISA. These
may not have strict compliance with other assumptions in the the `libc`
such as rounding modes. I've included the relevant information on how
the GPU vendors map the behaviour. This should help make it easier to
implement some future generic versions.
Depends on D152486
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D152923
Compare: https://github.com/llvm/llvm-project/compare/7d21f5714e5a...f205fbbb011e
More information about the All-commits
mailing list