mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-21 23:09:01 +00:00
c11_atomics: unify host half representation and conversion with wrapper class (#2503)
Introduce `HostHalf` wrapper class to eliminate explicit `cl_half_from_float` and `cl_half_to_float` conversions throughout the test code. The wrapper provides semantic value constructors/operators and automatic conversions, simplifying half-precision arithmetic operations. Key improvements: - `HostHalf` class with operator overloading for arithmetic and comparisons - Type traits `is_host_atomic_fp_v` and `is_host_fp_v` for generic FP handling - Unified floating-point atomic operations (add/sub/min/max/exchange) - Removed 300+ lines of half-specific conditional branches - Consistent calculation for all FP types
This commit is contained in:
@@ -194,9 +194,9 @@ template<> cl_int AtomicTypeExtendedInfo<cl_int>::MinValue() {return CL_INT_MIN;
|
||||
template<> cl_uint AtomicTypeExtendedInfo<cl_uint>::MinValue() {return 0;}
|
||||
template<> cl_long AtomicTypeExtendedInfo<cl_long>::MinValue() {return CL_LONG_MIN;}
|
||||
template <> cl_ulong AtomicTypeExtendedInfo<cl_ulong>::MinValue() { return 0; }
|
||||
template <> cl_half AtomicTypeExtendedInfo<cl_half>::MinValue()
|
||||
template <> HostHalf AtomicTypeExtendedInfo<HostHalf>::MinValue()
|
||||
{
|
||||
return cl_half_from_float(-CL_HALF_MAX, gHalfRoundingMode);
|
||||
return -CL_HALF_MAX;
|
||||
}
|
||||
template <> cl_float AtomicTypeExtendedInfo<cl_float>::MinValue()
|
||||
{
|
||||
@@ -217,9 +217,9 @@ template <> cl_uint AtomicTypeExtendedInfo<cl_uint>::MaxValue()
|
||||
}
|
||||
template<> cl_long AtomicTypeExtendedInfo<cl_long>::MaxValue() {return CL_LONG_MAX;}
|
||||
template<> cl_ulong AtomicTypeExtendedInfo<cl_ulong>::MaxValue() {return CL_ULONG_MAX;}
|
||||
template <> cl_half AtomicTypeExtendedInfo<cl_half>::MaxValue()
|
||||
template <> HostHalf AtomicTypeExtendedInfo<HostHalf>::MaxValue()
|
||||
{
|
||||
return cl_half_from_float(CL_HALF_MAX, gHalfRoundingMode);
|
||||
return CL_HALF_MAX;
|
||||
}
|
||||
template <> cl_float AtomicTypeExtendedInfo<cl_float>::MaxValue()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user