[Libclc-dev] [PATCH 7/7] atom: Use volatile pointers for cl_khr_{global, local}_int32_{base, extended}_atomics
Aaron Watry via Libclc-dev
libclc-dev at lists.llvm.org
Thu Jun 21 08:04:08 PDT 2018
Series is: Tested-By/Reviewed-By: Aaron Watry <awatry at gmail.com>
I agree that the volatile pointer mismatch between spec versions is
probably just a bug/oversight in the spec document, which is why I had
sent the previous series to change this a while back.
If the CL 1.1 document had clarified this situation beyond just saying
the functions were renamed (while also silently adding the volatile
keyword), this would've been a bit easier.
--Aaron
On Wed, Jun 20, 2018 at 3:35 PM, Jan Vesely via Libclc-dev
<libclc-dev at lists.llvm.org> wrote:
> int64 versions were switched to volatile pointers in cl1.1
> cl1.1 also renamed atom_ functions to atomic_ that use volatile pointers.
> CTS and applications use volatile pointers.
>
> Passes CTS on carrizo
> no return piglit tests still pass on turks.
>
> Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
> ---
> generic/include/clc/atom_decl_int32.inc | 2 +-
> generic/include/clc/cl_khr_global_int32_base_atomics/atom_cmpxchg.h | 4 ++--
> generic/include/clc/cl_khr_global_int32_base_atomics/atom_dec.h | 4 ++--
> generic/include/clc/cl_khr_global_int32_base_atomics/atom_inc.h | 4 ++--
> generic/include/clc/cl_khr_local_int32_base_atomics/atom_cmpxchg.h | 4 ++--
> generic/include/clc/cl_khr_local_int32_base_atomics/atom_dec.h | 4 ++--
> generic/include/clc/cl_khr_local_int32_base_atomics/atom_inc.h | 4 ++--
> generic/lib/atom_int32_binary.inc | 2 +-
> generic/lib/cl_khr_global_int32_base_atomics/atom_cmpxchg.cl | 2 +-
> generic/lib/cl_khr_global_int32_base_atomics/atom_dec.cl | 2 +-
> generic/lib/cl_khr_global_int32_base_atomics/atom_inc.cl | 2 +-
> generic/lib/cl_khr_local_int32_base_atomics/atom_cmpxchg.cl | 2 +-
> generic/lib/cl_khr_local_int32_base_atomics/atom_dec.cl | 2 +-
> generic/lib/cl_khr_local_int32_base_atomics/atom_inc.cl | 2 +-
> 14 files changed, 20 insertions(+), 20 deletions(-)
>
> diff --git a/generic/include/clc/atom_decl_int32.inc b/generic/include/clc/atom_decl_int32.inc
> index dc76356..989ecfb 100644
> --- a/generic/include/clc/atom_decl_int32.inc
> +++ b/generic/include/clc/atom_decl_int32.inc
> @@ -1,5 +1,5 @@
> #define __CLC_DECLARE_ATOM(ADDRSPACE, TYPE) \
> - _CLC_OVERLOAD _CLC_DECL TYPE __CLC_FUNCTION (ADDRSPACE TYPE *, TYPE);
> + _CLC_OVERLOAD _CLC_DECL TYPE __CLC_FUNCTION (volatile ADDRSPACE TYPE *, TYPE);
>
> __CLC_DECLARE_ATOM(__CLC_ADDRESS_SPACE, int)
> __CLC_DECLARE_ATOM(__CLC_ADDRESS_SPACE, uint)
> diff --git a/generic/include/clc/cl_khr_global_int32_base_atomics/atom_cmpxchg.h b/generic/include/clc/cl_khr_global_int32_base_atomics/atom_cmpxchg.h
> index 168f423..d84a9eb 100644
> --- a/generic/include/clc/cl_khr_global_int32_base_atomics/atom_cmpxchg.h
> +++ b/generic/include/clc/cl_khr_global_int32_base_atomics/atom_cmpxchg.h
> @@ -1,2 +1,2 @@
> -_CLC_OVERLOAD _CLC_DECL int atom_cmpxchg(global int *p, int cmp, int val);
> -_CLC_OVERLOAD _CLC_DECL unsigned int atom_cmpxchg(global unsigned int *p, unsigned int cmp, unsigned int val);
> +_CLC_OVERLOAD _CLC_DECL int atom_cmpxchg(volatile global int *p, int cmp, int val);
> +_CLC_OVERLOAD _CLC_DECL unsigned int atom_cmpxchg(volatile global unsigned int *p, unsigned int cmp, unsigned int val);
> 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..d3c1c45 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,2 @@
> -_CLC_OVERLOAD _CLC_DECL int atom_dec(global int *p);
> -_CLC_OVERLOAD _CLC_DECL unsigned int atom_dec(global unsigned int *p);
> +_CLC_OVERLOAD _CLC_DECL int atom_dec(volatile global int *p);
> +_CLC_OVERLOAD _CLC_DECL unsigned int atom_dec(volatile global unsigned int *p);
> 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..712374d 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,2 @@
> -_CLC_OVERLOAD _CLC_DECL int atom_inc(global int *p);
> -_CLC_OVERLOAD _CLC_DECL unsigned int atom_inc(global unsigned int *p);
> +_CLC_OVERLOAD _CLC_DECL int atom_inc(volatile global int *p);
> +_CLC_OVERLOAD _CLC_DECL unsigned int atom_inc(volatile global unsigned int *p);
> diff --git a/generic/include/clc/cl_khr_local_int32_base_atomics/atom_cmpxchg.h b/generic/include/clc/cl_khr_local_int32_base_atomics/atom_cmpxchg.h
> index e10a84f..c967d36 100644
> --- a/generic/include/clc/cl_khr_local_int32_base_atomics/atom_cmpxchg.h
> +++ b/generic/include/clc/cl_khr_local_int32_base_atomics/atom_cmpxchg.h
> @@ -1,2 +1,2 @@
> -_CLC_OVERLOAD _CLC_DECL int atom_cmpxchg(local int *p, int cmp, int val);
> -_CLC_OVERLOAD _CLC_DECL unsigned int atom_cmpxchg(local unsigned int *p, unsigned int cmp, unsigned int val);
> +_CLC_OVERLOAD _CLC_DECL int atom_cmpxchg(volatile local int *p, int cmp, int val);
> +_CLC_OVERLOAD _CLC_DECL unsigned int atom_cmpxchg(volatile local unsigned int *p, unsigned int cmp, unsigned int val);
> 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..7bb33c9 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,2 @@
> -_CLC_OVERLOAD _CLC_DECL int atom_dec(local int *p);
> -_CLC_OVERLOAD _CLC_DECL unsigned int atom_dec(local unsigned int *p);
> +_CLC_OVERLOAD _CLC_DECL int atom_dec(volatile local int *p);
> +_CLC_OVERLOAD _CLC_DECL unsigned int atom_dec(volatile local unsigned int *p);
> 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..96e6f30 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,2 @@
> -_CLC_OVERLOAD _CLC_DECL int atom_inc(local int *p);
> -_CLC_OVERLOAD _CLC_DECL unsigned int atom_inc(local unsigned int *p);
> +_CLC_OVERLOAD _CLC_DECL int atom_inc(volatile local int *p);
> +_CLC_OVERLOAD _CLC_DECL unsigned int atom_inc(volatile local unsigned int *p);
> diff --git a/generic/lib/atom_int32_binary.inc b/generic/lib/atom_int32_binary.inc
> index 185144c..3af4c4b 100644
> --- a/generic/lib/atom_int32_binary.inc
> +++ b/generic/lib/atom_int32_binary.inc
> @@ -2,7 +2,7 @@
> #include "utils.h"
>
> #define __CLC_ATOM_IMPL(AS, TYPE) \
> -_CLC_OVERLOAD _CLC_DEF TYPE __CLC_XCONCAT(atom_, __CLC_ATOMIC_OP) (AS TYPE *p, TYPE val) { \
> +_CLC_OVERLOAD _CLC_DEF TYPE __CLC_XCONCAT(atom_, __CLC_ATOMIC_OP) (volatile AS TYPE *p, TYPE val) { \
> return __CLC_XCONCAT(atomic_, __CLC_ATOMIC_OP) (p, val); \
> }
>
> diff --git a/generic/lib/cl_khr_global_int32_base_atomics/atom_cmpxchg.cl b/generic/lib/cl_khr_global_int32_base_atomics/atom_cmpxchg.cl
> index 7647740..becf767 100644
> --- a/generic/lib/cl_khr_global_int32_base_atomics/atom_cmpxchg.cl
> +++ b/generic/lib/cl_khr_global_int32_base_atomics/atom_cmpxchg.cl
> @@ -1,7 +1,7 @@
> #include <clc/clc.h>
>
> #define IMPL(TYPE) \
> -_CLC_OVERLOAD _CLC_DEF TYPE atom_cmpxchg(global TYPE *p, TYPE cmp, TYPE val) { \
> +_CLC_OVERLOAD _CLC_DEF TYPE atom_cmpxchg(volatile global TYPE *p, TYPE cmp, TYPE val) { \
> return atomic_cmpxchg(p, cmp, val); \
> }
>
> 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
> index 290bec2..22aeaf9 100644
> --- a/generic/lib/cl_khr_global_int32_base_atomics/atom_dec.cl
> +++ b/generic/lib/cl_khr_global_int32_base_atomics/atom_dec.cl
> @@ -1,7 +1,7 @@
> #include <clc/clc.h>
>
> #define IMPL(TYPE) \
> -_CLC_OVERLOAD _CLC_DEF TYPE atom_dec(global TYPE *p) { \
> +_CLC_OVERLOAD _CLC_DEF TYPE atom_dec(volatile global TYPE *p) { \
> return atomic_dec(p); \
> }
>
> 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
> index 422bb78..2fd7102 100644
> --- a/generic/lib/cl_khr_global_int32_base_atomics/atom_inc.cl
> +++ b/generic/lib/cl_khr_global_int32_base_atomics/atom_inc.cl
> @@ -1,7 +1,7 @@
> #include <clc/clc.h>
>
> #define IMPL(TYPE) \
> -_CLC_OVERLOAD _CLC_DEF TYPE atom_inc(global TYPE *p) { \
> +_CLC_OVERLOAD _CLC_DEF TYPE atom_inc(volatile global TYPE *p) { \
> return atomic_inc(p); \
> }
>
> diff --git a/generic/lib/cl_khr_local_int32_base_atomics/atom_cmpxchg.cl b/generic/lib/cl_khr_local_int32_base_atomics/atom_cmpxchg.cl
> index 16e9579..ea648f0 100644
> --- a/generic/lib/cl_khr_local_int32_base_atomics/atom_cmpxchg.cl
> +++ b/generic/lib/cl_khr_local_int32_base_atomics/atom_cmpxchg.cl
> @@ -1,7 +1,7 @@
> #include <clc/clc.h>
>
> #define IMPL(TYPE) \
> -_CLC_OVERLOAD _CLC_DEF TYPE atom_cmpxchg(local TYPE *p, TYPE cmp, TYPE val) { \
> +_CLC_OVERLOAD _CLC_DEF TYPE atom_cmpxchg(volatile local TYPE *p, TYPE cmp, TYPE val) { \
> return atomic_cmpxchg(p, cmp, val); \
> }
>
> 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
> index d708a6d..33772a0 100644
> --- a/generic/lib/cl_khr_local_int32_base_atomics/atom_dec.cl
> +++ b/generic/lib/cl_khr_local_int32_base_atomics/atom_dec.cl
> @@ -1,7 +1,7 @@
> #include <clc/clc.h>
>
> #define IMPL(TYPE) \
> -_CLC_OVERLOAD _CLC_DEF TYPE atom_dec(local TYPE *p) { \
> +_CLC_OVERLOAD _CLC_DEF TYPE atom_dec(volatile local TYPE *p) { \
> return atomic_dec(p); \
> }
>
> 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
> index 8878673..d91ff65 100644
> --- a/generic/lib/cl_khr_local_int32_base_atomics/atom_inc.cl
> +++ b/generic/lib/cl_khr_local_int32_base_atomics/atom_inc.cl
> @@ -1,7 +1,7 @@
> #include <clc/clc.h>
>
> #define IMPL(TYPE) \
> -_CLC_OVERLOAD _CLC_DEF TYPE atom_inc(local TYPE *p) { \
> +_CLC_OVERLOAD _CLC_DEF TYPE atom_inc(volatile local TYPE *p) { \
> return atomic_inc(p); \
> }
>
> --
> 2.16.4
>
> _______________________________________________
> Libclc-dev mailing list
> Libclc-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/libclc-dev
More information about the Libclc-dev
mailing list