diff options
| author | Joseph Huber <huberjn@outlook.com> | 2024-08-05 14:53:05 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-05 14:53:05 -0500 |
| commit | 88d288489e09a261f6740972dcaf6fedaf87a762 (patch) | |
| tree | cf46dad6cc3be56bcd62ae1e664b8597d6bcf808 /libc/src/math/amdgpu/lgamma_r.cpp | |
| parent | c4ec19b985815b664cc598a608acc0906d29d902 (diff) | |
[libc] Add `lgamma` and `lgamma_r` stubs for the GPU (#102019)
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.
Diffstat (limited to 'libc/src/math/amdgpu/lgamma_r.cpp')
| -rw-r--r-- | libc/src/math/amdgpu/lgamma_r.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/libc/src/math/amdgpu/lgamma_r.cpp b/libc/src/math/amdgpu/lgamma_r.cpp new file mode 100644 index 000000000000..0a79988d66e3 --- /dev/null +++ b/libc/src/math/amdgpu/lgamma_r.cpp @@ -0,0 +1,24 @@ +//===-- Implementation of the lgamma_r function for GPU -------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "src/math/lgamma_r.h" +#include "src/__support/common.h" + +#include "declarations.h" +#include "src/__support/macros/config.h" + +namespace LIBC_NAMESPACE_DECL { + +LLVM_LIBC_FUNCTION(double, lgamma_r, (double x, int *signp)) { + int tmp = *signp; + double r = __ocml_lgamma_r_f64(x, (gpu::Private<int> *)&tmp); + *signp = tmp; + return r; +} + +} // namespace LIBC_NAMESPACE_DECL |
