Added support for cl_ext_float_atomics in CBasicTestFetchSub with atomic_float (#2367)

Related to #2142, according to the work plan, extending
CBasicTestFetchSub with support for atomic_float.
This commit is contained in:
Marcin Hajder
2025-10-28 16:41:24 +01:00
committed by GitHub
parent 52ba127f79
commit d0aa95be2f
3 changed files with 106 additions and 12 deletions

View File

@@ -18,7 +18,6 @@
#include "harness/testHarness.h"
#include <mutex>
#include "CL/cl_half.h"
#ifdef WIN32
@@ -136,7 +135,15 @@ template <typename AtomicType, typename CorrespondingType>
CorrespondingType host_atomic_fetch_sub(volatile AtomicType *a, CorrespondingType c,
TExplicitMemoryOrderType order)
{
if constexpr (std::is_same_v<AtomicType, HOST_ATOMIC_HALF>)
if constexpr (std::is_same_v<AtomicType, HOST_ATOMIC_FLOAT>)
{
static std::mutex mx;
std::lock_guard<std::mutex> lock(mx);
CorrespondingType old_value = *a;
*a -= c;
return old_value;
}
else if constexpr (std::is_same_v<AtomicType, HOST_ATOMIC_HALF>)
{
static std::mutex mx;
std::lock_guard<std::mutex> lock(mx);