libclc: Fix missing overloads for atomic_fetch_add/sub (#188478)
This commit is contained in:
parent
f8416c8643
commit
8e9e9228d4
@ -18,30 +18,87 @@
|
||||
#define __CLC_BODY "atomic_def.inc"
|
||||
#include "clc/math/gentype.inc"
|
||||
|
||||
#if defined(__opencl_c_atomic_order_seq_cst) && \
|
||||
defined(__opencl_c_atomic_scope_device)
|
||||
// If the device address space is 64-bits, the data types atomic_intptr_t,
|
||||
// atomic_uintptr_t, atomic_size_t and atomic_ptrdiff_t are supported if the
|
||||
// cl_khr_int64_base_atomics and cl_khr_int64_extended_atomics extensions are
|
||||
// supported and have been enabled.
|
||||
#if __SIZEOF_POINTER__ < 8 || (defined(cl_khr_int64_base_atomics) && \
|
||||
defined(cl_khr_int64_extended_atomics))
|
||||
|
||||
_CLC_OVERLOAD _CLC_DEF uintptr_t
|
||||
#if defined(__opencl_c_atomic_scope_device) && \
|
||||
defined(__opencl_c_atomic_order_seq_cst)
|
||||
|
||||
_CLC_DEF _CLC_OVERLOAD uintptr_t
|
||||
atomic_fetch_add(volatile __local atomic_uintptr_t *p, ptrdiff_t v) {
|
||||
return __scoped_atomic_fetch_add((volatile __local uintptr_t *)p, v,
|
||||
__ATOMIC_SEQ_CST, __MEMORY_SCOPE_DEVICE);
|
||||
}
|
||||
|
||||
_CLC_OVERLOAD _CLC_DEF uintptr_t
|
||||
_CLC_DEF _CLC_OVERLOAD uintptr_t
|
||||
atomic_fetch_add(volatile __global atomic_uintptr_t *p, ptrdiff_t v) {
|
||||
return __scoped_atomic_fetch_add((volatile __global uintptr_t *)p, v,
|
||||
__ATOMIC_SEQ_CST, __MEMORY_SCOPE_DEVICE);
|
||||
}
|
||||
|
||||
#if _CLC_GENERIC_AS_SUPPORTED
|
||||
|
||||
_CLC_OVERLOAD _CLC_DEF uintptr_t atomic_fetch_add(volatile atomic_uintptr_t *p,
|
||||
_CLC_DEF _CLC_OVERLOAD uintptr_t atomic_fetch_add(volatile atomic_uintptr_t *p,
|
||||
ptrdiff_t v) {
|
||||
return __scoped_atomic_fetch_add((volatile uintptr_t *)p, v, __ATOMIC_SEQ_CST,
|
||||
__MEMORY_SCOPE_DEVICE);
|
||||
}
|
||||
#endif // _CLC_GENERIC_AS_SUPPORTED
|
||||
#endif // defined(__opencl_c_atomic_scope_device) &&
|
||||
// defined(__opencl_c_atomic_order_seq_cst)
|
||||
|
||||
#ifdef __opencl_c_atomic_scope_device
|
||||
|
||||
_CLC_DEF _CLC_OVERLOAD uintptr_t atomic_fetch_add(
|
||||
volatile __local atomic_uintptr_t *p, ptrdiff_t v, memory_order order) {
|
||||
return __scoped_atomic_fetch_add((volatile __local uintptr_t *)p, v, order,
|
||||
__MEMORY_SCOPE_DEVICE);
|
||||
}
|
||||
|
||||
_CLC_DEF _CLC_OVERLOAD uintptr_t atomic_fetch_add(
|
||||
volatile __global atomic_uintptr_t *p, ptrdiff_t v, memory_order order) {
|
||||
return __scoped_atomic_fetch_add((volatile __global uintptr_t *)p, v, order,
|
||||
__MEMORY_SCOPE_DEVICE);
|
||||
}
|
||||
|
||||
#if _CLC_GENERIC_AS_SUPPORTED
|
||||
_CLC_DEF _CLC_OVERLOAD uintptr_t atomic_fetch_add(volatile atomic_uintptr_t *p,
|
||||
ptrdiff_t v,
|
||||
memory_order order) {
|
||||
return __scoped_atomic_fetch_add((volatile uintptr_t *)p, v, order,
|
||||
__MEMORY_SCOPE_DEVICE);
|
||||
}
|
||||
#endif // _CLC_GENERIC_AS_SUPPORTED
|
||||
#endif // __opencl_c_atomic_scope_device
|
||||
|
||||
_CLC_DEF _CLC_OVERLOAD uintptr_t
|
||||
atomic_fetch_add(volatile __local atomic_uintptr_t *p, ptrdiff_t v,
|
||||
memory_order order, memory_scope scope) {
|
||||
return __scoped_atomic_fetch_add((volatile __local uintptr_t *)p, v, order,
|
||||
__opencl_get_clang_memory_scope(scope));
|
||||
}
|
||||
|
||||
_CLC_DEF _CLC_OVERLOAD uintptr_t
|
||||
atomic_fetch_add(volatile __global atomic_uintptr_t *p, ptrdiff_t v,
|
||||
memory_order order, memory_scope scope) {
|
||||
return __scoped_atomic_fetch_add((volatile __global uintptr_t *)p, v, order,
|
||||
__opencl_get_clang_memory_scope(scope));
|
||||
}
|
||||
|
||||
#if _CLC_GENERIC_AS_SUPPORTED
|
||||
|
||||
_CLC_DEF _CLC_OVERLOAD uintptr_t atomic_fetch_add(volatile atomic_uintptr_t *p,
|
||||
ptrdiff_t v,
|
||||
memory_order order,
|
||||
memory_scope scope) {
|
||||
return __scoped_atomic_fetch_add((volatile uintptr_t *)p, v, order,
|
||||
__opencl_get_clang_memory_scope(scope));
|
||||
}
|
||||
|
||||
#endif // _CLC_GENERIC_AS_SUPPORTED
|
||||
|
||||
#endif // defined(__opencl_c_atomic_order_seq_cst) &&
|
||||
// defined(__opencl_c_atomic_scope_device)
|
||||
#endif // __SIZEOF_POINTER__ < 8 || (defined(cl_khr_int64_base_atomics) &&
|
||||
// defined(cl_khr_int64_extended_atomics))
|
||||
|
||||
@ -18,30 +18,87 @@
|
||||
#define __CLC_BODY "atomic_def.inc"
|
||||
#include "clc/math/gentype.inc"
|
||||
|
||||
#if defined(__opencl_c_atomic_order_seq_cst) && \
|
||||
defined(__opencl_c_atomic_scope_device)
|
||||
// If the device subress space is 64-bits, the data types atomic_intptr_t,
|
||||
// atomic_uintptr_t, atomic_size_t and atomic_ptrdiff_t are supported if the
|
||||
// cl_khr_int64_base_atomics and cl_khr_int64_extended_atomics extensions are
|
||||
// supported and have been enabled.
|
||||
#if __SIZEOF_POINTER__ < 8 || (defined(cl_khr_int64_base_atomics) && \
|
||||
defined(cl_khr_int64_extended_atomics))
|
||||
|
||||
_CLC_OVERLOAD _CLC_DEF uintptr_t
|
||||
#if defined(__opencl_c_atomic_scope_device) && \
|
||||
defined(__opencl_c_atomic_order_seq_cst)
|
||||
|
||||
_CLC_DEF _CLC_OVERLOAD uintptr_t
|
||||
atomic_fetch_sub(volatile __local atomic_uintptr_t *p, ptrdiff_t v) {
|
||||
return __scoped_atomic_fetch_sub((volatile __local uintptr_t *)p, v,
|
||||
__ATOMIC_SEQ_CST, __MEMORY_SCOPE_DEVICE);
|
||||
}
|
||||
|
||||
_CLC_OVERLOAD _CLC_DEF uintptr_t
|
||||
_CLC_DEF _CLC_OVERLOAD uintptr_t
|
||||
atomic_fetch_sub(volatile __global atomic_uintptr_t *p, ptrdiff_t v) {
|
||||
return __scoped_atomic_fetch_sub((volatile __global uintptr_t *)p, v,
|
||||
__ATOMIC_SEQ_CST, __MEMORY_SCOPE_DEVICE);
|
||||
}
|
||||
|
||||
#if _CLC_GENERIC_AS_SUPPORTED
|
||||
|
||||
_CLC_OVERLOAD _CLC_DEF uintptr_t atomic_fetch_sub(volatile atomic_uintptr_t *p,
|
||||
_CLC_DEF _CLC_OVERLOAD uintptr_t atomic_fetch_sub(volatile atomic_uintptr_t *p,
|
||||
ptrdiff_t v) {
|
||||
return __scoped_atomic_fetch_sub((volatile uintptr_t *)p, v, __ATOMIC_SEQ_CST,
|
||||
__MEMORY_SCOPE_DEVICE);
|
||||
}
|
||||
#endif // _CLC_GENERIC_AS_SUPPORTED
|
||||
#endif // defined(__opencl_c_atomic_scope_device) &&
|
||||
// defined(__opencl_c_atomic_order_seq_cst)
|
||||
|
||||
#ifdef __opencl_c_atomic_scope_device
|
||||
|
||||
_CLC_DEF _CLC_OVERLOAD uintptr_t atomic_fetch_sub(
|
||||
volatile __local atomic_uintptr_t *p, ptrdiff_t v, memory_order order) {
|
||||
return __scoped_atomic_fetch_sub((volatile __local uintptr_t *)p, v, order,
|
||||
__MEMORY_SCOPE_DEVICE);
|
||||
}
|
||||
|
||||
_CLC_DEF _CLC_OVERLOAD uintptr_t atomic_fetch_sub(
|
||||
volatile __global atomic_uintptr_t *p, ptrdiff_t v, memory_order order) {
|
||||
return __scoped_atomic_fetch_sub((volatile __global uintptr_t *)p, v, order,
|
||||
__MEMORY_SCOPE_DEVICE);
|
||||
}
|
||||
|
||||
#if _CLC_GENERIC_AS_SUPPORTED
|
||||
_CLC_DEF _CLC_OVERLOAD uintptr_t atomic_fetch_sub(volatile atomic_uintptr_t *p,
|
||||
ptrdiff_t v,
|
||||
memory_order order) {
|
||||
return __scoped_atomic_fetch_sub((volatile uintptr_t *)p, v, order,
|
||||
__MEMORY_SCOPE_DEVICE);
|
||||
}
|
||||
#endif // _CLC_GENERIC_AS_SUPPORTED
|
||||
#endif // __opencl_c_atomic_scope_device
|
||||
|
||||
_CLC_DEF _CLC_OVERLOAD uintptr_t
|
||||
atomic_fetch_sub(volatile __local atomic_uintptr_t *p, ptrdiff_t v,
|
||||
memory_order order, memory_scope scope) {
|
||||
return __scoped_atomic_fetch_sub((volatile __local uintptr_t *)p, v, order,
|
||||
__opencl_get_clang_memory_scope(scope));
|
||||
}
|
||||
|
||||
_CLC_DEF _CLC_OVERLOAD uintptr_t
|
||||
atomic_fetch_sub(volatile __global atomic_uintptr_t *p, ptrdiff_t v,
|
||||
memory_order order, memory_scope scope) {
|
||||
return __scoped_atomic_fetch_sub((volatile __global uintptr_t *)p, v, order,
|
||||
__opencl_get_clang_memory_scope(scope));
|
||||
}
|
||||
|
||||
#if _CLC_GENERIC_AS_SUPPORTED
|
||||
|
||||
_CLC_DEF _CLC_OVERLOAD uintptr_t atomic_fetch_sub(volatile atomic_uintptr_t *p,
|
||||
ptrdiff_t v,
|
||||
memory_order order,
|
||||
memory_scope scope) {
|
||||
return __scoped_atomic_fetch_sub((volatile uintptr_t *)p, v, order,
|
||||
__opencl_get_clang_memory_scope(scope));
|
||||
}
|
||||
|
||||
#endif // _CLC_GENERIC_AS_SUPPORTED
|
||||
|
||||
#endif // defined(__opencl_c_atomic_order_seq_cst) &&
|
||||
// defined(__opencl_c_atomic_scope_device)
|
||||
#endif // __SIZEOF_POINTER__ < 8 || (defined(cl_khr_int64_base_atomics) &&
|
||||
// defined(cl_khr_int64_extended_atomics))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user