Added support for cl_ext_float_atomics in CBasicTestFetchMin/Max with atomic_double (#2361)

Related to #2142, according to the work plan, extending
CBasicTestFetchMin/CBasicTestFetchMax with support for atomic_double.
This commit is contained in:
Marcin Hajder
2025-10-28 16:40:13 +01:00
committed by GitHub
parent 62972418c3
commit 52ba127f79
3 changed files with 71 additions and 19 deletions

View File

@@ -198,14 +198,17 @@ bool host_atomic_compare_exchange(volatile AtomicType *a, CorrespondingType *exp
}
*expected = tmp;
}
else if constexpr (std::is_same_v<AtomicType, HOST_ATOMIC_FLOAT>)
else if constexpr (
std::is_same_v<
AtomicType,
HOST_ATOMIC_DOUBLE> || std::is_same_v<AtomicType, HOST_ATOMIC_FLOAT>)
{
static std::mutex mtx;
std::lock_guard<std::mutex> lock(mtx);
tmp = *reinterpret_cast<volatile float *>(a);
if (tmp == *expected)
{
*reinterpret_cast<volatile float *>(a) = desired;
*a = desired;
return true;
}
*expected = tmp;