Fix check for CL_DEVICE_HALF_FP_CONFIG. (#2108)

When cl_khr_fp16 is not supported, this property is not available.

Note that the spec is different for
CL_DEVICE_{PREFERRED,NATIVE}_VECTOR_WIDTH_HALF: those properties are
always available and return 0 if cl_khr_fp16 is not supported, so those
checks are left as is.
This commit is contained in:
Harald van Dijk
2024-10-29 16:41:16 +00:00
committed by GitHub
parent 66fd9e4742
commit 7d3e1f0b82

View File

@@ -1274,8 +1274,10 @@ int test_consistency_requirements_fp16(cl_device_id deviceID,
{ {
error = clGetDeviceInfo(deviceID, CL_DEVICE_HALF_FP_CONFIG, error = clGetDeviceInfo(deviceID, CL_DEVICE_HALF_FP_CONFIG,
sizeof(value), &value, nullptr); sizeof(value), &value, nullptr);
test_error(error, "Unable to get device CL_DEVICE_HALF_FP_CONFIG"); test_failure_error(
test_assert_error(value == 0, "CL_DEVICE_HALF_FP_CONFIG must return 0"); error, CL_INVALID_VALUE,
"cl_khr_fp16 is not available; CL_DEVICE_HALF_FP_CONFIG must fail "
"with CL_INVALID_VALUE");
error = clGetDeviceInfo(deviceID, CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF, error = clGetDeviceInfo(deviceID, CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF,
sizeof(value), &value, nullptr); sizeof(value), &value, nullptr);