Added support for cl_ext_float_atomics in c11_atomics store test along with atomic_half type (#2293)

Related to #2142, according to the work plan extended `CBasicTestStore`
with support for `atomic_half`.

Optimization remark: in tests related to `CBasicTestStore` kernel source
code is mostly composed with arguments following similar pattern:

`__kernel void test_atomic_kernel(uint threadCount, uint numDestItems,
__global int *finalDest, __global int *oldValues, volatile __local
atomic_int *destMemory)`

`oldValues` buffer is initialized with a host pointer, after kernel
execution it is read back to the host pointer but it is unused in
neither of the kernels I verified.
This commit is contained in:
Marcin Hajder
2025-05-27 17:51:36 +02:00
committed by GitHub
parent 110799bb67
commit dec5644112
5 changed files with 134 additions and 54 deletions

View File

@@ -41,6 +41,7 @@ enum TExplicitMemoryOrderType
#define HOST_ATOMIC_UINT unsigned long
#define HOST_ATOMIC_LONG unsigned long long
#define HOST_ATOMIC_ULONG unsigned long long
#define HOST_ATOMIC_HALF unsigned short
#define HOST_ATOMIC_FLOAT float
#define HOST_ATOMIC_DOUBLE double
#else
@@ -48,6 +49,7 @@ enum TExplicitMemoryOrderType
#define HOST_ATOMIC_UINT cl_uint
#define HOST_ATOMIC_LONG cl_long
#define HOST_ATOMIC_ULONG cl_ulong
#define HOST_ATOMIC_HALF cl_half
#define HOST_ATOMIC_FLOAT cl_float
#define HOST_ATOMIC_DOUBLE cl_double
#endif
@@ -69,6 +71,7 @@ enum TExplicitMemoryOrderType
#define HOST_UINT cl_uint
#define HOST_LONG cl_long
#define HOST_ULONG cl_ulong
#define HOST_HALF cl_half
#define HOST_FLOAT cl_float
#define HOST_DOUBLE cl_double
@@ -120,9 +123,12 @@ CorrespondingType host_atomic_exchange(volatile AtomicType *a, CorrespondingType
TExplicitMemoryOrderType order)
{
#if defined( _MSC_VER ) || (defined( __INTEL_COMPILER ) && defined(WIN32))
return InterlockedExchange(a, c);
if (sizeof(CorrespondingType) == 2)
return InterlockedExchange16(reinterpret_cast<volatile SHORT *>(a), c);
else
return InterlockedExchange(reinterpret_cast<volatile LONG *>(a), c);
#elif defined(__GNUC__)
return __sync_lock_test_and_set(a, c);
return __sync_lock_test_and_set(a, c);
#else
log_info("Host function not implemented: atomic_exchange\n");
return 0;