mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
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:
@@ -58,30 +58,28 @@ cl_uint AtomicTypeInfo::Size(cl_device_id device)
|
||||
{
|
||||
switch(_type)
|
||||
{
|
||||
case TYPE_ATOMIC_INT:
|
||||
case TYPE_ATOMIC_UINT:
|
||||
case TYPE_ATOMIC_FLOAT:
|
||||
case TYPE_ATOMIC_FLAG:
|
||||
return sizeof(cl_int);
|
||||
case TYPE_ATOMIC_LONG:
|
||||
case TYPE_ATOMIC_ULONG:
|
||||
case TYPE_ATOMIC_DOUBLE:
|
||||
return sizeof(cl_long);
|
||||
case TYPE_ATOMIC_INTPTR_T:
|
||||
case TYPE_ATOMIC_UINTPTR_T:
|
||||
case TYPE_ATOMIC_SIZE_T:
|
||||
case TYPE_ATOMIC_PTRDIFF_T:
|
||||
{
|
||||
int error;
|
||||
cl_uint addressBits = 0;
|
||||
case TYPE_ATOMIC_HALF: return sizeof(cl_half);
|
||||
case TYPE_ATOMIC_INT:
|
||||
case TYPE_ATOMIC_UINT:
|
||||
case TYPE_ATOMIC_FLOAT:
|
||||
case TYPE_ATOMIC_FLAG: return sizeof(cl_int);
|
||||
case TYPE_ATOMIC_LONG:
|
||||
case TYPE_ATOMIC_ULONG:
|
||||
case TYPE_ATOMIC_DOUBLE: return sizeof(cl_long);
|
||||
case TYPE_ATOMIC_INTPTR_T:
|
||||
case TYPE_ATOMIC_UINTPTR_T:
|
||||
case TYPE_ATOMIC_SIZE_T:
|
||||
case TYPE_ATOMIC_PTRDIFF_T: {
|
||||
int error;
|
||||
cl_uint addressBits = 0;
|
||||
|
||||
error = clGetDeviceInfo(device, CL_DEVICE_ADDRESS_BITS, sizeof(addressBits), &addressBits, 0);
|
||||
test_error_ret(error, "clGetDeviceInfo", 0);
|
||||
error = clGetDeviceInfo(device, CL_DEVICE_ADDRESS_BITS,
|
||||
sizeof(addressBits), &addressBits, 0);
|
||||
test_error_ret(error, "clGetDeviceInfo", 0);
|
||||
|
||||
return addressBits/8;
|
||||
}
|
||||
default:
|
||||
return 0;
|
||||
return addressBits / 8;
|
||||
}
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,6 +91,7 @@ const char *AtomicTypeInfo::AtomicTypeName()
|
||||
return "atomic_int";
|
||||
case TYPE_ATOMIC_UINT:
|
||||
return "atomic_uint";
|
||||
case TYPE_ATOMIC_HALF: return "atomic_half";
|
||||
case TYPE_ATOMIC_FLOAT:
|
||||
return "atomic_float";
|
||||
case TYPE_ATOMIC_FLAG:
|
||||
@@ -124,6 +123,7 @@ const char *AtomicTypeInfo::RegularTypeName()
|
||||
return "int";
|
||||
case TYPE_ATOMIC_UINT:
|
||||
return "uint";
|
||||
case TYPE_ATOMIC_HALF: return "half";
|
||||
case TYPE_ATOMIC_FLOAT:
|
||||
return "float";
|
||||
case TYPE_ATOMIC_FLAG:
|
||||
@@ -163,29 +163,30 @@ int AtomicTypeInfo::IsSupported(cl_device_id device)
|
||||
{
|
||||
switch(_type)
|
||||
{
|
||||
case TYPE_ATOMIC_INT:
|
||||
case TYPE_ATOMIC_UINT:
|
||||
case TYPE_ATOMIC_FLOAT:
|
||||
case TYPE_ATOMIC_FLAG:
|
||||
return 1;
|
||||
case TYPE_ATOMIC_LONG:
|
||||
case TYPE_ATOMIC_ULONG:
|
||||
return is_extension_available(device, "cl_khr_int64_base_atomics") &&
|
||||
is_extension_available(device, "cl_khr_int64_extended_atomics");
|
||||
case TYPE_ATOMIC_DOUBLE:
|
||||
return is_extension_available(device, "cl_khr_int64_base_atomics") &&
|
||||
is_extension_available(device, "cl_khr_int64_extended_atomics") &&
|
||||
is_extension_available(device, "cl_khr_fp64");
|
||||
case TYPE_ATOMIC_INTPTR_T:
|
||||
case TYPE_ATOMIC_UINTPTR_T:
|
||||
case TYPE_ATOMIC_SIZE_T:
|
||||
case TYPE_ATOMIC_PTRDIFF_T:
|
||||
if(Size(device) == 4)
|
||||
return 1;
|
||||
return is_extension_available(device, "cl_khr_int64_base_atomics") &&
|
||||
is_extension_available(device, "cl_khr_int64_extended_atomics");
|
||||
default:
|
||||
return 0;
|
||||
case TYPE_ATOMIC_HALF:
|
||||
return is_extension_available(device, "cl_khr_fp16");
|
||||
case TYPE_ATOMIC_INT:
|
||||
case TYPE_ATOMIC_UINT:
|
||||
case TYPE_ATOMIC_FLOAT:
|
||||
case TYPE_ATOMIC_FLAG: return 1;
|
||||
case TYPE_ATOMIC_LONG:
|
||||
case TYPE_ATOMIC_ULONG:
|
||||
return is_extension_available(device, "cl_khr_int64_base_atomics")
|
||||
&& is_extension_available(device,
|
||||
"cl_khr_int64_extended_atomics");
|
||||
case TYPE_ATOMIC_DOUBLE:
|
||||
return is_extension_available(device, "cl_khr_int64_base_atomics")
|
||||
&& is_extension_available(device, "cl_khr_int64_extended_atomics")
|
||||
&& is_extension_available(device, "cl_khr_fp64");
|
||||
case TYPE_ATOMIC_INTPTR_T:
|
||||
case TYPE_ATOMIC_UINTPTR_T:
|
||||
case TYPE_ATOMIC_SIZE_T:
|
||||
case TYPE_ATOMIC_PTRDIFF_T:
|
||||
if (Size(device) == 4) return 1;
|
||||
return is_extension_available(device, "cl_khr_int64_base_atomics")
|
||||
&& is_extension_available(device,
|
||||
"cl_khr_int64_extended_atomics");
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user