[Libclc-dev] [PATCH] atomics: redefine atom_inc/atom_dec using atom_add/atom_sub
Jan Vesely via Libclc-dev
libclc-dev at lists.llvm.org
Wed Jun 21 07:16:53 PDT 2017
On Tue, 2017-06-20 at 21:11 -0500, Aaron Watry via Libclc-dev wrote:
> This is exactly what the atomic_[inc|dec] functions do, and it fixes
> kernel compilation failures using the OpenCL CTS.
what are the compilation failures? I thought piglit had these ops
covered.
>
> Signed-off-by: Aaron Watry <awatry at gmail.com>
> ---
> generic/include/clc/cl_khr_global_int32_base_atomics/atom_dec.h | 3 +--
> generic/include/clc/cl_khr_global_int32_base_atomics/atom_inc.h | 3 +--
> generic/include/clc/cl_khr_local_int32_base_atomics/atom_dec.h | 3 +--
> generic/include/clc/cl_khr_local_int32_base_atomics/atom_inc.h | 3 +--
> generic/lib/SOURCES | 4 ----
> generic/lib/cl_khr_global_int32_base_atomics/atom_dec.cl | 9 ---------
> generic/lib/cl_khr_global_int32_base_atomics/atom_inc.cl | 9 ---------
> generic/lib/cl_khr_local_int32_base_atomics/atom_dec.cl | 9 ---------
> generic/lib/cl_khr_local_int32_base_atomics/atom_inc.cl | 9 ---------
> 9 files changed, 4 insertions(+), 48 deletions(-)
> delete mode 100644 generic/lib/cl_khr_global_int32_base_atomics/atom_dec.cl
> delete mode 100644 generic/lib/cl_khr_global_int32_base_atomics/atom_inc.cl
> delete mode 100644 generic/lib/cl_khr_local_int32_base_atomics/atom_dec.cl
> delete mode 100644 generic/lib/cl_khr_local_int32_base_atomics/atom_inc.cl
>
> diff --git a/generic/include/clc/cl_khr_global_int32_base_atomics/atom_dec.h b/generic/include/clc/cl_khr_global_int32_base_atomics/atom_dec.h
> index bbc872c..a520fe4 100644
> --- a/generic/include/clc/cl_khr_global_int32_base_atomics/atom_dec.h
> +++ b/generic/include/clc/cl_khr_global_int32_base_atomics/atom_dec.h
> @@ -1,2 +1 @@
> -_CLC_OVERLOAD _CLC_DECL int atom_dec(global int *p);
> -_CLC_OVERLOAD _CLC_DECL unsigned int atom_dec(global unsigned int *p);
> +#define atom_dec(p) atom_sub(p, 1)
Does this not cause redefinition warning (since local version uses the
same define?
Jan
> diff --git a/generic/include/clc/cl_khr_global_int32_base_atomics/atom_inc.h b/generic/include/clc/cl_khr_global_int32_base_atomics/atom_inc.h
> index 050747c..2b4436d 100644
> --- a/generic/include/clc/cl_khr_global_int32_base_atomics/atom_inc.h
> +++ b/generic/include/clc/cl_khr_global_int32_base_atomics/atom_inc.h
> @@ -1,2 +1 @@
> -_CLC_OVERLOAD _CLC_DECL int atom_inc(global int *p);
> -_CLC_OVERLOAD _CLC_DECL unsigned int atom_inc(global unsigned int *p);
> +#define atom_inc(p) atom_add(p, 1)
> diff --git a/generic/include/clc/cl_khr_local_int32_base_atomics/atom_dec.h b/generic/include/clc/cl_khr_local_int32_base_atomics/atom_dec.h
> index e74d8fc..a520fe4 100644
> --- a/generic/include/clc/cl_khr_local_int32_base_atomics/atom_dec.h
> +++ b/generic/include/clc/cl_khr_local_int32_base_atomics/atom_dec.h
> @@ -1,2 +1 @@
> -_CLC_OVERLOAD _CLC_DECL int atom_dec(local int *p);
> -_CLC_OVERLOAD _CLC_DECL unsigned int atom_dec(local unsigned int *p);
> +#define atom_dec(p) atom_sub(p, 1)
> diff --git a/generic/include/clc/cl_khr_local_int32_base_atomics/atom_inc.h b/generic/include/clc/cl_khr_local_int32_base_atomics/atom_inc.h
> index 718f1f2..2b4436d 100644
> --- a/generic/include/clc/cl_khr_local_int32_base_atomics/atom_inc.h
> +++ b/generic/include/clc/cl_khr_local_int32_base_atomics/atom_inc.h
> @@ -1,2 +1 @@
> -_CLC_OVERLOAD _CLC_DECL int atom_inc(local int *p);
> -_CLC_OVERLOAD _CLC_DECL unsigned int atom_inc(local unsigned int *p);
> +#define atom_inc(p) atom_add(p, 1)
> diff --git a/generic/lib/SOURCES b/generic/lib/SOURCES
> index 9e0157b..3386e8d 100644
> --- a/generic/lib/SOURCES
> +++ b/generic/lib/SOURCES
> @@ -8,8 +8,6 @@ atomic/atomic_xchg.cl
> atomic/atomic_impl.ll
> cl_khr_global_int32_base_atomics/atom_add.cl
> cl_khr_global_int32_base_atomics/atom_cmpxchg.cl
> -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_global_int32_base_atomics/atom_xchg.cl
> cl_khr_global_int32_extended_atomics/atom_and.cl
> @@ -19,8 +17,6 @@ cl_khr_global_int32_extended_atomics/atom_or.cl
> cl_khr_global_int32_extended_atomics/atom_xor.cl
> cl_khr_local_int32_base_atomics/atom_add.cl
> cl_khr_local_int32_base_atomics/atom_cmpxchg.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
> cl_khr_local_int32_base_atomics/atom_xchg.cl
> cl_khr_local_int32_extended_atomics/atom_and.cl
> diff --git a/generic/lib/cl_khr_global_int32_base_atomics/atom_dec.cl b/generic/lib/cl_khr_global_int32_base_atomics/atom_dec.cl
> deleted file mode 100644
> index cc24d2f..0000000
> --- a/generic/lib/cl_khr_global_int32_base_atomics/atom_dec.cl
> +++ /dev/null
> @@ -1,9 +0,0 @@
> -#include <clc/clc.h>
> -
> -#define IMPL(TYPE) \
> -_CLC_OVERLOAD _CLC_DEF TYPE atom_dec(global TYPE *p) { \
> - return atom_sub(p, (TYPE)1); \
> -}
> -
> -IMPL(int)
> -IMPL(unsigned int)
> diff --git a/generic/lib/cl_khr_global_int32_base_atomics/atom_inc.cl b/generic/lib/cl_khr_global_int32_base_atomics/atom_inc.cl
> deleted file mode 100644
> index 9193ae3..0000000
> --- a/generic/lib/cl_khr_global_int32_base_atomics/atom_inc.cl
> +++ /dev/null
> @@ -1,9 +0,0 @@
> -#include <clc/clc.h>
> -
> -#define IMPL(TYPE) \
> -_CLC_OVERLOAD _CLC_DEF TYPE atom_inc(global TYPE *p) { \
> - return atom_add(p, (TYPE)1); \
> -}
> -
> -IMPL(int)
> -IMPL(unsigned int)
> diff --git a/generic/lib/cl_khr_local_int32_base_atomics/atom_dec.cl b/generic/lib/cl_khr_local_int32_base_atomics/atom_dec.cl
> deleted file mode 100644
> index cfb3d80..0000000
> --- a/generic/lib/cl_khr_local_int32_base_atomics/atom_dec.cl
> +++ /dev/null
> @@ -1,9 +0,0 @@
> -#include <clc/clc.h>
> -
> -#define IMPL(TYPE) \
> -_CLC_OVERLOAD _CLC_DEF TYPE atom_dec(local TYPE *p) { \
> - return atom_sub(p, (TYPE)1); \
> -}
> -
> -IMPL(int)
> -IMPL(unsigned int)
> diff --git a/generic/lib/cl_khr_local_int32_base_atomics/atom_inc.cl b/generic/lib/cl_khr_local_int32_base_atomics/atom_inc.cl
> deleted file mode 100644
> index 8ea4738..0000000
> --- a/generic/lib/cl_khr_local_int32_base_atomics/atom_inc.cl
> +++ /dev/null
> @@ -1,9 +0,0 @@
> -#include <clc/clc.h>
> -
> -#define IMPL(TYPE) \
> -_CLC_OVERLOAD _CLC_DEF TYPE atom_inc(local TYPE *p) { \
> - return atom_add(p, (TYPE)1); \
> -}
> -
> -IMPL(int)
> -IMPL(unsigned int)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.llvm.org/pipermail/libclc-dev/attachments/20170621/55d2221a/attachment.sig>
More information about the Libclc-dev
mailing list