[libclc] r217911 - atomic: define extension functions for existing atomic implementations

Aaron Watry awatry at gmail.com
Tue Sep 16 15:34:21 PDT 2014


Author: awatry
Date: Tue Sep 16 17:34:21 2014
New Revision: 217911

URL: http://llvm.org/viewvc/llvm-project?rev=217911&view=rev
Log:
atomic: define extension functions for existing atomic implementations

We were missing the local versions of the atom_* before

Signed-off-by: Aaron Watry <awatry at gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard at amd.com>

Added:
    libclc/trunk/generic/include/clc/cl_khr_local_int32_base_atomics/
    libclc/trunk/generic/include/clc/cl_khr_local_int32_base_atomics/atom_add.h
    libclc/trunk/generic/include/clc/cl_khr_local_int32_base_atomics/atom_dec.h
    libclc/trunk/generic/include/clc/cl_khr_local_int32_base_atomics/atom_inc.h
    libclc/trunk/generic/include/clc/cl_khr_local_int32_base_atomics/atom_sub.h
    libclc/trunk/generic/lib/cl_khr_local_int32_base_atomics/
    libclc/trunk/generic/lib/cl_khr_local_int32_base_atomics/atom_add.cl
    libclc/trunk/generic/lib/cl_khr_local_int32_base_atomics/atom_dec.cl
    libclc/trunk/generic/lib/cl_khr_local_int32_base_atomics/atom_inc.cl
    libclc/trunk/generic/lib/cl_khr_local_int32_base_atomics/atom_sub.cl
Modified:
    libclc/trunk/generic/include/clc/clc.h
    libclc/trunk/generic/lib/SOURCES

Added: libclc/trunk/generic/include/clc/cl_khr_local_int32_base_atomics/atom_add.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/cl_khr_local_int32_base_atomics/atom_add.h?rev=217911&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/cl_khr_local_int32_base_atomics/atom_add.h (added)
+++ libclc/trunk/generic/include/clc/cl_khr_local_int32_base_atomics/atom_add.h Tue Sep 16 17:34:21 2014
@@ -0,0 +1,2 @@
+_CLC_OVERLOAD _CLC_DECL int atom_add(local int *p, int val);
+_CLC_OVERLOAD _CLC_DECL unsigned int atom_add(local unsigned int *p, unsigned int val);

Added: libclc/trunk/generic/include/clc/cl_khr_local_int32_base_atomics/atom_dec.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/cl_khr_local_int32_base_atomics/atom_dec.h?rev=217911&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/cl_khr_local_int32_base_atomics/atom_dec.h (added)
+++ libclc/trunk/generic/include/clc/cl_khr_local_int32_base_atomics/atom_dec.h Tue Sep 16 17:34:21 2014
@@ -0,0 +1,2 @@
+_CLC_OVERLOAD _CLC_DECL int atom_dec(local int *p);
+_CLC_OVERLOAD _CLC_DECL unsigned int atom_dec(local unsigned int *p);

Added: libclc/trunk/generic/include/clc/cl_khr_local_int32_base_atomics/atom_inc.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/cl_khr_local_int32_base_atomics/atom_inc.h?rev=217911&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/cl_khr_local_int32_base_atomics/atom_inc.h (added)
+++ libclc/trunk/generic/include/clc/cl_khr_local_int32_base_atomics/atom_inc.h Tue Sep 16 17:34:21 2014
@@ -0,0 +1,2 @@
+_CLC_OVERLOAD _CLC_DECL int atom_inc(local int *p);
+_CLC_OVERLOAD _CLC_DECL unsigned int atom_inc(local unsigned int *p);

Added: libclc/trunk/generic/include/clc/cl_khr_local_int32_base_atomics/atom_sub.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/cl_khr_local_int32_base_atomics/atom_sub.h?rev=217911&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/cl_khr_local_int32_base_atomics/atom_sub.h (added)
+++ libclc/trunk/generic/include/clc/cl_khr_local_int32_base_atomics/atom_sub.h Tue Sep 16 17:34:21 2014
@@ -0,0 +1,2 @@
+_CLC_OVERLOAD _CLC_DECL int atom_sub(local int *p, int val);
+_CLC_OVERLOAD _CLC_DECL unsigned int atom_sub(local unsigned int *p, unsigned int val);

Modified: libclc/trunk/generic/include/clc/clc.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clc.h?rev=217911&r1=217910&r2=217911&view=diff
==============================================================================
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Tue Sep 16 17:34:21 2014
@@ -151,6 +151,12 @@
 #include <clc/cl_khr_global_int32_base_atomics/atom_inc.h>
 #include <clc/cl_khr_global_int32_base_atomics/atom_sub.h>
 
