[libclc] d5ed2cc - libclc: Use elementwise exp for exp functions (#185626)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 10 05:19:27 PDT 2026
Author: Matt Arsenault
Date: 2026-03-10T12:19:22Z
New Revision: d5ed2cc53ac79e9f5dee6b5cbfd756be3645d550
URL: https://github.com/llvm/llvm-project/commit/d5ed2cc53ac79e9f5dee6b5cbfd756be3645d550
DIFF: https://github.com/llvm/llvm-project/commit/d5ed2cc53ac79e9f5dee6b5cbfd756be3645d550.diff
LOG: libclc: Use elementwise exp for exp functions (#185626)
For amdgpu use the exp intrinisc. Really, this should be
the default generic implementation. But we're stuck in a
mess where essentially nothing works. All of the exp
intrinsics work for AMDGPU, but aren't really implemented
for spirv or nvptx. Ideally the intrinsic and/or libm call
would be the default implementation.
Added:
libclc/clc/lib/amdgpu/math/clc_exp.cl
libclc/clc/lib/amdgpu/math/clc_exp10.cl
libclc/clc/lib/amdgpu/math/clc_exp2.cl
Modified:
libclc/clc/lib/amdgpu/CMakeLists.txt
Removed:
################################################################################
diff --git a/libclc/clc/lib/amdgpu/CMakeLists.txt b/libclc/clc/lib/amdgpu/CMakeLists.txt
index cfed021d8fc26..f593bc6fdd8cf 100644
--- a/libclc/clc/lib/amdgpu/CMakeLists.txt
+++ b/libclc/clc/lib/amdgpu/CMakeLists.txt
@@ -1,6 +1,9 @@
libclc_configure_source_list(CLC_AMDGPU_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}
address_space/qualifier.cl
+ math/clc_exp.cl
+ math/clc_exp2.cl
+ math/clc_exp10.cl
math/clc_half_exp.cl
math/clc_half_exp2.cl
math/clc_half_exp10.cl
diff --git a/libclc/clc/lib/amdgpu/math/clc_exp.cl b/libclc/clc/lib/amdgpu/math/clc_exp.cl
new file mode 100644
index 0000000000000..ae82bbb3a5c61
--- /dev/null
+++ b/libclc/clc/lib/amdgpu/math/clc_exp.cl
@@ -0,0 +1,15 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 "clc/math/clc_exp.h"
+
+#define __CLC_FUNCTION __clc_exp
+#define __CLC_IMPL_FUNCTION(x) __builtin_elementwise_exp
+#define __CLC_BODY <clc/shared/unary_def.inc>
+
+#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/amdgpu/math/clc_exp10.cl b/libclc/clc/lib/amdgpu/math/clc_exp10.cl
new file mode 100644
index 0000000000000..b7fc6bf8cabbe
--- /dev/null
+++ b/libclc/clc/lib/amdgpu/math/clc_exp10.cl
@@ -0,0 +1,15 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 "clc/math/clc_exp10.h"
+
+#define __CLC_FUNCTION __clc_exp10
+#define __CLC_IMPL_FUNCTION(x) __builtin_elementwise_exp10
+#define __CLC_BODY <clc/shared/unary_def.inc>
+
+#include <clc/math/gentype.inc>
diff --git a/libclc/clc/lib/amdgpu/math/clc_exp2.cl b/libclc/clc/lib/amdgpu/math/clc_exp2.cl
new file mode 100644
index 0000000000000..4b351fdd935fa
--- /dev/null
+++ b/libclc/clc/lib/amdgpu/math/clc_exp2.cl
@@ -0,0 +1,15 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 "clc/math/clc_exp2.h"
+
+#define __CLC_FUNCTION __clc_exp2
+#define __CLC_IMPL_FUNCTION(x) __builtin_elementwise_exp2
+#define __CLC_BODY <clc/shared/unary_def.inc>
+
+#include <clc/math/gentype.inc>
More information about the cfe-commits
mailing list