[PATCH 0/7] Atomics cleanup and volatile change

This series cleans up atomic declarations and implementation.
It also switches 32bit atom_* functions to accept atomic pointers.
The reasoning is included in 7/7 commit message.
I know I've spoken against this change in the past, but all things
considered I leaning towards this being an oversight in the specs.

thanks,
Jan

Jan Vesely (7):
  atomic: Move define cleanup to shared include
  atomic: Cleanup atomic_cmpxchg header
  atom: Consolidate cl_khr_{local,global}_int32_{base,extended}_atomics
    declarations
  atom: Consolidate cl_khr_int64_{base,extended}_atomics declarations
  atomic: Provide function implementation of atomic_{dec,inc}
  atom: Consolidate cl_khr_{local,global}_int32_{base,extended}_atomics
    implementation
  atom: Use volatile pointers for
    cl_khr_{global,local}_int32_{base,extended}_atomics

generic/include/clc/atom_decl_int32.inc | 10 ++++++++++
generic/include/clc/atom_decl_int64.inc | 11 +++++++++++
generic/include/clc/atomic/atomic_add.h | 3 ---
generic/include/clc/atomic/atomic_and.h | 3 ---
generic/include/clc/atomic/atomic_cmpxchg.h | 19 ++++---------------
generic/include/clc/atomic/atomic_dec.h | 5 ++++-
generic/include/clc/atomic/atomic_decl.inc | 6 +++++-
generic/include/clc/atomic/atomic_inc.h | 5 ++++-
generic/include/clc/atomic/atomic_max.h | 3 ---
generic/include/clc/atomic/atomic_min.h | 3 ---
generic/include/clc/atomic/atomic_or.h | 3 ---
generic/include/clc/atomic/atomic_sub.h | 3 ---
generic/include/clc/atomic/atomic_xchg.h | 7 +++----
generic/include/clc/atomic/atomic_xor.h | 3 ---
.../clc/cl_khr_global_int32_base_atomics/atom_add.h | 5 +++--
.../cl_khr_global_int32_base_atomics/atom_cmpxchg.h | 4 ++--
.../clc/cl_khr_global_int32_base_atomics/atom_dec.h | 4 ++--
.../clc/cl_khr_global_int32_base_atomics/atom_inc.h | 4 ++--
.../clc/cl_khr_global_int32_base_atomics/atom_sub.h | 5 +++--
.../clc/cl_khr_global_int32_base_atomics/atom_xchg.h | 5 +++--
.../cl_khr_global_int32_extended_atomics/atom_and.h | 5 +++--
.../cl_khr_global_int32_extended_atomics/atom_max.h | 5 +++--
.../cl_khr_global_int32_extended_atomics/atom_min.h | 5 +++--
.../cl_khr_global_int32_extended_atomics/atom_or.h | 5 +++--
.../cl_khr_global_int32_extended_atomics/atom_xor.h | 5 +++--
.../include/clc/cl_khr_int64_base_atomics/atom_add.h | 6 ++----
.../include/clc/cl_khr_int64_base_atomics/atom_sub.h | 6 ++----
.../include/clc/cl_khr_int64_base_atomics/atom_xchg.h | 6 ++----
.../clc/cl_khr_int64_extended_atomics/atom_and.h | 6 ++----
.../clc/cl_khr_int64_extended_atomics/atom_max.h | 6 ++----
.../clc/cl_khr_int64_extended_atomics/atom_min.h | 6 ++----
.../clc/cl_khr_int64_extended_atomics/atom_or.h | 6 ++----
.../clc/cl_khr_int64_extended_atomics/atom_xor.h | 6 ++----
.../clc/cl_khr_local_int32_base_atomics/atom_add.h | 5 +++--
.../cl_khr_local_int32_base_atomics/atom_cmpxchg.h | 4 ++--
.../clc/cl_khr_local_int32_base_atomics/atom_dec.h | 4 ++--
.../clc/cl_khr_local_int32_base_atomics/atom_inc.h | 4 ++--
.../clc/cl_khr_local_int32_base_atomics/atom_sub.h | 5 +++--
.../clc/cl_khr_local_int32_base_atomics/atom_xchg.h | 5 +++--
.../cl_khr_local_int32_extended_atomics/atom_and.h | 5 +++--
.../cl_khr_local_int32_extended_atomics/atom_max.h | 5 +++--
.../cl_khr_local_int32_extended_atomics/atom_min.h | 5 +++--
.../clc/cl_khr_local_int32_extended_atomics/atom_or.h | 5 +++--
.../cl_khr_local_int32_extended_atomics/atom_xor.h | 5 +++--
generic/lib/SOURCES | 2 ++
generic/lib/atom_int32_binary.inc | 14 ++++++++++++++
generic/lib/atomic/atomic_dec.cl | 12 ++++++++++++
generic/lib/atomic/atomic_inc.cl | 12 ++++++++++++
.../lib/cl_khr_global_int32_base_atomics/atom_add.cl | 12 +++---------
.../cl_khr_global_int32_base_atomics/atom_cmpxchg.cl | 2 +-
.../lib/cl_khr_global_int32_base_atomics/atom_dec.cl | 4 ++--
.../lib/cl_khr_global_int32_base_atomics/atom_inc.cl | 4 ++--
.../lib/cl_khr_global_int32_base_atomics/atom_sub.cl | 12 +++---------
.../lib/cl_khr_global_int32_base_atomics/atom_xchg.cl | 12 +++---------
.../cl_khr_global_int32_extended_atomics/atom_and.cl | 12 +++---------
.../cl_khr_global_int32_extended_atomics/atom_max.cl | 12 +++---------
.../cl_khr_global_int32_extended_atomics/atom_min.cl | 12 +++---------
.../cl_khr_global_int32_extended_atomics/atom_or.cl | 12 +++---------
.../cl_khr_global_int32_extended_atomics/atom_xor.cl | 12 +++---------
.../lib/cl_khr_local_int32_base_atomics/atom_add.cl | 12 +++---------
.../cl_khr_local_int32_base_atomics/atom_cmpxchg.cl | 2 +-
.../lib/cl_khr_local_int32_base_atomics/atom_dec.cl | 4 ++--
.../lib/cl_khr_local_int32_base_atomics/atom_inc.cl | 4 ++--
.../lib/cl_khr_local_int32_base_atomics/atom_sub.cl | 12 +++---------
.../lib/cl_khr_local_int32_base_atomics/atom_xchg.cl | 12 +++---------
.../cl_khr_local_int32_extended_atomics/atom_and.cl | 12 +++---------
.../cl_khr_local_int32_extended_atomics/atom_max.cl | 12 +++---------
.../cl_khr_local_int32_extended_atomics/atom_min.cl | 12 +++---------
.../cl_khr_local_int32_extended_atomics/atom_or.cl | 12 +++---------
.../cl_khr_local_int32_extended_atomics/atom_xor.cl | 12 +++---------
70 files changed, 215 insertions(+), 273 deletions(-)
create mode 100644 generic/include/clc/atom_decl_int32.inc
create mode 100644 generic/include/clc/atom_decl_int64.inc
create mode 100644 generic/lib/atom_int32_binary.inc
create mode 100644 generic/lib/atomic/atomic_dec.cl
create mode 100644 generic/lib/atomic/atomic_inc.cl

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>

It's easier to just list the four function declarations

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>

These are just atomic_* wrappers.
Switch inc,dec to use atomic_* wrappers as well.
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>

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@rutgers.edu>

Series is: Tested-By/Reviewed-By: Aaron Watry <awatry@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

Series is: Tested-By/Reviewed-By: Aaron Watry <awatry@gmail.com>

thanks.

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.

yeah. sorry it took me so long to see the light :slight_smile:
I tried using the old Tom's patch, but it did not apply cleanly, and I
thought a bit of cleanup wouldn't hurt.

Jan