+#include <clc/cl_khr_local_int32_base_atomics/atom_add.h>
+#include <clc/cl_khr_local_int32_base_atomics/atom_dec.h>
+#include <clc/cl_khr_local_int32_base_atomics/atom_inc.h>
+#include <clc/cl_khr_local_int32_base_atomics/atom_sub.h>
+
+
 /* libclc internal defintions */
 #ifdef __CLC_INTERNAL
 #include <math/clc_nextafter.h>

Modified: libclc/trunk/generic/lib/SOURCES
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=217911&r1=217910&r2=217911&view=diff
==============================================================================
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Tue Sep 16 17:34:21 2014
@@ -4,6 +4,10 @@ cl_khr_global_int32_base_atomics/atom_ad
 cl_khr_global_int32_base_atomics/atom_dec.cl
 cl_khr_global_int32_base_atomics/atom_inc.cl
 cl_khr_global_int32_base_atomics/atom_sub.cl
+cl_khr_local_int32_base_atomics/atom_add.cl
+cl_khr_local_int32_base_atomics/atom_dec.cl
+cl_khr_local_int32_base_atomics/atom_inc.cl
+cl_khr_local_int32_base_atomics/atom_sub.cl
 convert.cl
 common/sign.cl
 geometric/cross.cl

Added: libclc/trunk/generic/lib/cl_khr_local_int32_base_atomics/atom_add.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/cl_khr_local_int32_base_atomics/atom_add.cl?rev=217911&view=auto
==============================================================================
--- libclc/trunk/generic/lib/cl_khr_local_int32_base_atomics/atom_add.cl (added)
+++ libclc/trunk/generic/lib/cl_khr_local_int32_base_atomics/atom_add.cl Tue Sep 16 17:34:21 2014
@@ -0,0 +1,9 @@
+#include <clc/clc.h>
+
+#define IMPL(TYPE) \
+_CLC_OVERLOAD _CLC_DEF TYPE atom_add(local TYPE *p, TYPE val) { \
+  return atomic_add(p, val); \
+}
+
+IMPL(int)
+IMPL(unsigned int)

Added: libclc/trunk/generic/lib/cl_khr_local_int32_base_atomics/atom_dec.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/cl_khr_local_int32_base_atomics/atom_dec.cl?rev=217911&view=auto
==============================================================================
--- libclc/trunk/generic/lib/cl_khr_local_int32_base_atomics/atom_dec.cl (added)
+++ libclc/trunk/generic/lib/cl_khr_local_int32_base_atomics/atom_dec.cl Tue Sep 16 17:34:21 2014
@@ -0,0 +1,9 @@
+#include <clc/clc.h>
+
+#define IMPL(TYPE) \
+_CLC_OVERLOAD _CLC_DEF TYPE atom_dec(local TYPE *p) { \
+  return atom_sub(p, 1); \
+}
+
+IMPL(int)
+IMPL(unsigned int)

Added: libclc/trunk/generic/lib/cl_khr_local_int32_base_atomics/atom_inc.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/cl_khr_local_int32_base_atomics/atom_inc.cl?rev=217911&view=auto
==============================================================================
--- libclc/trunk/generic/lib/cl_khr_local_int32_base_atomics/atom_inc.cl (added)
+++ libclc/trunk/generic/lib/cl_khr_local_int32_base_atomics/atom_inc.cl Tue Sep 16 17:34:21 2014
@@ -0,0 +1,9 @@
+#include <clc/clc.h>
+
+#define IMPL(TYPE) \
+_CLC_OVERLOAD _CLC_DEF TYPE atom_inc(local TYPE *p) { \
+  return atom_add(p, 1); \
+}
+
+IMPL(int)
+IMPL(unsigned int)

Added: libclc/trunk/generic/lib/cl_khr_local_int32_base_atomics/atom_sub.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/cl_khr_local_int32_base_atomics/atom_sub.cl?rev=217911&view=auto
==============================================================================
--- libclc/trunk/generic/lib/cl_khr_local_int32_base_atomics/atom_sub.cl (added)
+++ libclc/trunk/generic/lib/cl_khr_local_int32_base_atomics/atom_sub.cl Tue Sep 16 17:34:21 2014
@@ -0,0 +1,9 @@
+#include <clc/clc.h>
+
+#define IMPL(TYPE) \
+_CLC_OVERLOAD _CLC_DEF TYPE atom_sub(local TYPE *p, TYPE val) { \
+  return atomic_sub(p, val); \
+}
+
+IMPL(int)
+IMPL(unsigned int)





More information about the cfe-commits mailing list