[libc-commits] [libc] [libc][libm][GPU] Change CMake Logic to Allow Different Sets of Supported Vendor Functions (PR #66133)

via libc-commits libc-commits at lists.llvm.org
Tue Sep 12 12:46:15 PDT 2023


llvmbot wrote:

@llvm/pr-subscribers-libc

<details>
<summary>Changes</summary>

I made some detailed comparisons of the different versions of the C math functions available for GPUs. I found that some functions lower correctly on AMD GPU targets but not on NVIDIA targets, and vice versa. Therefore, I believe we should support different subsets of the HIP Math and CUDA Math APIs. By changing the CMake logic for `libc/src/libm` a bit, that is possible.

Let me know what you think of this.
--

Patch is 23.35 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/66133.diff

5 Files Affected:

- (modified) libc/src/math/CMakeLists.txt (+2-2) 
- (modified) libc/src/math/gpu/CMakeLists.txt (+1-1) 
- (modified) libc/src/math/gpu/vendor/CMakeLists.txt (+5-509) 
- (added) libc/src/math/gpu/vendor/amdgpu/CMakeLists.txt (+507) 
- (added) libc/src/math/gpu/vendor/nvptx/CMakeLists.txt (+507) 


<pre>
diff --git a/libc/src/math/CMakeLists.txt b/libc/src/math/CMakeLists.txt
index 8b2021cac8239fe..a83bbf2fa71f9b2 100644
--- a/libc/src/math/CMakeLists.txt
+++ b/libc/src/math/CMakeLists.txt
@@ -20,13 +20,13 @@ function(add_math_entrypoint_object name)
 
   # The GPU optionally depends on vendor libraries. If we emitted one of these
   # entrypoints it means the user requested it and we should use it instead.
-  get_fq_target_name("${LIBC_TARGET_ARCHITECTURE}.vendor.${name}" fq_vendor_specific_target_name)
+  get_fq_target_name("${LIBC_TARGET_ARCHITECTURE}.vendor.${LIBC_GPU_VENDOR}.${name}" fq_vendor_specific_target_name)
   if(TARGET ${fq_vendor_specific_target_name})
     add_entrypoint_object(
       ${name}
       ALIAS
       DEPENDS
-        .${LIBC_TARGET_ARCHITECTURE}.vendor.${name}
+        .${LIBC_TARGET_ARCHITECTURE}.vendor.${LIBC_GPU_VENDOR}.${name}
       VENDOR
     )
     return()
diff --git a/libc/src/math/gpu/CMakeLists.txt b/libc/src/math/gpu/CMakeLists.txt
index cee7b7d9db476f2..cb4c2c4284c99f8 100644
--- a/libc/src/math/gpu/CMakeLists.txt
+++ b/libc/src/math/gpu/CMakeLists.txt
@@ -12,7 +12,7 @@ add_subdirectory(vendor)
 # basis.
 option(LIBC_GPU_VENDOR_MATH "Use vendor wrappers for GPU math" ON)
 function(add_math_entrypoint_gpu_object name)
-  get_fq_target_name("vendor.${name}" fq_vendor_specific_target_name)
+  get_fq_target_name("vendor.${LIBC_GPU_VENDOR}.${name}" fq_vendor_specific_target_name)
   if(TARGET ${fq_vendor_specific_target_name} AND ${LIBC_GPU_VENDOR_MATH})
     return()
   endif()
diff --git a/libc/src/math/gpu/vendor/CMakeLists.txt b/libc/src/math/gpu/vendor/CMakeLists.txt
index 2ee74a06a02d461..797802fc02dbb4c 100644
--- a/libc/src/math/gpu/vendor/CMakeLists.txt
+++ b/libc/src/math/gpu/vendor/CMakeLists.txt
@@ -1,5 +1,7 @@
 find_package(AMDDeviceLibs QUIET HINTS ${CMAKE_INSTALL_PREFIX} PATHS /opt/rocm)
 if(AMDDeviceLibs_FOUND)
+  add_subdirectory(amdgpu)
+  set(LIBC_GPU_VENDOR "amdgpu" CACHE INTERNAL "")
   message(STATUS "Found the ROCm device library. Implementations falling back "
                  "to the vendor libraries will be resolved statically.")
   get_target_property(ocml_path ocml IMPORTED_LOCATION)
@@ -12,6 +14,8 @@ endif()
 
 find_package(CUDAToolkit QUIET)
 if(CUDAToolkit_FOUND)
+  add_subdirectory(nvptx)
+  set(LIBC_GPU_VENDOR "nvptx" CACHE INTERNAL "")
   set(libdevice_path ${CUDAToolkit_BIN_DIR}/../nvvm/libdevice/libdevice.10.bc)
   if (EXISTS ${libdevice_path})
     message(STATUS "Found the CUDA device library. Implementations falling back "
@@ -27,512 +31,4 @@ endif()
 # FIXME: We need a way to pass the library to only the NVTPX / AMDGPU build.
 # This shouldn't cause issues because we only link in needed symbols, but it
 # will link in identity metadata from both libraries. This silences the warning.
-list(APPEND bitcode_link_flags "-Wno-linker-warnings")
-
-add_entrypoint_object(
-  acosf
-  SRCS
-    acosf.cpp
-  HDRS
-    ../../acosf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-add_entrypoint_object(
-  acoshf
-  SRCS
-    acoshf.cpp
-  HDRS
-    ../../acoshf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-add_entrypoint_object(
-  asinf
-  SRCS
-    asinf.cpp
-  HDRS
-    ../../asinf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-add_entrypoint_object(
-  asinhf
-  SRCS
-    asinhf.cpp
-  HDRS
-    ../../asinhf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-add_entrypoint_object(
-  atanf
-  SRCS
-    atanf.cpp
-  HDRS
-    ../../atanf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-add_entrypoint_object(
-  atanhf
-  SRCS
-    atanhf.cpp
-  HDRS
-    ../../atanhf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-add_entrypoint_object(
-  cos
-  SRCS
-    cos.cpp
-  HDRS
-    ../../cos.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-add_entrypoint_object(
-  cosf
-  SRCS
-    cosf.cpp
-  HDRS
-    ../../cosf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-add_entrypoint_object(
-  cosh
-  SRCS
-    cosh.cpp
-  HDRS
-    ../../cosh.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-add_entrypoint_object(
-  coshf
-  SRCS
-    coshf.cpp
-  HDRS
-    ../../coshf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-add_entrypoint_object(
-  exp10f
-  SRCS
-    exp10f.cpp
-  HDRS
-    ../../exp10f.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-add_entrypoint_object(
-  exp2f
-  SRCS
-    exp2f.cpp
-  HDRS
-    ../../exp2f.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-add_entrypoint_object(
-  expf
-  SRCS
-    expf.cpp
-  HDRS
-    ../../expf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-add_entrypoint_object(
-  expm1f
-  SRCS
-    expm1f.cpp
-  HDRS
-    ../../expm1f.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-add_entrypoint_object(
-  fdim
-  SRCS
-    fdim.cpp
-  HDRS
-    ../../fdim.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-add_entrypoint_object(
-  fdimf
-  SRCS
-    fdimf.cpp
-  HDRS
-    ../../fdimf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-add_entrypoint_object(
-  hypot
-  SRCS
-    hypot.cpp
-  HDRS
-    ../../hypot.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-add_entrypoint_object(
-  hypotf
-  SRCS
-    hypotf.cpp
-  HDRS
-    ../../hypotf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-add_entrypoint_object(
-  ilogb
-  SRCS
-    ilogb.cpp
-  HDRS
-    ../../ilogb.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-add_entrypoint_object(
-  ilogbf
-  SRCS
-    ilogbf.cpp
-  HDRS
-    ../../ilogbf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-add_entrypoint_object(
-  ldexp
-  SRCS
-    ldexp.cpp
-  HDRS
-    ../../ldexp.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-add_entrypoint_object(
-  ldexpf
-  SRCS
-    ldexpf.cpp
-  HDRS
-    ../../ldexpf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-add_entrypoint_object(
-  llrint
-  SRCS
-    llrint.cpp
-  HDRS
-    ../../llrint.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-add_entrypoint_object(
-  llrintf
-  SRCS
-    llrintf.cpp
-  HDRS
-    ../../llrintf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-add_entrypoint_object(
-  remquo
-  SRCS
-    remquo.cpp
-  HDRS
-    ../../remquo.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-add_entrypoint_object(
-  remquof
-  SRCS
-    remquof.cpp
-  HDRS
-    ../../remquof.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-
-add_entrypoint_object(
-  llround
-  SRCS
-    llround.cpp
-  HDRS
-    ../../llround.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-add_entrypoint_object(
-  llroundf
-  SRCS
-    llroundf.cpp
-  HDRS
-    ../../llroundf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-add_entrypoint_object(
-  scalbn
-  SRCS
-    scalbn.cpp
-  HDRS
-    ../../scalbn.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-add_entrypoint_object(
-  scalbnf
-  SRCS
-    scalbnf.cpp
-  HDRS
-    ../../scalbnf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-
-add_entrypoint_object(
-  nextafter
-  SRCS
-    nextafter.cpp
-  HDRS
-    ../../nextafter.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-add_entrypoint_object(
-  nextafterf
-  SRCS
-    nextafterf.cpp
-  HDRS
-    ../../nextafterf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-add_entrypoint_object(
-  pow
-  SRCS
-    pow.cpp
-  HDRS
-    ../../pow.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-add_entrypoint_object(
-  powf
-  SRCS
-    powf.cpp
-  HDRS
-    ../../powf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-add_entrypoint_object(
-  sin
-  SRCS
-    sin.cpp
-  HDRS
-    ../../sin.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-add_entrypoint_object(
-  sinf
-  SRCS
-    sinf.cpp
-  HDRS
-    ../../sinf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-add_entrypoint_object(
-  sincos
-  SRCS
-    sincos.cpp
-  HDRS
-    ../../sincos.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-add_entrypoint_object(
-  sincosf
-  SRCS
-    sincosf.cpp
-  HDRS
-    ../../sincosf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-add_entrypoint_object(
-  sinh
-  SRCS
-    sinh.cpp
-  HDRS
-    ../../sinh.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-add_entrypoint_object(
-  sinhf
-  SRCS
-    sinhf.cpp
-  HDRS
-    ../../sinhf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-add_entrypoint_object(
-  tan
-  SRCS
-    tan.cpp
-  HDRS
-    ../../tan.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-add_entrypoint_object(
-  tanf
-  SRCS
-    tanf.cpp
-  HDRS
-    ../../tanf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-add_entrypoint_object(
-  tanh
-  SRCS
-    tanh.cpp
-  HDRS
-    ../../tanh.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-add_entrypoint_object(
-  tanhf
-  SRCS
-    tanhf.cpp
-  HDRS
-    ../../tanhf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-add_entrypoint_object(
-  frexp
-  SRCS
-    frexp.cpp
-  HDRS
-    ../../frexp.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
-add_entrypoint_object(
-  frexpf
-  SRCS
-    frexpf.cpp
-  HDRS
-    ../../frexpf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
+list(APPEND bitcode_link_flags "-Wno-linker-warnings")
\ No newline at end of file
diff --git a/libc/src/math/gpu/vendor/amdgpu/CMakeLists.txt b/libc/src/math/gpu/vendor/amdgpu/CMakeLists.txt
new file mode 100644
index 000000000000000..927dbffe5de8a3a
--- /dev/null
+++ b/libc/src/math/gpu/vendor/amdgpu/CMakeLists.txt
@@ -0,0 +1,507 @@
+add_entrypoint_object(
+  acosf
+  SRCS
+    ../acosf.cpp
+  HDRS
+    ../../../acosf.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  acoshf
+  SRCS
+    ../acoshf.cpp
+  HDRS
+    ../../../acoshf.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  asinf
+  SRCS
+    ../asinf.cpp
+  HDRS
+    ../../../asinf.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  asinhf
+  SRCS
+    ../asinhf.cpp
+  HDRS
+    ../../../asinhf.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  atanf
+  SRCS
+    ../atanf.cpp
+  HDRS
+    ../../../atanf.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  atanhf
+  SRCS
+    ../atanhf.cpp
+  HDRS
+    ../../../atanhf.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  cos
+  SRCS
+    ../cos.cpp
+  HDRS
+    ../../../cos.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  cosf
+  SRCS
+    ../cosf.cpp
+  HDRS
+    ../../../cosf.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  cosh
+  SRCS
+    ../cosh.cpp
+  HDRS
+    ../../../cosh.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  coshf
+  SRCS
+    ../coshf.cpp
+  HDRS
+    ../../../coshf.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  exp10f
+  SRCS
+    ../exp10f.cpp
+  HDRS
+    ../../../exp10f.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  exp2f
+  SRCS
+    ../exp2f.cpp
+  HDRS
+    ../../../exp2f.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  expf
+  SRCS
+    ../expf.cpp
+  HDRS
+    ../../../expf.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  expm1f
+  SRCS
+    ../expm1f.cpp
+  HDRS
+    ../../../expm1f.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  fdim
+  SRCS
+    ../fdim.cpp
+  HDRS
+    ../../../fdim.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  fdimf
+  SRCS
+    ../fdimf.cpp
+  HDRS
+    ../../../fdimf.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  hypot
+  SRCS
+    ../hypot.cpp
+  HDRS
+    ../../../hypot.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  hypotf
+  SRCS
+    ../hypotf.cpp
+  HDRS
+    ../../../hypotf.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  ilogb
+  SRCS
+    ../ilogb.cpp
+  HDRS
+    ../../../ilogb.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  ilogbf
+  SRCS
+    ../ilogbf.cpp
+  HDRS
+    ../../../ilogbf.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  ldexp
+  SRCS
+    ../ldexp.cpp
+  HDRS
+    ../../../ldexp.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  ldexpf
+  SRCS
+    ../ldexpf.cpp
+  HDRS
+    ../../../ldexpf.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  llrint
+  SRCS
+    ../llrint.cpp
+  HDRS
+    ../../../llrint.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  llrintf
+  SRCS
+    ../llrintf.cpp
+  HDRS
+    ../../../llrintf.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  remquo
+  SRCS
+    ../remquo.cpp
+  HDRS
+    ../../../remquo.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  remquof
+  SRCS
+    ../remquof.cpp
+  HDRS
+    ../../../remquof.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+
+add_entrypoint_object(
+  llround
+  SRCS
+    ../llround.cpp
+  HDRS
+    ../../../llround.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  llroundf
+  SRCS
+    ../llroundf.cpp
+  HDRS
+    ../../../llroundf.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  scalbn
+  SRCS
+    ../scalbn.cpp
+  HDRS
+    ../../../scalbn.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  scalbnf
+  SRCS
+    ../scalbnf.cpp
+  HDRS
+    ../../../scalbnf.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+
+add_entrypoint_object(
+  nextafter
+  SRCS
+    ../nextafter.cpp
+  HDRS
+    ../../../nextafter.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  nextafterf
+  SRCS
+    ../nextafterf.cpp
+  HDRS
+    ../../../nextafterf.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  pow
+  SRCS
+    ../pow.cpp
+  HDRS
+    ../../../pow.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  powf
+  SRCS
+    ../powf.cpp
+  HDRS
+    ../../../powf.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  sin
+  SRCS
+    ../sin.cpp
+  HDRS
+    ../../../sin.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  sinf
+  SRCS
+    ../sinf.cpp
+  HDRS
+    ../../../sinf.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  sincos
+  SRCS
+    ../sincos.cpp
+  HDRS
+    ../../../sincos.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  sincosf
+  SRCS
+    ../sincosf.cpp
+  HDRS
+    ../../../sincosf.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  sinh
+  SRCS
+    ../sinh.cpp
+  HDRS
+    ../../../sinh.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  sinhf
+  SRCS
+    ../sinhf.cpp
+  HDRS
+    ../../../sinhf.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  tan
+  SRCS
+    ../tan.cpp
+  HDRS
+    ../../../tan.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  tanf
+  SRCS
+    ../tanf.cpp
+  HDRS
+    ../../../tanf.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  tanh
+  SRCS
+    ../tanh.cpp
+  HDRS
+    ../../../tanh.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  tanhf
+  SRCS
+    ../tanhf.cpp
+  HDRS
+    ../../../tanhf.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  frexp
+  SRCS
+    ../frexp.cpp
+  HDRS
+    ../../../frexp.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  frexpf
+  SRCS
+    ../frexpf.cpp
+  HDRS
+    ../../../frexpf.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
diff --git a/libc/src/math/gpu/vendor/nvptx/CMakeLists.txt b/libc/src/math/gpu/vendor/nvptx/CMakeLists.txt
new file mode 100644
index 000000000000000..927dbffe5de8a3a
--- /dev/null
+++ b/libc/src/math/gpu/vendor/nvptx/CMakeLists.txt
@@ -0,0 +1,507 @@
+add_entrypoint_object(
+  acosf
+  SRCS
+    ../acosf.cpp
+  HDRS
+    ../../../acosf.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  acoshf
+  SRCS
+    ../acoshf.cpp
+  HDRS
+    ../../../acoshf.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  asinf
+  SRCS
+    ../asinf.cpp
+  HDRS
+    ../../../asinf.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  asinhf
+  SRCS
+    ../asinhf.cpp
+  HDRS
+    ../../../asinhf.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  atanf
+  SRCS
+    ../atanf.cpp
+  HDRS
+    ../../../atanf.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  atanhf
+  SRCS
+    ../atanhf.cpp
+  HDRS
+    ../../../atanhf.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  cos
+  SRCS
+    ../cos.cpp
+  HDRS
+    ../../../cos.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  cosf
+  SRCS
+    ../cosf.cpp
+  HDRS
+    ../../../cosf.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  cosh
+  SRCS
+    ../cosh.cpp
+  HDRS
+    ../../../cosh.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  coshf
+  SRCS
+    ../coshf.cpp
+  HDRS
+    ../../../coshf.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  exp10f
+  SRCS
+    ../exp10f.cpp
+  HDRS
+    ../../../exp10f.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  exp2f
+  SRCS
+    ../exp2f.cpp
+  HDRS
+    ../../../exp2f.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  expf
+  SRCS
+    ../expf.cpp
+  HDRS
+    ../../../expf.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  expm1f
+  SRCS
+    ../expm1f.cpp
+  HDRS
+    ../../../expm1f.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  fdim
+  SRCS
+    ../fdim.cpp
+  HDRS
+    ../../../fdim.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  fdimf
+  SRCS
+    ../fdimf.cpp
+  HDRS
+    ../../../fdimf.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  hypot
+  SRCS
+    ../hypot.cpp
+  HDRS
+    ../../../hypot.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  hypotf
+  SRCS
+    ../hypotf.cpp
+  HDRS
+    ../../../hypotf.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  ilogb
+  SRCS
+    ../ilogb.cpp
+  HDRS
+    ../../../ilogb.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  ilogbf
+  SRCS
+    ../ilogbf.cpp
+  HDRS
+    ../../../ilogbf.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  ldexp
+  SRCS
+    ../ldexp.cpp
+  HDRS
+    ../../../ldexp.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(...
<truncated>
</pre>

</details>

https://github.com/llvm/llvm-project/pull/66133


More information about the libc-commits mailing list