[PATCH] D85910: libclc: Add a __builtin to let SPIRV targets select between SW and HW FMA

Jan Vesely via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 15 22:39:15 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG291bfff5dbb7: libclc: Add a __builtin to let SPIRV targets select between SW and HW FMA (authored by daniels, committed by jvesely).

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.292111.patch
Type: text/x-patch
Size: 1180 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200916/fa320db7/attachment.bin>


More information about the llvm-commits mailing list