summaryrefslogtreecommitdiff
path: root/libc/src/math/amdgpu
AgeCommit message (Collapse)Author
2025-10-30[libc] Remove optimization flags on entrypoints (#165782)Michael Jones
Optimization flags are now handled through a common flag. These are no longer necessary. Fixes #112409
2025-06-07[libc][NFC] Remove unused CMake for gpu mathJoseph Huber
2025-06-06[libc] Cleanup unimplemented math functions (#143173)Joseph Huber
Summary: This patch cleans up the leftoever files that were either implemented or are still unimplemented stubs.
2024-08-05[libc] Add `lgamma` and `lgamma_r` stubs for the GPU (#102019)Joseph Huber
Summary: These functions are used by the <random> implementation in libc++ and cause a lot of tests to fail. For now we provide these through the vendor abstraction until we have a real version. The NVPTX version doesn't even update the output correctly so these are just temporary.
2024-08-05[libc][math] Implement fast pass for double precision pow function with up ↵lntue
to 1ULP error. (#101926)
2024-08-05[libc] Use generic 'atan2' function for the GPUJoseph Huber
Summary: I forget to enable this one in the previous patch.
2024-07-12[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace declaration (#98597)Petr Hosek
This is a part of #97655.
2024-07-12Revert "[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace ↵Mehdi Amini
declaration" (#98593) Reverts llvm/llvm-project#98075 bots are broken
2024-07-11[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace declaration (#98075)Petr Hosek
This is a part of #97655.
2024-07-09[libc] Add support for `powi` as an LLVM libc extension on the GPU (#98236)Joseph Huber
Summary: This function is used by the CUDA / HIP / OpenMP headers and exists as an NVIDIA extension basically. This function is implemented in the C23 standard as `pown`, but for now we need to provide `powi` for backwards compatibility. In the future this entrypoint will just be a redirect to `pown` once that is implemented.
2024-07-08[libc] Fix integer `rint` variants on the GPU (#98095)Joseph Huber
Summary: Currently these are implemented as a static cast on `__builtin_rint()` to a long. Howver, this is not strictly correct. The standard states that the output is unspecified, but most implementations, and the LLVM libc implementation, do some kind of guarantee on this beahvior. This is not guaranteed by just doing a cast. This patch just uses the generic versions until we implement `__builitin_lrint` correctly.
2024-07-08Reapply "[libc] Make GPU `libm` use generic implementations" (#98061)Joseph Huber
This reverts commit ea3fd020f4879d5b4261eabd9a56c24f30bc47f9.
2024-07-08Revert "[libc] Make GPU `libm` use generic implementations" (#98061)Mehdi Amini
Reverts llvm/llvm-project#98014 buildbot is broken.
2024-07-08[libc] Make GPU `libm` use generic implementations (#98014)Joseph Huber
Summary: This patch moves a lot of the old vendor implementations to the new generic math functions. Previously a lot of these were done through the vendor functions, but the long term goal is to completely phase these out. In order to make the tests pass I had to disable exceptions so they only perform functional tests.
2024-03-11[libc] Remove use of `__builtin_modf` in GPU mathJoseph Huber
Summary: This function was not actually supported, see https://godbolt.org/z/MP1j5EeWc. Unsure why we only now begun seeing failures related to it.
2024-03-01[libc] Fix incorrectly enabled GPU math functions (#83594)Joseph Huber
Summary: These functions were implemented via builtins that aren't acually supported. See https://godbolt.org/z/Wq6q6T1za. This caused the build to crash if they were included. Remove these and replace with correct implementations.
2024-02-29[libc] Remove workaround for fmin / fmax after being fixed in LLVM (#83421)Joseph Huber
Summary: These hacks can be removed now that https://github.com/llvm/llvm-project/pull/83376 fixed the underlying problem.
2024-02-28[libc] fix clang-tidy llvm-header-guard warnings (#82679)Nick Desaulniers
Towards the goal of getting `ninja libc-lint` back to green, fix the numerous instances of: warning: header guard does not follow preferred style [llvm-header-guard] This is because many of our header guards start with `__LLVM` rather than `LLVM`. To filter just these warnings: $ ninja -k2000 libc-lint 2>&1 | grep llvm-header-guard To automatically apply fixits: $ find libc/src libc/include libc/test -name \*.h | \ xargs -n1 -I {} clang-tidy {} -p build/compile_commands.json \ -checks='-*,llvm-header-guard' --fix --quiet Some manual cleanup is still necessary as headers that were missing header guards outright will have them inserted before the license block (we prefer them after).
2024-02-27[libc] Work around incorrect fmin/fmax results for +/-x (#83158)Joseph Huber
Summary: The IEEE 754 standard as of the 2019 revision states that for fmin -0.0 is always less than 0.0 and for fmax 0.0 is always greater than 0.0. These are currently not respected by the builtin value and thus cause the tests to fail. This patch works around it in the implementation for now by explicitly modifying the sign bit.
2024-02-27[libc] Clean up GPU math implementations (#83133)Joseph Huber
Summary: The math directory likes to do architecture specific implementations of these math functions. For the GPU case it was complicated by the fact that both NVPTX and AMDGPU had to go through the same code paths. Since reworking the GPU target this is no longer the case and we can simply use the same scheme. This patch moves all the old code into two separate directories. This likely results in a net increase in code, but it's easier to reason with.