Added support for cl_ext_float_atomics in CBasicTestFetchAddSpecialFloats with atomic_float (#2371)

Related to #2142, according to the work plan, extending
CBasicTestFetchAddSpecialFloats with support for atomic_float.
This commit is contained in:
Marcin Hajder
2026-02-17 17:41:46 +01:00
committed by GitHub
parent 50ba8c8c1c
commit 9d3ae4c734
3 changed files with 132 additions and 24 deletions

View File

@@ -22,13 +22,13 @@
#include "host_atomics.h"
#include "CL/cl_half.h"
#include <iomanip>
#include <limits>
#include <sstream>
#include <vector>
#include "CL/cl_half.h"
#define MAX_DEVICE_THREADS (gHost ? 0U : gMaxDeviceThreads)
#define MAX_HOST_THREADS GetThreadCount()
@@ -76,9 +76,8 @@ extern int
gMaxDeviceThreads; // maximum number of threads executed on OCL device
extern cl_device_atomic_capabilities gAtomicMemCap,
gAtomicFenceCap; // atomic memory and fence capabilities for this device
extern cl_half_rounding_mode gHalfRoundingMode;
extern bool gFloatAtomicsSupported;
extern cl_device_fp_atomic_capabilities_ext gHalfAtomicCaps;
extern cl_device_fp_config gFloatFPConfig;
extern cl_device_fp_config gHalfFPConfig;
extern cl_half_rounding_mode gHalfRoundingMode;
@@ -183,6 +182,7 @@ public:
{
return false;
}
virtual bool
IsTestNotAsExpected(const HostDataType &expected,
const std::vector<HostAtomicType> &testValues,
@@ -926,7 +926,14 @@ CBasicTest<HostAtomicType, HostDataType>::ProgramHeader(cl_uint maxNumDestItems)
if constexpr (std::is_same_v<HostDataType, HOST_FLOAT>)
{
ss << std::setprecision(10) << _startValue;
if (std::isinf(_startValue))
ss << (_startValue < 0 ? "-" : "") << "INFINITY";
else if (std::isnan(_startValue))
ss << "0.0f / 0.0f";
else
ss << std::setprecision(
std::numeric_limits<HostDataType>::max_digits10)
<< _startValue;
}
else if constexpr (std::is_same_v<HostDataType, HOST_HALF>)
{