[libclc] 14/92: vstore: Cleanup and add vstore(half)

Andreas Boll aboll-guest at moszumanska.debian.org
Mon Nov 6 15:11:56 UTC 2017


This is an automated email from the git hooks/post-receive script.

aboll-guest pushed a commit to branch master
in repository libclc.

commit 52106a29523543a7becb879110f14c27eddd4033
Author: Jan Vesely <jan.vesely at rutgers.edu>
Date:   Fri Sep 8 23:58:57 2017 +0000

    vstore: Cleanup and add vstore(half)
    
    Add missing undefs
    Make helpers amdgpu specific (NVPTX uses different numbering for private AS)
    Use clang builtins on clang >= 6
    
    Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
    Reviewed-by: Tom Stellard <tstellar at redhat.com>
    
    git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@312838 91177308-0d34-0410-b5e6-96231b3b80d8
---
 amdgpu/lib/SOURCES_4.0                             |  1 +
 amdgpu/lib/SOURCES_5.0                             |  1 +
 .../lib/shared/vstore_half_helpers.ll              |  0
 generic/include/clc/shared/vstore.h                | 11 +++++-
 generic/lib/SOURCES                                |  1 -
 generic/lib/shared/vstore.cl                       | 43 +++++++++++++++++-----
 6 files changed, 45 insertions(+), 12 deletions(-)

diff --git a/amdgpu/lib/SOURCES_4.0 b/amdgpu/lib/SOURCES_4.0
new file mode 100644
index 0000000..5851798
--- /dev/null
+++ b/amdgpu/lib/SOURCES_4.0
@@ -0,0 +1 @@
+shared/vstore_half_helpers.ll
diff --git a/amdgpu/lib/SOURCES_5.0 b/amdgpu/lib/SOURCES_5.0
new file mode 100644
index 0000000..5851798
--- /dev/null
+++ b/amdgpu/lib/SOURCES_5.0
@@ -0,0 +1 @@
+shared/vstore_half_helpers.ll
diff --git a/generic/lib/shared/vstore_half_helpers.ll b/amdgpu/lib/shared/vstore_half_helpers.ll
similarity index 100%
rename from generic/lib/shared/vstore_half_helpers.ll
rename to amdgpu/lib/shared/vstore_half_helpers.ll
diff --git a/generic/include/clc/shared/vstore.h b/generic/include/clc/shared/vstore.h
index b450491..0e3f694 100644
--- a/generic/include/clc/shared/vstore.h
+++ b/generic/include/clc/shared/vstore.h
@@ -29,7 +29,6 @@
     _CLC_VECTOR_VSTORE_PRIM3(_half, half, float)
 
 #ifdef cl_khr_fp64
-#pragma OPENCL EXTENSION cl_khr_fp64: enable
   _CLC_VECTOR_VSTORE_PRIM1(double)
   _CLC_VECTOR_VSTORE_PRIM3(_half, half, double)
   _CLC_VSTORE_DECL(_half, half, double, , __private)
@@ -37,7 +36,17 @@
   _CLC_VSTORE_DECL(_half, half, double, , __global)
 #endif
 
+#ifdef cl_khr_fp16
+  _CLC_VECTOR_VSTORE_PRIM1(half)
+#endif
+
 _CLC_VECTOR_VSTORE_PRIM()
 _CLC_VSTORE_DECL(_half, half, float, , __private)
 _CLC_VSTORE_DECL(_half, half, float, , __local)
 _CLC_VSTORE_DECL(_half, half, float, , __global)
+
+#undef _CLC_VSTORE_DECL
+#undef _CLC_VECTOR_VSTORE_DECL
+#undef _CLC_VECTOR_VSTORE_PRIM3
+#undef _CLC_VECTOR_VSTORE_PRIM1
+#undef _CLC_VECTOR_VSTORE_PRIM
diff --git a/generic/lib/SOURCES b/generic/lib/SOURCES
index 8297480..f665ce2 100644
--- a/generic/lib/SOURCES
+++ b/generic/lib/SOURCES
@@ -147,7 +147,6 @@ shared/max.cl
 shared/min.cl
 shared/vload.cl
 shared/vstore.cl
-shared/vstore_half_helpers.ll
 workitem/get_global_id.cl
 workitem/get_global_size.cl
 image/get_image_dim.cl
diff --git a/generic/lib/shared/vstore.cl b/generic/lib/shared/vstore.cl
index 2838384..3343c16 100644
--- a/generic/lib/shared/vstore.cl
+++ b/generic/lib/shared/vstore.cl
@@ -50,23 +50,34 @@ VSTORE_TYPES()
 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
     VSTORE_ADDR_SPACES(double)
 #endif
+#ifdef cl_khr_fp16
+#pragma OPENCL EXTENSION cl_khr_fp16 : enable
+    VSTORE_ADDR_SPACES(half)
+#endif
 
 /* vstore_half are legal even without cl_khr_fp16 */
-#define DECLARE_HELPER(STYPE, AS) void __clc_vstore_half_##STYPE##_helper##AS(STYPE, AS half *);
+#if __clang_major__ < 6
+#define DECLARE_HELPER(STYPE, AS, builtin) void __clc_vstore_half_##STYPE##_helper##AS(STYPE, AS half *);
+#else
+#define DECLARE_HELPER(STYPE, AS, __builtin) \
+inline void __clc_vstore_half_##STYPE##_helper##AS(STYPE s, AS half *d) \
+{ \
+	__builtin(s, d); \
+}
+#endif
 
-DECLARE_HELPER(float, __private);
-DECLARE_HELPER(float, __global);
-DECLARE_HELPER(float, __local);
+DECLARE_HELPER(float, __private, __builtin_store_halff);
+DECLARE_HELPER(float, __global, __builtin_store_halff);
+DECLARE_HELPER(float, __local, __builtin_store_halff);
 
 #ifdef cl_khr_fp64
-#pragma OPENCL EXTENSION cl_khr_fp64 : enable
-DECLARE_HELPER(double, __private);
-DECLARE_HELPER(double, __global);
-DECLARE_HELPER(double, __local);
+DECLARE_HELPER(double, __private, __builtin_store_half);
+DECLARE_HELPER(double, __global, __builtin_store_half);
+DECLARE_HELPER(double, __local, __builtin_store_half);
 #endif
 
-
 #define VEC_STORE1(STYPE, AS, val) __clc_vstore_half_##STYPE##_helper##AS (val, &mem[offset++]);
+
 #define VEC_STORE2(STYPE, AS, val) \
 	VEC_STORE1(STYPE, AS, val.lo) \
 	VEC_STORE1(STYPE, AS, val.hi)
@@ -94,4 +105,16 @@ DECLARE_HELPER(double, __local);
 
 #define __CLC_BODY "vstore_half.inc"
 #include <clc/math/gentype.inc>
-
+#undef __CLC_BODY
+#undef FUNC
+#undef __FUNC
+#undef VEC_LOAD16
+#undef VEC_LOAD8
+#undef VEC_LOAD4
+#undef VEC_LOAD3
+#undef VEC_LOAD2
+#undef VEC_LOAD1
+#undef DECLARE_HELPER
+#undef VSTORE_TYPES
+#undef VSTORE_ADDR_SPACES
+#undef VSTORE_VECTORIZE

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opencl/libclc.git



More information about the Pkg-opencl-commits mailing list