Added printf test for double type cases (#2022)

according to work plan for issue
https://github.com/KhronosGroup/OpenCL-CTS/issues/1058
This commit is contained in:
Marcin Hajder
2024-08-27 17:41:05 +02:00
committed by GitHub
parent 6cbe8cae35
commit 0a00a1f5b0
5 changed files with 309 additions and 58 deletions

View File

@@ -1511,30 +1511,27 @@ size_t get_min_alignment(cl_context context)
return align_size;
}
cl_device_fp_config get_default_rounding_mode(cl_device_id device,
const cl_uint &param)
cl_device_fp_config get_default_rounding_mode(const cl_device_id device,
const cl_uint param)
{
if (param == CL_DEVICE_DOUBLE_FP_CONFIG)
test_error_ret(
-1,
"FAILURE: CL_DEVICE_DOUBLE_FP_CONFIG not supported by this routine",
0);
char profileStr[128] = "";
cl_device_fp_config single = 0;
int error = clGetDeviceInfo(device, param, sizeof(single), &single, NULL);
cl_device_fp_config config = 0;
int error = clGetDeviceInfo(device, param, sizeof(config), &config, NULL);
if (error)
{
std::string message = std::string("Unable to get device ")
+ std::string(param == CL_DEVICE_HALF_FP_CONFIG
? "CL_DEVICE_HALF_FP_CONFIG"
: "CL_DEVICE_SINGLE_FP_CONFIG");
std::string config_name = "CL_DEVICE_SINGLE_FP_CONFIG";
if (param == CL_DEVICE_HALF_FP_CONFIG)
config_name = "CL_DEVICE_HALF_FP_CONFIG";
else if (param == CL_DEVICE_DOUBLE_FP_CONFIG)
config_name = "CL_DEVICE_DOUBLE_FP_CONFIG";
std::string message =
std::string("Unable to get device ") + config_name;
test_error_ret(error, message.c_str(), 0);
}
if (single & CL_FP_ROUND_TO_NEAREST) return CL_FP_ROUND_TO_NEAREST;
if (config & CL_FP_ROUND_TO_NEAREST) return CL_FP_ROUND_TO_NEAREST;
if (0 == (single & CL_FP_ROUND_TO_ZERO))
if (0 == (config & CL_FP_ROUND_TO_ZERO))
test_error_ret(-1,
"FAILURE: device must support either "
"CL_FP_ROUND_TO_ZERO or CL_FP_ROUND_TO_NEAREST",

View File

@@ -157,8 +157,8 @@ size_t get_min_alignment(cl_context context);
/* Helper to obtain the default rounding mode for single precision computation.
* (Double is always CL_FP_ROUND_TO_NEAREST.) Returns 0 on error. */
cl_device_fp_config
get_default_rounding_mode(cl_device_id device,
const cl_uint &param = CL_DEVICE_SINGLE_FP_CONFIG);
get_default_rounding_mode(const cl_device_id device,
const cl_uint param = CL_DEVICE_SINGLE_FP_CONFIG);
#define PASSIVE_REQUIRE_IMAGE_SUPPORT(device) \
if (checkForImageSupport(device)) \