[libc-commits] [libc] [libc] Clean up GPU math implementations (PR #83133)

via libc-commits libc-commits at lists.llvm.org
Tue Feb 27 05:51:59 PST 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 7789fb6604e5319ae46896285a264920015f8771 96d5a175e852f3dd23e8df90939ee769194ea282 -- libc/src/math/amdgpu/acos.cpp libc/src/math/amdgpu/acosf.cpp libc/src/math/amdgpu/acosh.cpp libc/src/math/amdgpu/acoshf.cpp libc/src/math/amdgpu/asin.cpp libc/src/math/amdgpu/asinf.cpp libc/src/math/amdgpu/asinh.cpp libc/src/math/amdgpu/asinhf.cpp libc/src/math/amdgpu/atan.cpp libc/src/math/amdgpu/atan2.cpp libc/src/math/amdgpu/atan2f.cpp libc/src/math/amdgpu/atanf.cpp libc/src/math/amdgpu/atanh.cpp libc/src/math/amdgpu/atanhf.cpp libc/src/math/amdgpu/cos.cpp libc/src/math/amdgpu/cosf.cpp libc/src/math/amdgpu/cosh.cpp libc/src/math/amdgpu/coshf.cpp libc/src/math/amdgpu/erf.cpp libc/src/math/amdgpu/erff.cpp libc/src/math/amdgpu/exp10.cpp libc/src/math/amdgpu/exp10f.cpp libc/src/math/amdgpu/exp2.cpp libc/src/math/amdgpu/exp2f.cpp libc/src/math/amdgpu/expm1.cpp libc/src/math/amdgpu/expm1f.cpp libc/src/math/amdgpu/fdim.cpp libc/src/math/amdgpu/fdimf.cpp libc/src/math/amdgpu/frexp.cpp libc/src/math/amdgpu/frexpf.cpp libc/src/math/amdgpu/hypot.cpp libc/src/math/amdgpu/hypotf.cpp libc/src/math/amdgpu/ilogb.cpp libc/src/math/amdgpu/ilogbf.cpp libc/src/math/amdgpu/ldexp.cpp libc/src/math/amdgpu/ldexpf.cpp libc/src/math/amdgpu/llrint.cpp libc/src/math/amdgpu/llrintf.cpp libc/src/math/amdgpu/log.cpp libc/src/math/amdgpu/log10.cpp libc/src/math/amdgpu/log10f.cpp libc/src/math/amdgpu/log1p.cpp libc/src/math/amdgpu/log1pf.cpp libc/src/math/amdgpu/log2.cpp libc/src/math/amdgpu/log2f.cpp libc/src/math/amdgpu/logb.cpp libc/src/math/amdgpu/logbf.cpp libc/src/math/amdgpu/logf.cpp libc/src/math/amdgpu/lrint.cpp libc/src/math/amdgpu/lrintf.cpp libc/src/math/amdgpu/nextafter.cpp libc/src/math/amdgpu/nextafterf.cpp libc/src/math/amdgpu/pow.cpp libc/src/math/amdgpu/powf.cpp libc/src/math/amdgpu/remquo.cpp libc/src/math/amdgpu/remquof.cpp libc/src/math/amdgpu/scalbn.cpp libc/src/math/amdgpu/scalbnf.cpp libc/src/math/amdgpu/sin.cpp libc/src/math/amdgpu/sincos.cpp libc/src/math/amdgpu/sinf.cpp libc/src/math/amdgpu/sinhf.cpp libc/src/math/amdgpu/tanf.cpp libc/src/math/amdgpu/tanhf.cpp libc/src/math/amdgpu/tgamma.cpp libc/src/math/amdgpu/tgammaf.cpp libc/src/math/nvptx/ceil.cpp libc/src/math/nvptx/ceilf.cpp libc/src/math/nvptx/copysign.cpp libc/src/math/nvptx/copysignf.cpp libc/src/math/nvptx/exp.cpp libc/src/math/nvptx/expf.cpp libc/src/math/nvptx/fabs.cpp libc/src/math/nvptx/fabsf.cpp libc/src/math/nvptx/floor.cpp libc/src/math/nvptx/floorf.cpp libc/src/math/nvptx/fma.cpp libc/src/math/nvptx/fmaf.cpp libc/src/math/nvptx/fmax.cpp libc/src/math/nvptx/fmaxf.cpp libc/src/math/nvptx/fmin.cpp libc/src/math/nvptx/fminf.cpp libc/src/math/nvptx/fmod.cpp libc/src/math/nvptx/fmodf.cpp libc/src/math/nvptx/llround.cpp libc/src/math/nvptx/llroundf.cpp libc/src/math/nvptx/lround.cpp libc/src/math/nvptx/lroundf.cpp libc/src/math/nvptx/modf.cpp libc/src/math/nvptx/modff.cpp libc/src/math/nvptx/nearbyint.cpp libc/src/math/nvptx/nearbyintf.cpp libc/src/math/nvptx/remainder.cpp libc/src/math/nvptx/remainderf.cpp libc/src/math/nvptx/rint.cpp libc/src/math/nvptx/rintf.cpp libc/src/math/nvptx/round.cpp libc/src/math/nvptx/roundf.cpp libc/src/math/nvptx/sincosf.cpp libc/src/math/nvptx/sqrt.cpp libc/src/math/nvptx/sqrtf.cpp libc/src/math/nvptx/trunc.cpp libc/src/math/nvptx/truncf.cpp libc/src/math/amdgpu/ceil.cpp libc/src/math/amdgpu/ceilf.cpp libc/src/math/amdgpu/copysign.cpp libc/src/math/amdgpu/copysignf.cpp libc/src/math/amdgpu/declarations.h libc/src/math/amdgpu/exp.cpp libc/src/math/amdgpu/expf.cpp libc/src/math/amdgpu/fabs.cpp libc/src/math/amdgpu/fabsf.cpp libc/src/math/amdgpu/floor.cpp libc/src/math/amdgpu/floorf.cpp libc/src/math/amdgpu/fma.cpp libc/src/math/amdgpu/fmaf.cpp libc/src/math/amdgpu/fmax.cpp libc/src/math/amdgpu/fmaxf.cpp libc/src/math/amdgpu/fmin.cpp libc/src/math/amdgpu/fminf.cpp libc/src/math/amdgpu/fmod.cpp libc/src/math/amdgpu/fmodf.cpp libc/src/math/amdgpu/llround.cpp libc/src/math/amdgpu/llroundf.cpp libc/src/math/amdgpu/lround.cpp libc/src/math/amdgpu/lroundf.cpp libc/src/math/amdgpu/modf.cpp libc/src/math/amdgpu/modff.cpp libc/src/math/amdgpu/nearbyint.cpp libc/src/math/amdgpu/nearbyintf.cpp libc/src/math/amdgpu/platform.h libc/src/math/amdgpu/remainder.cpp libc/src/math/amdgpu/remainderf.cpp libc/src/math/amdgpu/rint.cpp libc/src/math/amdgpu/rintf.cpp libc/src/math/amdgpu/round.cpp libc/src/math/amdgpu/roundf.cpp libc/src/math/amdgpu/sincosf.cpp libc/src/math/amdgpu/sinh.cpp libc/src/math/amdgpu/sqrt.cpp libc/src/math/amdgpu/sqrtf.cpp libc/src/math/amdgpu/tan.cpp libc/src/math/amdgpu/tanh.cpp libc/src/math/amdgpu/trunc.cpp libc/src/math/amdgpu/truncf.cpp libc/src/math/nvptx/acos.cpp libc/src/math/nvptx/acosf.cpp libc/src/math/nvptx/acosh.cpp libc/src/math/nvptx/acoshf.cpp libc/src/math/nvptx/asin.cpp libc/src/math/nvptx/asinf.cpp libc/src/math/nvptx/asinh.cpp libc/src/math/nvptx/asinhf.cpp libc/src/math/nvptx/atan.cpp libc/src/math/nvptx/atan2.cpp libc/src/math/nvptx/atan2f.cpp libc/src/math/nvptx/atanf.cpp libc/src/math/nvptx/atanh.cpp libc/src/math/nvptx/atanhf.cpp libc/src/math/nvptx/cos.cpp libc/src/math/nvptx/cosf.cpp libc/src/math/nvptx/cosh.cpp libc/src/math/nvptx/coshf.cpp libc/src/math/nvptx/declarations.h libc/src/math/nvptx/erf.cpp libc/src/math/nvptx/erff.cpp libc/src/math/nvptx/exp10.cpp libc/src/math/nvptx/exp10f.cpp libc/src/math/nvptx/exp2.cpp libc/src/math/nvptx/exp2f.cpp libc/src/math/nvptx/expm1.cpp libc/src/math/nvptx/expm1f.cpp libc/src/math/nvptx/fdim.cpp libc/src/math/nvptx/fdimf.cpp libc/src/math/nvptx/frexp.cpp libc/src/math/nvptx/frexpf.cpp libc/src/math/nvptx/hypot.cpp libc/src/math/nvptx/hypotf.cpp libc/src/math/nvptx/ilogb.cpp libc/src/math/nvptx/ilogbf.cpp libc/src/math/nvptx/ldexp.cpp libc/src/math/nvptx/ldexpf.cpp libc/src/math/nvptx/llrint.cpp libc/src/math/nvptx/llrintf.cpp libc/src/math/nvptx/log.cpp libc/src/math/nvptx/log10.cpp libc/src/math/nvptx/log10f.cpp libc/src/math/nvptx/log1p.cpp libc/src/math/nvptx/log1pf.cpp libc/src/math/nvptx/log2.cpp libc/src/math/nvptx/log2f.cpp libc/src/math/nvptx/logb.cpp libc/src/math/nvptx/logbf.cpp libc/src/math/nvptx/logf.cpp libc/src/math/nvptx/lrint.cpp libc/src/math/nvptx/lrintf.cpp libc/src/math/nvptx/nextafter.cpp libc/src/math/nvptx/nextafterf.cpp libc/src/math/nvptx/nvptx.h libc/src/math/nvptx/pow.cpp libc/src/math/nvptx/powf.cpp libc/src/math/nvptx/remquo.cpp libc/src/math/nvptx/remquof.cpp libc/src/math/nvptx/scalbn.cpp libc/src/math/nvptx/scalbnf.cpp libc/src/math/nvptx/sin.cpp libc/src/math/nvptx/sincos.cpp libc/src/math/nvptx/sinf.cpp libc/src/math/nvptx/sinh.cpp libc/src/math/nvptx/sinhf.cpp libc/src/math/nvptx/tan.cpp libc/src/math/nvptx/tanf.cpp libc/src/math/nvptx/tanh.cpp libc/src/math/nvptx/tanhf.cpp libc/src/math/nvptx/tgamma.cpp libc/src/math/nvptx/tgammaf.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libc/src/math/amdgpu/sincos.cpp b/libc/src/math/amdgpu/sincos.cpp
index 65eb0cad91..7cdd0d1f97 100644
--- a/libc/src/math/amdgpu/sincos.cpp
+++ b/libc/src/math/amdgpu/sincos.cpp
@@ -14,7 +14,7 @@
 namespace LIBC_NAMESPACE {
 
 LLVM_LIBC_FUNCTION(void, sincos, (double x, double *sinptr, double *cosptr)) {
-    *sinptr = __ocml_sincos_f64(x, cosptr);
+  *sinptr = __ocml_sincos_f64(x, cosptr);
 }
 
 } // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/nvptx/llrint.cpp b/libc/src/math/nvptx/llrint.cpp
index f4b07f3f79..8f95e75e77 100644
--- a/libc/src/math/nvptx/llrint.cpp
+++ b/libc/src/math/nvptx/llrint.cpp
@@ -13,8 +13,6 @@
 
 namespace LIBC_NAMESPACE {
 
-LLVM_LIBC_FUNCTION(long long, llrint, (double x)) {
-  return __nv_llrint(x);
-}
+LLVM_LIBC_FUNCTION(long long, llrint, (double x)) { return __nv_llrint(x); }
 
 } // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/nvptx/llrintf.cpp b/libc/src/math/nvptx/llrintf.cpp
index 4341b20284..1432ffbd1b 100644
--- a/libc/src/math/nvptx/llrintf.cpp
+++ b/libc/src/math/nvptx/llrintf.cpp
@@ -13,8 +13,6 @@
 
 namespace LIBC_NAMESPACE {
 
-LLVM_LIBC_FUNCTION(long long, llrintf, (float x)) {
-  return __nv_llrintf(x);
-}
+LLVM_LIBC_FUNCTION(long long, llrintf, (float x)) { return __nv_llrintf(x); }
 
 } // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/nvptx/pow.cpp b/libc/src/math/nvptx/pow.cpp
index 2ddf8841d4..7de3c9e7e5 100644
--- a/libc/src/math/nvptx/pow.cpp
+++ b/libc/src/math/nvptx/pow.cpp
@@ -13,8 +13,6 @@
 
 namespace LIBC_NAMESPACE {
 
-LLVM_LIBC_FUNCTION(double, pow, (double x, double y)) {
-  return __nv_pow(x, y);
-}
+LLVM_LIBC_FUNCTION(double, pow, (double x, double y)) { return __nv_pow(x, y); }
 
 } // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/nvptx/powf.cpp b/libc/src/math/nvptx/powf.cpp
index 851d936b23..f9f7dbae63 100644
--- a/libc/src/math/nvptx/powf.cpp
+++ b/libc/src/math/nvptx/powf.cpp
@@ -13,8 +13,6 @@
 
 namespace LIBC_NAMESPACE {
 
-LLVM_LIBC_FUNCTION(float, powf, (float x, float y)) {
-  return __nv_powf(x, y);
-}
+LLVM_LIBC_FUNCTION(float, powf, (float x, float y)) { return __nv_powf(x, y); }
 
 } // namespace LIBC_NAMESPACE

``````````

</details>


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


More information about the libc-commits mailing list