mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
subgroups: Fix setting cl_halfs and progress check. (#1278)
* subgroups: Fix setting cl_halfs and progress check. cl_float testing uses set_value such that a generated cl_ulong of 1 is stored as 1.0F in a logical sense. However, cl_half values aren't intrinsic to C++ and generated cl_ulongs less than 1024 in particular are interpreted bitwise as subnormals. The test fails on compute devices lacking subnormal support. Perform the logical conversion to cl_half. Fix independent forward progress check. * subgroups_half: Address review comments * subgroups_half: Formatting fixes required by check-format * subgroups_half: Modified to query and use rounding mode supported by device Co-authored-by: spauls <spauls@qti.qualcomm.com>
This commit is contained in:
committed by
GitHub
parent
12637114ac
commit
79f692d8e5
@@ -19,8 +19,10 @@
|
||||
#include <string.h>
|
||||
#include "procs.h"
|
||||
#include "harness/testHarness.h"
|
||||
#include "CL/cl_half.h"
|
||||
|
||||
MTdata gMTdata;
|
||||
cl_half_rounding_mode g_rounding_mode;
|
||||
|
||||
test_definition test_list[] = {
|
||||
ADD_TEST_VERSION(sub_group_info_ext, Version(2, 0)),
|
||||
@@ -66,6 +68,22 @@ static test_status InitCL(cl_device_id device)
|
||||
ret = TEST_SKIP;
|
||||
}
|
||||
}
|
||||
// Determine the rounding mode to be used in float to half conversions in
|
||||
// init and reference code
|
||||
const cl_device_fp_config fpConfig = get_default_rounding_mode(device);
|
||||
|
||||
if (fpConfig == CL_FP_ROUND_TO_NEAREST)
|
||||
{
|
||||
g_rounding_mode = CL_HALF_RTE;
|
||||
}
|
||||
else if (fpConfig == CL_FP_ROUND_TO_ZERO && gIsEmbedded)
|
||||
{
|
||||
g_rounding_mode = CL_HALF_RTZ;
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(false && "Unreachable");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -301,7 +301,7 @@ static float to_float(subgroups::cl_half x) { return cl_half_to_float(x.data); }
|
||||
static subgroups::cl_half to_half(float x)
|
||||
{
|
||||
subgroups::cl_half value;
|
||||
value.data = cl_half_from_float(x, CL_HALF_RTE);
|
||||
value.data = cl_half_from_float(x, g_rounding_mode);
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#define NR_OF_ACTIVE_WORK_ITEMS 4
|
||||
|
||||
extern MTdata gMTdata;
|
||||
extern cl_half_rounding_mode g_rounding_mode;
|
||||
|
||||
struct WorkGroupParams
|
||||
{
|
||||
@@ -1080,7 +1081,7 @@ template <typename Ty>
|
||||
typename std::enable_if<TypeManager<Ty>::is_sb_scalar_type::value>::type
|
||||
set_value(Ty &lhs, const cl_ulong &rhs)
|
||||
{
|
||||
lhs.data = rhs;
|
||||
lhs.data = cl_half_from_float(static_cast<cl_float>(rhs), g_rounding_mode);
|
||||
}
|
||||
|
||||
// compare for common vectors
|
||||
|
||||
@@ -360,17 +360,21 @@ int test_ifp_ext(cl_device_id device, cl_context context,
|
||||
}
|
||||
// ifp only in subgroup functions tests:
|
||||
test_status error;
|
||||
error = checkIFPSupport(device, ifpSupport);
|
||||
if (error != TEST_PASS)
|
||||
auto device_cl_version = get_device_cl_version(device);
|
||||
if (device_cl_version >= Version(2, 1))
|
||||
{
|
||||
return error;
|
||||
}
|
||||
if (ifpSupport == false)
|
||||
{
|
||||
log_info(
|
||||
"Error reason: the extension cl_khr_subgroups requires that "
|
||||
"Independed forward progress has to be supported by device.\n");
|
||||
return TEST_FAIL;
|
||||
error = checkIFPSupport(device, ifpSupport);
|
||||
if (error != TEST_PASS)
|
||||
{
|
||||
return error;
|
||||
}
|
||||
if (ifpSupport == false)
|
||||
{
|
||||
log_info(
|
||||
"Error reason: the extension cl_khr_subgroups requires that "
|
||||
"Independed forward progress has to be supported by device.\n");
|
||||
return TEST_FAIL;
|
||||
}
|
||||
}
|
||||
return test_ifp(device, context, queue, num_elements, false);
|
||||
}
|
||||
Reference in New Issue
Block a user