Skip to content

Conversation

@leandrolcampos
Copy link
Contributor

@leandrolcampos leandrolcampos commented Aug 3, 2025

This patch adds the tanpif math functions to the GPU build. It also adds the cospif and sinpif math functions to the math.h header.

@llvmbot
Copy link
Member

llvmbot commented Aug 3, 2025

@llvm/pr-subscribers-backend-amdgpu

Author: Leandro Lacerda (leandrolcampos)

Changes

This patch adds the exp10m1f and tanpif math functions to the GPU build. These should all pass except exp10m1f on NVPTX for some reason. We need to investigate that later.

It also adds the cospif and sinpif math functions to the math.h header.


Full diff: https://github.com/llvm/llvm-project/pull/151841.diff

3 Files Affected:

  • (modified) libc/config/gpu/amdgpu/entrypoints.txt (+2)
  • (modified) libc/config/gpu/nvptx/entrypoints.txt (+2)
  • (modified) libc/include/math.yaml (+12)
diff --git a/libc/config/gpu/amdgpu/entrypoints.txt b/libc/config/gpu/amdgpu/entrypoints.txt
index e39819dd85b72..2f909e2e38026 100644
--- a/libc/config/gpu/amdgpu/entrypoints.txt
+++ b/libc/config/gpu/amdgpu/entrypoints.txt
@@ -314,6 +314,7 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.exp
     libc.src.math.exp10
     libc.src.math.exp10f
+    libc.src.math.exp10m1f
     libc.src.math.exp2
     libc.src.math.exp2f
     libc.src.math.exp2m1f
@@ -489,6 +490,7 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.tan
     libc.src.math.tanf
     libc.src.math.tanhf
+    libc.src.math.tanpif
     libc.src.math.tgamma
     libc.src.math.tgammaf
     libc.src.math.totalorder
diff --git a/libc/config/gpu/nvptx/entrypoints.txt b/libc/config/gpu/nvptx/entrypoints.txt
index 26e3b1547c98a..9d0200eb6dbe2 100644
--- a/libc/config/gpu/nvptx/entrypoints.txt
+++ b/libc/config/gpu/nvptx/entrypoints.txt
@@ -314,6 +314,7 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.exp
     libc.src.math.exp10
     libc.src.math.exp10f
+    # libc.src.math.exp10m1f
     libc.src.math.exp2
     libc.src.math.exp2f
     libc.src.math.exp2m1f
@@ -490,6 +491,7 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.tan
     libc.src.math.tanf
     libc.src.math.tanhf
+    libc.src.math.tanpif
     libc.src.math.tgamma
     libc.src.math.tgammaf
     libc.src.math.totalorder
diff --git a/libc/include/math.yaml b/libc/include/math.yaml
index 007be235f4380..e8ac7ee5033db 100644
--- a/libc/include/math.yaml
+++ b/libc/include/math.yaml
@@ -283,6 +283,12 @@ functions:
     return_type: float
     arguments:
       - type: float
+  - name: cospif
+    standards:
+      - stdc
+    return_type: float
+    arguments:
+      - type: float
   - name: cospif16
     standards:
       - stdc
@@ -2453,6 +2459,12 @@ functions:
     arguments:
       - type: _Float16
     guard: LIBC_TYPES_HAS_FLOAT16
+  - name: sinpif
+    standards:
+      - stdc
+    return_type: float
+    arguments:
+      - type: float
   - name: sinpif16
     standards:
       - stdc

@llvmbot
Copy link
Member

llvmbot commented Aug 3, 2025

@llvm/pr-subscribers-libc

Author: Leandro Lacerda (leandrolcampos)

Changes

This patch adds the exp10m1f and tanpif math functions to the GPU build. These should all pass except exp10m1f on NVPTX for some reason. We need to investigate that later.

It also adds the cospif and sinpif math functions to the math.h header.


Full diff: https://github.com/llvm/llvm-project/pull/151841.diff

3 Files Affected:

  • (modified) libc/config/gpu/amdgpu/entrypoints.txt (+2)
  • (modified) libc/config/gpu/nvptx/entrypoints.txt (+2)
  • (modified) libc/include/math.yaml (+12)
diff --git a/libc/config/gpu/amdgpu/entrypoints.txt b/libc/config/gpu/amdgpu/entrypoints.txt
index e39819dd85b72..2f909e2e38026 100644
--- a/libc/config/gpu/amdgpu/entrypoints.txt
+++ b/libc/config/gpu/amdgpu/entrypoints.txt
@@ -314,6 +314,7 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.exp
     libc.src.math.exp10
     libc.src.math.exp10f
+    libc.src.math.exp10m1f
     libc.src.math.exp2
     libc.src.math.exp2f
     libc.src.math.exp2m1f
@@ -489,6 +490,7 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.tan
     libc.src.math.tanf
     libc.src.math.tanhf
+    libc.src.math.tanpif
     libc.src.math.tgamma
     libc.src.math.tgammaf
     libc.src.math.totalorder
diff --git a/libc/config/gpu/nvptx/entrypoints.txt b/libc/config/gpu/nvptx/entrypoints.txt
index 26e3b1547c98a..9d0200eb6dbe2 100644
--- a/libc/config/gpu/nvptx/entrypoints.txt
+++ b/libc/config/gpu/nvptx/entrypoints.txt
@@ -314,6 +314,7 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.exp
     libc.src.math.exp10
     libc.src.math.exp10f
+    # libc.src.math.exp10m1f
     libc.src.math.exp2
     libc.src.math.exp2f
     libc.src.math.exp2m1f
@@ -490,6 +491,7 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.tan
     libc.src.math.tanf
     libc.src.math.tanhf
+    libc.src.math.tanpif
     libc.src.math.tgamma
     libc.src.math.tgammaf
     libc.src.math.totalorder
diff --git a/libc/include/math.yaml b/libc/include/math.yaml
index 007be235f4380..e8ac7ee5033db 100644
--- a/libc/include/math.yaml
+++ b/libc/include/math.yaml
@@ -283,6 +283,12 @@ functions:
     return_type: float
     arguments:
       - type: float
+  - name: cospif
+    standards:
+      - stdc
+    return_type: float
+    arguments:
+      - type: float
   - name: cospif16
     standards:
       - stdc
@@ -2453,6 +2459,12 @@ functions:
     arguments:
       - type: _Float16
     guard: LIBC_TYPES_HAS_FLOAT16
+  - name: sinpif
+    standards:
+      - stdc
+    return_type: float
+    arguments:
+      - type: float
   - name: sinpif16
     standards:
       - stdc

@leandrolcampos leandrolcampos changed the title [libc] Enable new float math functions on the GPU [libc] Enable float math functions on the GPU Aug 3, 2025
@jhuber6 jhuber6 merged commit cd19fba into llvm:main Aug 3, 2025
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants