Ensure is_extension_available is used where possible (#722)

(Patch2)
A number of tests have got their own code for checking the presence of
extensions. This change replaces that code with is_extension_available
function.

Contributes to #627

Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>

Change-Id: I17e007e5ad009e522c5006c42537bf1170550a6f
This commit is contained in:
ellnor01
2020-04-03 10:49:53 +01:00
committed by GitHub
parent cd3b552094
commit 93e76a8a4a
10 changed files with 76 additions and 262 deletions

View File

@@ -473,30 +473,7 @@ test_status InitCL( cl_device_id device )
gForceFTZ ^= 1;
// check for cl_khr_fp64
size_t extensions_size = 0;
if( (error = clGetDeviceInfo( device, CL_DEVICE_EXTENSIONS, 0, NULL, &extensions_size )))
{
vlog_error( "clGetDeviceInfo(CL_DEVICE_EXTENSIONS) failed. %d\n", error );
return TEST_FAIL;
}
if( extensions_size )
{
char *extensions = (char*)malloc(extensions_size);
if( NULL == extensions )
{
vlog_error( "ERROR: Unable to allocate %ld bytes to hold extensions string\n", extensions_size );
return TEST_FAIL;
}
if( (error = clGetDeviceInfo( device, CL_DEVICE_EXTENSIONS, extensions_size, extensions, NULL )))
{
vlog_error( "clGetDeviceInfo(CL_DEVICE_EXTENSIONS) failed 2. %d\n", error );
return TEST_FAIL;
}
gHasDouble = NULL != strstr( extensions, "cl_khr_fp64" );
free( extensions );
}
gHasDouble = is_extension_available(device, "cl_khr_fp64" );
if(0 == (CL_FP_INF_NAN & floatCapabilities) )
gSkipNanInf = 1;