[libc-commits] [libc] 9d30f11 - [libc] Remove use of `__builtin_modf` in GPU math

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Mon Mar 11 06:20:15 PDT 2024


Author: Joseph Huber
Date: 2024-03-11T08:20:06-05:00
New Revision: 9d30f11b8881d9f9c997bb7e3bf399c70da20b06

URL: https://github.com/llvm/llvm-project/commit/9d30f11b8881d9f9c997bb7e3bf399c70da20b06
DIFF: https://github.com/llvm/llvm-project/commit/9d30f11b8881d9f9c997bb7e3bf399c70da20b06.diff

LOG: [libc] Remove use of `__builtin_modf` in GPU math

Summary:
This function was not actually supported, see
https://godbolt.org/z/MP1j5EeWc. Unsure why we only now begun seeing
failures related to it.

Added: 
    

Modified: 
    libc/src/math/amdgpu/CMakeLists.txt
    libc/src/math/nvptx/CMakeLists.txt

Removed: 
    libc/src/math/amdgpu/modf.cpp
    libc/src/math/amdgpu/modff.cpp
    libc/src/math/nvptx/modf.cpp
    libc/src/math/nvptx/modff.cpp


################################################################################
diff  --git a/libc/src/math/amdgpu/CMakeLists.txt b/libc/src/math/amdgpu/CMakeLists.txt
index c300730208d509..93735a556a31bf 100644
--- a/libc/src/math/amdgpu/CMakeLists.txt
+++ b/libc/src/math/amdgpu/CMakeLists.txt
@@ -176,26 +176,6 @@ add_entrypoint_object(
     -O2
 )
 
-add_entrypoint_object(
-  modf
-  SRCS
-    modf.cpp
-  HDRS
-    ../modf.h
-  COMPILE_OPTIONS
-    -O2
-)
-
-add_entrypoint_object(
-  modff
-  SRCS
-    modff.cpp
-  HDRS
-    ../modff.h
-  COMPILE_OPTIONS
-    -O2
-)
-
 add_entrypoint_object(
   nearbyint
   SRCS

diff  --git a/libc/src/math/amdgpu/modf.cpp b/libc/src/math/amdgpu/modf.cpp
deleted file mode 100644
index 07dbbd6059c35f..00000000000000
--- a/libc/src/math/amdgpu/modf.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-//===-- Implementation of the GPU modf function ---------------------------===//
-//
-// 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/modf.h"
-#include "src/__support/common.h"
-
-namespace LIBC_NAMESPACE {
-
-LLVM_LIBC_FUNCTION(double, modf, (double x, double *iptr)) {
-  return __builtin_modf(x, iptr);
-}
-
-} // namespace LIBC_NAMESPACE

diff  --git a/libc/src/math/amdgpu/modff.cpp b/libc/src/math/amdgpu/modff.cpp
deleted file mode 100644
index ad35f9006b5122..00000000000000
--- a/libc/src/math/amdgpu/modff.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-//===-- Implementation of the GPU modff function --------------------------===//
-//
-// 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/modff.h"
-#include "src/__support/common.h"
-
-namespace LIBC_NAMESPACE {
-
-LLVM_LIBC_FUNCTION(float, modff, (float x, float *iptr)) {
-  return __builtin_modff(x, iptr);
-}
-
-} // namespace LIBC_NAMESPACE

diff  --git a/libc/src/math/nvptx/CMakeLists.txt b/libc/src/math/nvptx/CMakeLists.txt
index 56bff1472f134f..581e1c6a3044b2 100644
--- a/libc/src/math/nvptx/CMakeLists.txt
+++ b/libc/src/math/nvptx/CMakeLists.txt
@@ -177,26 +177,6 @@ add_entrypoint_object(
     -O2
 )
 
-add_entrypoint_object(
-  modf
-  SRCS
-    modf.cpp
-  HDRS
-    ../modf.h
-  COMPILE_OPTIONS
-    -O2
-)
-
-add_entrypoint_object(
-  modff
-  SRCS
-    modff.cpp
-  HDRS
-    ../modff.h
-  COMPILE_OPTIONS
-    -O2
-)
-
 add_entrypoint_object(
   nearbyint
   SRCS

diff  --git a/libc/src/math/nvptx/modf.cpp b/libc/src/math/nvptx/modf.cpp
deleted file mode 100644
index 07dbbd6059c35f..00000000000000
--- a/libc/src/math/nvptx/modf.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-//===-- Implementation of the GPU modf function ---------------------------===//
-//
-// 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/modf.h"
-#include "src/__support/common.h"
-
-namespace LIBC_NAMESPACE {
-
-LLVM_LIBC_FUNCTION(double, modf, (double x, double *iptr)) {
-  return __builtin_modf(x, iptr);
-}
-
-} // namespace LIBC_NAMESPACE

diff  --git a/libc/src/math/nvptx/modff.cpp b/libc/src/math/nvptx/modff.cpp
deleted file mode 100644
index ad35f9006b5122..00000000000000
--- a/libc/src/math/nvptx/modff.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-//===-- Implementation of the GPU modff function --------------------------===//
-//
-// 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/modff.h"
-#include "src/__support/common.h"
-
-namespace LIBC_NAMESPACE {
-
-LLVM_LIBC_FUNCTION(float, modff, (float x, float *iptr)) {
-  return __builtin_modff(x, iptr);
-}
-
-} // namespace LIBC_NAMESPACE


        


More information about the libc-commits mailing list