[PATCH] D85910: libclc: Add a __builtin to let SPIRV targets select between SW and HW FMA
Daniel Stone via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 11 08:40:30 PDT 2020
daniels updated this revision to Diff 291232.
daniels added a comment.
Change __builtin to __clc_runtime
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D85910/new/
https://reviews.llvm.org/D85910
Files:
libclc/generic/lib/math/math.h
libclc/spirv/lib/math/fma.cl
libclc/spirv64/lib/math/fma.cl
Index: libclc/spirv64/lib/math/fma.cl
===================================================================
--- libclc/spirv64/lib/math/fma.cl
+++ libclc/spirv64/lib/math/fma.cl
@@ -4,3 +4,8 @@
#define __CLC_BODY <fma.inc>
#define __FLOAT_ONLY
#include <clc/math/gentype.inc>
+
+bool __clc_runtime_has_hw_fma32()
+{
+ return false;
+}
Index: libclc/spirv/lib/math/fma.cl
===================================================================
--- libclc/spirv/lib/math/fma.cl
+++ libclc/spirv/lib/math/fma.cl
@@ -4,3 +4,8 @@
#define __CLC_BODY <fma.inc>
#define __FLOAT_ONLY
#include <clc/math/gentype.inc>
+
+bool __clc_runtime_has_hw_fma32()
+{
+ return false;
+}
Index: libclc/generic/lib/math/math.h
===================================================================
--- libclc/generic/lib/math/math.h
+++ libclc/generic/lib/math/math.h
@@ -40,6 +40,9 @@
#if (defined __AMDGCN__ || defined __R600__) && !defined __HAS_FMAF__
#define HAVE_HW_FMA32() (0)
+#elif defined CLC_SPIRV || defined CLC_SPIRV64
+bool __attribute__((noinline)) __clc_runtime_has_hw_fma32(void);
+#define HAVE_HW_FMA32() __clc_runtime_has_hw_fma32()
#else
#define HAVE_HW_FMA32() (1)
#endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85910.291232.patch
Type: text/x-patch
Size: 1180 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200911/1c41beeb/attachment.bin>
More information about the llvm-commits
mailing list