Skip to content

Commit 00570c3

Browse files
authored
[libc] Fix incorrectly enabled GPU math functions (#83594)
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.
1 parent 2ab6d1e commit 00570c3

12 files changed

+2
-218
lines changed

libc/src/math/amdgpu/CMakeLists.txt

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -176,46 +176,6 @@ add_entrypoint_object(
176176
-O2
177177
)
178178

179-
add_entrypoint_object(
180-
lround
181-
SRCS
182-
lround.cpp
183-
HDRS
184-
../lround.h
185-
COMPILE_OPTIONS
186-
-O2
187-
)
188-
189-
add_entrypoint_object(
190-
lroundf
191-
SRCS
192-
lroundf.cpp
193-
HDRS
194-
../lroundf.h
195-
COMPILE_OPTIONS
196-
-O2
197-
)
198-
199-
add_entrypoint_object(
200-
llround
201-
SRCS
202-
llround.cpp
203-
HDRS
204-
../llround.h
205-
COMPILE_OPTIONS
206-
-O2
207-
)
208-
209-
add_entrypoint_object(
210-
llroundf
211-
SRCS
212-
llroundf.cpp
213-
HDRS
214-
../llroundf.h
215-
COMPILE_OPTIONS
216-
-O2
217-
)
218-
219179
add_entrypoint_object(
220180
modf
221181
SRCS

libc/src/math/amdgpu/exp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313

1414
namespace LIBC_NAMESPACE {
1515

16-
LLVM_LIBC_FUNCTION(double, exp, (double x)) { return __builtin_exp(x); }
16+
LLVM_LIBC_FUNCTION(double, exp, (double x)) { return __ocml_exp_f64(x); }
1717

1818
} // namespace LIBC_NAMESPACE

libc/src/math/amdgpu/expf.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313

1414
namespace LIBC_NAMESPACE {
1515

16-
LLVM_LIBC_FUNCTION(float, expf, (float x)) { return __builtin_expf(x); }
16+
LLVM_LIBC_FUNCTION(float, expf, (float x)) { return __ocml_exp_f32(x); }
1717

1818
} // namespace LIBC_NAMESPACE

libc/src/math/amdgpu/llround.cpp

Lines changed: 0 additions & 18 deletions
This file was deleted.

libc/src/math/amdgpu/llroundf.cpp

Lines changed: 0 additions & 18 deletions
This file was deleted.

libc/src/math/amdgpu/lround.cpp

Lines changed: 0 additions & 16 deletions
This file was deleted.

libc/src/math/amdgpu/lroundf.cpp

Lines changed: 0 additions & 16 deletions
This file was deleted.

libc/src/math/nvptx/CMakeLists.txt

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -177,46 +177,6 @@ add_entrypoint_object(
177177
-O2
178178
)
179179

180-
add_entrypoint_object(
181-
lround
182-
SRCS
183-
lround.cpp
184-
HDRS
185-
../lround.h
186-
COMPILE_OPTIONS
187-
-O2
188-
)
189-
190-
add_entrypoint_object(
191-
lroundf
192-
SRCS
193-
lroundf.cpp
194-
HDRS
195-
../lroundf.h
196-
COMPILE_OPTIONS
197-
-O2
198-
)
199-
200-
add_entrypoint_object(
201-
llround
202-
SRCS
203-
llround.cpp
204-
HDRS
205-
../llround.h
206-
COMPILE_OPTIONS
207-
-O2
208-
)
209-
210-
add_entrypoint_object(
211-
llroundf
212-
SRCS
213-
llroundf.cpp
214-
HDRS
215-
../llroundf.h
216-
COMPILE_OPTIONS
217-
-O2
218-
)
219-
220180
add_entrypoint_object(
221181
modf
222182
SRCS

libc/src/math/nvptx/llround.cpp

Lines changed: 0 additions & 18 deletions
This file was deleted.

libc/src/math/nvptx/llroundf.cpp

Lines changed: 0 additions & 18 deletions
This file was deleted.

libc/src/math/nvptx/lround.cpp

Lines changed: 0 additions & 16 deletions
This file was deleted.

libc/src/math/nvptx/lroundf.cpp

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)