mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Added cl_half support for test_printf (#1622)
* Added support to test half floats with printf calls (issue #142, printf) * Added corrections related to rounding and casting halfs (issue #142, printf) * Reusing similar function (issue #142, printf) * Corrected path without cl_khr_fp16 support (issue #142, printf) * Cosmetic fix for order of vector tests (issue #142, printf) * Added correction related to vendor test review (issue #142, printf)
This commit is contained in:
@@ -1511,22 +1511,33 @@ size_t get_min_alignment(cl_context context)
|
||||
return align_size;
|
||||
}
|
||||
|
||||
cl_device_fp_config get_default_rounding_mode(cl_device_id device)
|
||||
cl_device_fp_config get_default_rounding_mode(cl_device_id device,
|
||||
const cl_uint ¶m)
|
||||
{
|
||||
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, CL_DEVICE_SINGLE_FP_CONFIG,
|
||||
sizeof(single), &single, NULL);
|
||||
int error = clGetDeviceInfo(device, param, sizeof(single), &single, NULL);
|
||||
if (error)
|
||||
test_error_ret(error, "Unable to get device CL_DEVICE_SINGLE_FP_CONFIG",
|
||||
0);
|
||||
{
|
||||
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");
|
||||
test_error_ret(error, message.c_str(), 0);
|
||||
}
|
||||
|
||||
if (single & CL_FP_ROUND_TO_NEAREST) return CL_FP_ROUND_TO_NEAREST;
|
||||
|
||||
if (0 == (single & CL_FP_ROUND_TO_ZERO))
|
||||
test_error_ret(-1,
|
||||
"FAILURE: device must support either "
|
||||
"CL_DEVICE_SINGLE_FP_CONFIG or CL_FP_ROUND_TO_NEAREST",
|
||||
"CL_FP_ROUND_TO_ZERO or CL_FP_ROUND_TO_NEAREST",
|
||||
0);
|
||||
|
||||
// Make sure we are an embedded device before allowing a pass
|
||||
|
||||
@@ -159,7 +159,9 @@ 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);
|
||||
cl_device_fp_config
|
||||
get_default_rounding_mode(cl_device_id device,
|
||||
const cl_uint ¶m = CL_DEVICE_SINGLE_FP_CONFIG);
|
||||
|
||||
#define PASSIVE_REQUIRE_IMAGE_SUPPORT(device) \
|
||||
if (checkForImageSupport(device)) \
|
||||
|
||||
Reference in New Issue
Block a user