diff --git a/test_conformance/c11_atomics/common.cpp b/test_conformance/c11_atomics/common.cpp index 4838c347..3be3fbc1 100644 --- a/test_conformance/c11_atomics/common.cpp +++ b/test_conformance/c11_atomics/common.cpp @@ -193,19 +193,28 @@ int AtomicTypeInfo::IsSupported(cl_device_id device) template<> cl_int AtomicTypeExtendedInfo::MinValue() {return CL_INT_MIN;} template<> cl_uint AtomicTypeExtendedInfo::MinValue() {return 0;} template<> cl_long AtomicTypeExtendedInfo::MinValue() {return CL_LONG_MIN;} -template<> cl_ulong AtomicTypeExtendedInfo::MinValue() {return 0;} +template <> cl_ulong AtomicTypeExtendedInfo::MinValue() { return 0; } template <> cl_half AtomicTypeExtendedInfo::MinValue() { - return cl_half_from_float(CL_HALF_MIN, gHalfRoundingMode); + return cl_half_from_float(-CL_HALF_MAX, gHalfRoundingMode); } template <> cl_float AtomicTypeExtendedInfo::MinValue() { - return CL_FLT_MIN; + return -CL_FLT_MAX; +} +template <> cl_double AtomicTypeExtendedInfo::MinValue() +{ + return -CL_DBL_MAX; } -template<> cl_double AtomicTypeExtendedInfo::MinValue() {return CL_DBL_MIN;} -template<> cl_int AtomicTypeExtendedInfo::MaxValue() {return CL_INT_MAX;} -template<> cl_uint AtomicTypeExtendedInfo::MaxValue() {return CL_UINT_MAX;} +template <> cl_int AtomicTypeExtendedInfo::MaxValue() +{ + return CL_INT_MAX; +} +template <> cl_uint AtomicTypeExtendedInfo::MaxValue() +{ + return CL_UINT_MAX; +} template<> cl_long AtomicTypeExtendedInfo::MaxValue() {return CL_LONG_MAX;} template<> cl_ulong AtomicTypeExtendedInfo::MaxValue() {return CL_ULONG_MAX;} template <> cl_half AtomicTypeExtendedInfo::MaxValue() diff --git a/test_conformance/c11_atomics/host_atomics.h b/test_conformance/c11_atomics/host_atomics.h index 27560822..a0588ef4 100644 --- a/test_conformance/c11_atomics/host_atomics.h +++ b/test_conformance/c11_atomics/host_atomics.h @@ -198,14 +198,17 @@ bool host_atomic_compare_exchange(volatile AtomicType *a, CorrespondingType *exp } *expected = tmp; } - else if constexpr (std::is_same_v) + else if constexpr ( + std::is_same_v< + AtomicType, + HOST_ATOMIC_DOUBLE> || std::is_same_v) { static std::mutex mtx; std::lock_guard lock(mtx); tmp = *reinterpret_cast(a); if (tmp == *expected) { - *reinterpret_cast(a) = desired; + *a = desired; return true; } *expected = tmp; diff --git a/test_conformance/c11_atomics/test_atomics.cpp b/test_conformance/c11_atomics/test_atomics.cpp index 0712f109..5a553a06 100644 --- a/test_conformance/c11_atomics/test_atomics.cpp +++ b/test_conformance/c11_atomics/test_atomics.cpp @@ -2802,7 +2802,7 @@ public: if constexpr ( std::is_same_v< HostDataType, - HOST_HALF> || std::is_same_v) + HOST_HALF> || std::is_same_v || std::is_same_v) { return " atomic_fetch_min" + postfix + "(&destMemory[0], oldValues[tid] " + memoryOrderScope + ");\n" @@ -2824,7 +2824,7 @@ public: if constexpr ( std::is_same_v< HostDataType, - HOST_HALF> || std::is_same_v) + HOST_HALF> || std::is_same_v || std::is_same_v) { host_atomic_fetch_min(&destMemory[0], oldValues[tid], MemoryOrder()); @@ -2849,7 +2849,10 @@ public: gHalfRoundingMode); } } - else if constexpr (std::is_same_v) + else if constexpr ( + std::is_same_v< + HostDataType, + HOST_FLOAT> || std::is_same_v) { for (cl_uint i = 0; i < threadCount; i++) { @@ -2910,7 +2913,7 @@ public: { if (std::is_same_v< HostDataType, - HOST_HALF> || std::is_same::value) + HOST_HALF> || std::is_same_v || std::is_same_v) { if (whichDestValue == 0) return CBasicTestMemOrderScope:: @@ -2962,6 +2965,18 @@ public: == 0) return 0; } + else if constexpr (std::is_same_v) + { + if (LocalMemory() + && (gDoubleAtomicCaps & CL_DEVICE_LOCAL_FP_ATOMIC_MIN_MAX_EXT) + == 0) + return 0; // skip test - not applicable + + if (!LocalMemory() + && (gDoubleAtomicCaps & CL_DEVICE_GLOBAL_FP_ATOMIC_MIN_MAX_EXT) + == 0) + return 0; + } else if constexpr (std::is_same_v) { if (LocalMemory() @@ -2983,7 +2998,7 @@ public: if constexpr ( std::is_same_v< HostDataType, - HOST_HALF> || std::is_same_v) + HOST_HALF> || std::is_same_v || std::is_same_v) { return threadCount; } @@ -3018,6 +3033,11 @@ static int test_atomic_fetch_min_generic(cl_device_id deviceID, if (gFloatAtomicsSupported) { + CBasicTestFetchMin test_double( + TYPE_ATOMIC_DOUBLE, useSVM); + EXECUTE_TEST( + error, test_double.Execute(deviceID, context, queue, num_elements)); + CBasicTestFetchMin test_half( TYPE_ATOMIC_HALF, useSVM); EXECUTE_TEST(error, @@ -3130,7 +3150,7 @@ public: if constexpr ( std::is_same_v< HostDataType, - HOST_HALF> || std::is_same_v) + HOST_HALF> || std::is_same_v || std::is_same_v) { return " atomic_fetch_max" + postfix + "(&destMemory[0], oldValues[tid] " + memoryOrderScope + ");\n" @@ -3152,7 +3172,7 @@ public: if constexpr ( std::is_same_v< HostDataType, - HOST_HALF> || std::is_same_v) + HOST_HALF> || std::is_same_v || std::is_same_v) { host_atomic_fetch_max(&destMemory[0], oldValues[tid], MemoryOrder()); @@ -3177,7 +3197,10 @@ public: gHalfRoundingMode); } } - else if constexpr (std::is_same_v) + else if constexpr ( + std::is_same_v< + HostDataType, + HOST_FLOAT> || std::is_same_v) { for (cl_uint i = 0; i < threadCount; i++) { @@ -3238,7 +3261,7 @@ public: { if (std::is_same_v< HostDataType, - HOST_HALF> || std::is_same::value) + HOST_HALF> || std::is_same_v || std::is_same_v) { if (whichDestValue == 0) return CBasicTestMemOrderScope:: @@ -3255,7 +3278,7 @@ public: { if (std::is_same_v< HostDataType, - HOST_HALF> || std::is_same::value) + HOST_HALF> || std::is_same_v || std::is_same_v) { correct = true; for (cl_uint i = 1; i < threadCount; i++) @@ -3290,6 +3313,18 @@ public: == 0) return 0; } + else if constexpr (std::is_same_v) + { + if (LocalMemory() + && (gDoubleAtomicCaps & CL_DEVICE_LOCAL_FP_ATOMIC_MIN_MAX_EXT) + == 0) + return 0; // skip test - not applicable + + if (!LocalMemory() + && (gDoubleAtomicCaps & CL_DEVICE_GLOBAL_FP_ATOMIC_MIN_MAX_EXT) + == 0) + return 0; + } else if constexpr (std::is_same_v) { if (LocalMemory() @@ -3311,7 +3346,7 @@ public: if constexpr ( std::is_same_v< HostDataType, - HOST_HALF> || std::is_same_v) + HOST_HALF> || std::is_same_v || std::is_same_v) { return threadCount; } @@ -3346,6 +3381,11 @@ static int test_atomic_fetch_max_generic(cl_device_id deviceID, if (gFloatAtomicsSupported) { + CBasicTestFetchMax test_double( + TYPE_ATOMIC_DOUBLE, useSVM); + EXECUTE_TEST( + error, test_double.Execute(deviceID, context, queue, num_elements)); + CBasicTestFetchMax test_half( TYPE_ATOMIC_HALF, useSVM); EXECUTE_TEST(error,