cl20: Use single array for function list (#146)

Signed-off-by: Radek Szymanski <radek.szymanski@arm.com>
This commit is contained in:
Radek Szymanski
2019-04-10 12:29:22 +01:00
committed by Kévin Petit
parent a223b8a9a2
commit a344529c9b
112 changed files with 1917 additions and 3611 deletions

View File

@@ -52,23 +52,21 @@ int gHasLong = 1;
#define DEFAULT_NUM_ELEMENTS 0x4000
int runTestHarness( int argc, const char *argv[], unsigned int num_fns,
basefn fnList[], const char *fnNames[],
int imageSupportRequired, int forceNoContextCreation, cl_command_queue_properties queueProps )
int runTestHarness( int argc, const char *argv[], int testNum, test_definition testList[],
int imageSupportRequired, int forceNoContextCreation, cl_command_queue_properties queueProps )
{
return runTestHarnessWithCheck( argc, argv, num_fns, fnList, fnNames, imageSupportRequired, forceNoContextCreation, queueProps,
return runTestHarnessWithCheck( argc, argv, testNum, testList, imageSupportRequired, forceNoContextCreation, queueProps,
( imageSupportRequired ) ? verifyImageSupport : NULL );
}
int runTestHarnessWithCheck( int argc, const char *argv[], unsigned int num_fns,
basefn fnList[], const char *fnNames[],
int imageSupportRequired, int forceNoContextCreation, cl_command_queue_properties queueProps,
DeviceCheckFn deviceCheckFn )
int runTestHarnessWithCheck( int argc, const char *argv[], int testNum, test_definition testList[],
int imageSupportRequired, int forceNoContextCreation, cl_command_queue_properties queueProps,
DeviceCheckFn deviceCheckFn )
{
test_start();
log_info("*** Compatibility with Previous Versions test ***\n");
cl_device_type device_type = CL_DEVICE_TYPE_DEFAULT;
cl_device_type device_type = CL_DEVICE_TYPE_DEFAULT;
cl_uint num_platforms = 0;
cl_platform_id *platforms;
cl_device_id device;
@@ -80,7 +78,6 @@ int runTestHarnessWithCheck( int argc, const char *argv[], unsigned int num_fns,
int err, ret;
char *endPtr;
unsigned int i;
int based_on_env_var = 0;
@@ -135,15 +132,15 @@ int runTestHarnessWithCheck( int argc, const char *argv[], unsigned int num_fns,
/* Special case: just list the tests */
if( ( argc > 1 ) && (!strcmp( argv[ 1 ], "-list" ) || !strcmp( argv[ 1 ], "-h" ) || !strcmp( argv[ 1 ], "--help" )))
{
log_info( "Usage: %s [<function name>*] [pid<num>] [id<num>] [<device type>]\n", argv[0] );
log_info( "Usage: %s [<test name>*] [pid<num>] [id<num>] [<device type>]\n", argv[0] );
log_info( "\t<function name>\tOne or more of: (wildcard character '*') (default *)\n");
log_info( "\tpid<num>\t\tIndicates platform at index <num> should be used (default 0).\n" );
log_info( "\tid<num>\t\tIndicates device at index <num> should be used (default 0).\n" );
log_info( "\t<device_type>\tcpu|gpu|accelerator|<CL_DEVICE_TYPE_*> (default CL_DEVICE_TYPE_DEFAULT)\n" );
for( i = 0; i < num_fns - 1; i++ )
for( int i = 0; i < testNum; i++ )
{
log_info( "\t\t%s\n", fnNames[ i ] );
log_info( "\t\t%s\n", testList[i].name );
}
test_finish();
return 0;
@@ -468,7 +465,7 @@ int runTestHarnessWithCheck( int argc, const char *argv[], unsigned int num_fns,
DisableFTZ( &oldMode );
#endif
int error = parseAndCallCommandLineTests( argc, argv, device, num_fns, fnList, fnNames, forceNoContextCreation, queueProps, num_elements );
int error = parseAndCallCommandLineTests( argc, argv, device, testNum, testList, forceNoContextCreation, queueProps, num_elements );
#if defined(__APPLE__) && defined(__arm__)
// Restore the old FP mode before leaving.
@@ -478,23 +475,23 @@ int runTestHarnessWithCheck( int argc, const char *argv[], unsigned int num_fns,
return error;
}
static int find_wildcard_matching_functions( const char *fnNames[], unsigned char fnsToCall[], unsigned int num_fns,
static int find_wildcard_matching_functions( test_definition testList[], unsigned char selectedTestList[], int testNum,
const char *wildcard )
{
int found_tests = 0;
size_t wildcard_length = strlen( wildcard ) - 1; /* -1 for the asterisk */
for( unsigned int fnIndex = 0; fnIndex < num_fns; fnIndex++ )
for( int fnIndex = 0; fnIndex < testNum; fnIndex++ )
{
if( strncmp( fnNames[ fnIndex ], wildcard, wildcard_length ) == 0 )
if( strncmp( testList[ fnIndex ].name, wildcard, wildcard_length ) == 0 )
{
if( fnsToCall[ fnIndex ] )
if( selectedTestList[ fnIndex ] )
{
log_error( "ERROR: Test '%s' has already been selected.\n", fnNames[ fnIndex ] );
log_error( "ERROR: Test '%s' has already been selected.\n", testList[ fnIndex ].name );
return EXIT_FAILURE;
}
fnsToCall[ fnIndex ] = 1;
selectedTestList[ fnIndex ] = 1;
found_tests = 1;
}
}
@@ -508,29 +505,29 @@ static int find_wildcard_matching_functions( const char *fnNames[], unsigned cha
return EXIT_SUCCESS;
}
static int find_argument_matching_function( const char *fnNames[], unsigned char *fnsToCall, unsigned int num_fns,
static int find_argument_matching_function( test_definition testList[], unsigned char selectedTestList[], int testNum,
const char *argument )
{
unsigned int fnIndex;
int fnIndex;
for( fnIndex = 0; fnIndex < num_fns; fnIndex++ )
for( fnIndex = 0; fnIndex < testNum; fnIndex++ )
{
if( strcmp( argument, fnNames[ fnIndex ] ) == 0 )
if( strcmp( argument, testList[ fnIndex ].name ) == 0 )
{
if( fnsToCall[ fnIndex ] )
if( selectedTestList[ fnIndex ] )
{
log_error( "ERROR: Test '%s' has already been selected.\n", fnNames[ fnIndex ] );
log_error( "ERROR: Test '%s' has already been selected.\n", testList[ fnIndex ].name );
return EXIT_FAILURE;
}
else
{
fnsToCall[ fnIndex ] = 1;
selectedTestList[ fnIndex ] = 1;
break;
}
}
}
if( fnIndex == num_fns )
if( fnIndex == testNum )
{
log_error( "ERROR: The argument '%s' did not match any test names.\n", argument );
return EXIT_FAILURE;
@@ -539,18 +536,18 @@ static int find_argument_matching_function( const char *fnNames[], unsigned char
return EXIT_SUCCESS;
}
int parseAndCallCommandLineTests( int argc, const char *argv[], cl_device_id device, unsigned int num_fns,
basefn fnList[], const char *fnNames[], int forceNoContextCreation,
int parseAndCallCommandLineTests( int argc, const char *argv[], cl_device_id device, int testNum,
test_definition testList[], int forceNoContextCreation,
cl_command_queue_properties queueProps, int num_elements )
{
int ret = EXIT_SUCCESS;
unsigned char *fnsToCall = ( unsigned char* ) calloc( num_fns, 1 );
unsigned char *selectedTestList = ( unsigned char* ) calloc( testNum, 1 );
if( argc == 1 )
{
/* No actual arguments, all tests will be run. */
memset( fnsToCall, 1, num_fns );
memset( selectedTestList, 1, testNum );
}
else
{
@@ -558,18 +555,18 @@ int parseAndCallCommandLineTests( int argc, const char *argv[], cl_device_id dev
{
if( strchr( argv[ argIndex ], '*' ) != NULL )
{
ret = find_wildcard_matching_functions( fnNames, fnsToCall, num_fns, argv[ argIndex ] );
ret = find_wildcard_matching_functions( testList, selectedTestList, testNum, argv[ argIndex ] );
}
else
{
if( strcmp( argv[ argIndex ], "all" ) == 0 )
{
memset( fnsToCall, 1, num_fns );
memset( selectedTestList, 1, testNum );
break;
}
else
{
ret = find_argument_matching_function( fnNames, fnsToCall, num_fns, argv[ argIndex ] );
ret = find_argument_matching_function( testList, selectedTestList, testNum, argv[ argIndex ] );
}
}
@@ -582,7 +579,7 @@ int parseAndCallCommandLineTests( int argc, const char *argv[], cl_device_id dev
if( ret == EXIT_SUCCESS )
{
ret = callTestFunctions( fnList, fnNames, fnsToCall, num_fns, device, forceNoContextCreation, num_elements, queueProps );
ret = callTestFunctions( testList, selectedTestList, testNum, device, forceNoContextCreation, num_elements, queueProps );
if( gTestsFailed == 0 )
{
@@ -610,30 +607,30 @@ int parseAndCallCommandLineTests( int argc, const char *argv[], cl_device_id dev
test_finish();
free( fnsToCall );
free( selectedTestList );
return ret;
}
int callTestFunctions( basefn functionList[], const char *functionNames[], unsigned char functionsToCall[],
int numFunctions, cl_device_id deviceToUse, int forceNoContextCreation,
int callTestFunctions( test_definition testList[], unsigned char selectedTestList[],
int testNum, cl_device_id deviceToUse, int forceNoContextCreation,
int numElementsToUse, cl_command_queue_properties queueProps )
{
int numErrors = 0;
for( int i = 0; i < numFunctions; ++i )
for( int i = 0; i < testNum; ++i )
{
if( functionsToCall[ i ] )
if( selectedTestList[i] )
{
/* Skip any unimplemented tests. */
if( functionList[ i ] != NULL )
if( testList[i].func != NULL )
{
numErrors += callSingleTestFunction( functionList[ i ], functionNames[ i ], deviceToUse,
forceNoContextCreation, numElementsToUse, queueProps );
numErrors += callSingleTestFunction( testList[i], deviceToUse, forceNoContextCreation,
numElementsToUse, queueProps );
}
else
{
log_info( "%s test currently not implemented\n", functionNames[ i ] );
log_info( "%s test currently not implemented\n", testList[i].name );
}
}
}
@@ -647,9 +644,8 @@ void CL_CALLBACK notify_callback(const char *errinfo, const void *private_info,
}
// Actual function execution
int callSingleTestFunction( basefn functionToCall, const char *functionName,
cl_device_id deviceToUse, int forceNoContextCreation,
int numElementsToUse, cl_command_queue_properties queueProps )
int callSingleTestFunction( test_definition test, cl_device_id deviceToUse, int forceNoContextCreation,
int numElementsToUse, cl_command_queue_properties queueProps )
{
int numErrors = 0, ret;
cl_int error;
@@ -675,26 +671,26 @@ int callSingleTestFunction( basefn functionToCall, const char *functionName,
}
/* Run the test and print the result */
log_info( "%s...\n", functionName );
log_info( "%s...\n", test.name );
fflush( stdout );
ret = functionToCall( deviceToUse, context, queue, numElementsToUse); //test_threaded_function( ptr_basefn_list[i], group, context, num_elements);
ret = test.func( deviceToUse, context, queue, numElementsToUse); //test_threaded_function( ptr_basefn_list[i], group, context, num_elements);
if( ret == TEST_NOT_IMPLEMENTED )
{
/* Tests can also let us know they're not implemented yet */
log_info("%s test currently not implemented\n\n", functionName);
log_info("%s test currently not implemented\n\n", test.name);
}
else
{
/* Print result */
if( ret == 0 ) {
log_info( "%s passed\n", functionName );
log_info( "%s passed\n", test.name );
gTestsPassed++;
}
else
{
numErrors++;
log_error( "%s FAILED\n", functionName );
log_error( "%s FAILED\n", test.name );
gTestsFailed++;
}
}

View File

@@ -23,6 +23,17 @@
extern "C" {
#endif
#define ADD_TEST(fn) {test_##fn, #fn}
#define NOT_IMPLEMENTED_TEST(fn) {NULL, #fn}
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
typedef struct test_definition
{
basefn func;
const char* name;
} test_definition;
typedef enum test_status
{
TEST_PASS = 0,
@@ -35,39 +46,36 @@ extern cl_uint gRandomSeed;
// Supply a list of functions to test here. This will allocate a CL device, create a context, all that
// setup work, and then call each function in turn as dictatated by the passed arguments.
extern int runTestHarness( int argc, const char *argv[], unsigned int num_fns,
basefn fnList[], const char *fnNames[],
int imageSupportRequired, int forceNoContextCreation, cl_command_queue_properties queueProps );
extern int runTestHarness(int argc, const char *argv[], int testNum, test_definition testList[],
int imageSupportRequired, int forceNoContextCreation, cl_command_queue_properties queueProps );
// Device checking function. See runTestHarnessWithCheck. If this function returns anything other than TEST_PASS, the harness exits.
typedef test_status (*DeviceCheckFn)( cl_device_id device );
// Same as runTestHarness, but also supplies a function that checks the created device for required functionality.
extern int runTestHarnessWithCheck( int argc, const char *argv[], unsigned int num_fns,
basefn fnList[], const char *fnNames[],
int imageSupportRequired, int forceNoContextCreation, cl_command_queue_properties queueProps, DeviceCheckFn deviceCheckFn );
extern int runTestHarnessWithCheck( int argc, const char *argv[], int testNum, test_definition testList[],
int imageSupportRequired, int forceNoContextCreation, cl_command_queue_properties queueProps,
DeviceCheckFn deviceCheckFn );
// The command line parser used by runTestHarness to break up parameters into calls to callTestFunctions
extern int parseAndCallCommandLineTests( int argc, const char *argv[], cl_device_id device, unsigned int num_fns,
basefn *fnList, const char *fnNames[],
int forceNoContextCreation, cl_command_queue_properties queueProps, int num_elements );
extern int parseAndCallCommandLineTests( int argc, const char *argv[], cl_device_id device, int testNum,
test_definition testList[], int forceNoContextCreation,
cl_command_queue_properties queueProps, int num_elements );
// Call this function if you need to do all the setup work yourself, and just need the function list called/
// managed.
// functionList is the actual array of functions
// functionNames is an array of strings representing the name of each function
// functionsToCall is an array of integers (treated as bools) which tell which function is to be called,
// each element at index i, corresponds to the element in functionList at index i
// numFunctions is the number of elements in the arrays
// testList is the data structure that contains test functions and its names
// selectedTestList is an array of integers (treated as bools) which tell which function is to be called,
// each element at index i, corresponds to the element in testList at index i
// testNum is the number of tests in testList and selectedTestList
// contextProps are used to create a testing context for each test
// deviceToUse and numElementsToUse are all just passed to each test function
extern int callTestFunctions( basefn functionList[], const char *functionNames[], unsigned char functionsToCall[],
int numFunctions, cl_device_id deviceToUse, int forceNoContextCreation,
extern int callTestFunctions( test_definition testList[], unsigned char selectedTestList[],
int testNum, cl_device_id deviceToUse, int forceNoContextCreation,
int numElementsToUse, cl_command_queue_properties queueProps );
// This function is called by callTestFunctions, once per function, to do setup, call, logging and cleanup
extern int callSingleTestFunction( basefn functionToCall, const char *functionName,
cl_device_id deviceToUse, int forceNoContextCreation,
extern int callSingleTestFunction( test_definition test, cl_device_id deviceToUse, int forceNoContextCreation,
int numElementsToUse, cl_command_queue_properties queueProps );
///// Miscellaneous steps

View File

@@ -30,187 +30,96 @@
cl_device_type gDeviceType = CL_DEVICE_TYPE_DEFAULT;
bool gTestRounding = false;
basefn basefn_list[] = {
test_get_platform_info,
test_get_sampler_info,
test_get_command_queue_info,
test_get_context_info,
test_get_device_info,
test_enqueue_task,
test_binary_get,
test_program_binary_create,
test_kernel_required_group_size,
test_definition test_list[] = {
ADD_TEST( get_platform_info ),
ADD_TEST( get_sampler_info ),
ADD_TEST( get_command_queue_info ),
ADD_TEST( get_context_info ),
ADD_TEST( get_device_info ),
ADD_TEST( enqueue_task ),
ADD_TEST( binary_get ),
ADD_TEST( binary_create ),
ADD_TEST( kernel_required_group_size ),
test_release_kernel_order,
test_release_during_execute,
ADD_TEST( release_kernel_order ),
ADD_TEST( release_during_execute ),
test_load_single_kernel,
test_load_two_kernels,
test_load_two_kernels_in_one,
test_load_two_kernels_manually,
test_get_program_info_kernel_names,
test_get_kernel_arg_info,
test_create_kernels_in_program,
test_get_kernel_info,
test_execute_kernel_local_sizes,
test_set_kernel_arg_by_index,
test_set_kernel_arg_constant,
test_set_kernel_arg_struct_array,
test_kernel_global_constant,
ADD_TEST( load_single_kernel ),
ADD_TEST( load_two_kernels ),
ADD_TEST( load_two_kernels_in_one ),
ADD_TEST( load_two_kernels_manually ),
ADD_TEST( get_program_info_kernel_names ),
ADD_TEST( get_kernel_arg_info ),
ADD_TEST( create_kernels_in_program ),
ADD_TEST( get_kernel_info ),
ADD_TEST( execute_kernel_local_sizes ),
ADD_TEST( set_kernel_arg_by_index ),
ADD_TEST( set_kernel_arg_constant ),
ADD_TEST( set_kernel_arg_struct_array ),
ADD_TEST( kernel_global_constant ),
test_min_max_thread_dimensions,
test_min_max_work_items_sizes,
test_min_max_work_group_size,
test_min_max_read_image_args,
test_min_max_write_image_args,
test_min_max_mem_alloc_size,
test_min_max_image_2d_width,
test_min_max_image_2d_height,
test_min_max_image_3d_width,
test_min_max_image_3d_height,
test_min_max_image_3d_depth,
test_min_max_image_array_size,
test_min_max_image_buffer_size,
test_min_max_parameter_size,
test_min_max_samplers,
test_min_max_constant_buffer_size,
test_min_max_constant_args,
test_min_max_compute_units,
test_min_max_address_bits,
test_min_max_single_fp_config,
test_min_max_double_fp_config,
test_min_max_local_mem_size,
test_min_max_kernel_preferred_work_group_size_multiple,
test_min_max_execution_capabilities,
test_min_max_queue_properties,
test_min_max_device_version,
test_min_max_language_version,
ADD_TEST( min_max_thread_dimensions ),
ADD_TEST( min_max_work_items_sizes ),
ADD_TEST( min_max_work_group_size ),
ADD_TEST( min_max_read_image_args ),
ADD_TEST( min_max_write_image_args ),
ADD_TEST( min_max_mem_alloc_size ),
ADD_TEST( min_max_image_2d_width ),
ADD_TEST( min_max_image_2d_height ),
ADD_TEST( min_max_image_3d_width ),
ADD_TEST( min_max_image_3d_height ),
ADD_TEST( min_max_image_3d_depth ),
ADD_TEST( min_max_image_array_size ),
ADD_TEST( min_max_image_buffer_size ),
ADD_TEST( min_max_parameter_size ),
ADD_TEST( min_max_samplers ),
ADD_TEST( min_max_constant_buffer_size ),
ADD_TEST( min_max_constant_args ),
ADD_TEST( min_max_compute_units ),
ADD_TEST( min_max_address_bits ),
ADD_TEST( min_max_single_fp_config ),
ADD_TEST( min_max_double_fp_config ),
ADD_TEST( min_max_local_mem_size ),
ADD_TEST( min_max_kernel_preferred_work_group_size_multiple ),
ADD_TEST( min_max_execution_capabilities ),
ADD_TEST( min_max_queue_properties ),
ADD_TEST( min_max_device_version ),
ADD_TEST( min_max_language_version ),
test_kernel_arg_changes,
test_kernel_arg_multi_setup_random,
ADD_TEST( kernel_arg_changes ),
ADD_TEST( kernel_arg_multi_setup_random ),
test_native_kernel,
ADD_TEST( native_kernel ),
test_create_context_from_type,
ADD_TEST( create_context_from_type ),
test_platform_extensions,
test_get_platform_ids,
test_for_bool_type,
ADD_TEST( platform_extensions ),
ADD_TEST( get_platform_ids ),
ADD_TEST( bool_type ),
test_repeated_setup_cleanup,
ADD_TEST( repeated_setup_cleanup ),
test_retain_queue_single,
test_retain_queue_multiple,
test_retain_mem_object_single,
test_retain_mem_object_multiple,
test_min_data_type_align_size_alignment,
ADD_TEST( retain_queue_single ),
ADD_TEST( retain_queue_multiple ),
ADD_TEST( retain_mem_object_single ),
ADD_TEST( retain_mem_object_multiple ),
ADD_TEST( min_data_type_align_size_alignment ),
test_mem_object_destructor_callback,
test_null_buffer_arg,
test_get_buffer_info,
test_get_image2d_info,
test_get_image3d_info,
test_get_image1d_info,
test_get_image1d_array_info,
test_get_image2d_array_info,
test_queue_properties,
ADD_TEST( mem_object_destructor_callback ),
ADD_TEST( null_buffer_arg ),
ADD_TEST( get_buffer_info ),
ADD_TEST( get_image2d_info ),
ADD_TEST( get_image3d_info ),
ADD_TEST( get_image1d_info ),
ADD_TEST( get_image1d_array_info ),
ADD_TEST( get_image2d_array_info ),
ADD_TEST( queue_properties ),
};
const char *basefn_names[] = {
"get_platform_info",
"get_sampler_info",
"get_command_queue_info",
"get_context_info",
"get_device_info",
"enqueue_task",
"binary_get",
"binary_create",
"kernel_required_group_size",
"release_kernel_order",
"release_during_execute",
"load_single_kernel",
"load_two_kernels",
"load_two_kernels_in_one",
"load_two_kernels_manually",
"get_program_info_kernel_names",
"get_kernel_arg_info",
"create_kernels_in_program",
"get_kernel_info",
"execute_kernel_local_sizes",
"set_kernel_arg_by_index",
"set_kernel_arg_constant",
"set_kernel_arg_struct_array",
"kernel_global_constant",
"min_max_thread_dimensions",
"min_max_work_items_sizes",
"min_max_work_group_size",
"min_max_read_image_args",
"min_max_write_image_args",
"min_max_mem_alloc_size",
"min_max_image_2d_width",
"min_max_image_2d_height",
"min_max_image_3d_width",
"min_max_image_3d_height",
"min_max_image_3d_depth",
"min_max_image_array_size",
"min_max_image_buffer_size",
"min_max_parameter_size",
"min_max_samplers",
"min_max_constant_buffer_size",
"min_max_constant_args",
"min_max_compute_units",
"min_max_address_bits",
"min_max_single_fp_config",
"min_max_double_fp_config",
"min_max_local_mem_size",
"min_max_kernel_preferred_work_group_size_multiple",
"min_max_execution_capabilities",
"min_max_queue_properties",
"min_max_device_version",
"min_max_language_version",
"kernel_arg_changes",
"kernel_arg_multi_setup_random",
"native_kernel",
"create_context_from_type",
"platform_extensions",
"get_platform_ids",
"bool_type",
"repeated_setup_cleanup",
"retain_queue_single",
"retain_queue_multiple",
"retain_mem_object_single",
"retain_mem_object_multiple",
"min_data_type_align_size_alignment",
"mem_object_destructor_callback",
"null_buffer_arg",
"get_buffer_info",
"get_image2d_info",
"get_image3d_info",
"get_image1d_info",
"get_image1d_array_info",
"get_image2d_array_info",
"queue_properties",
};
ct_assert((sizeof(basefn_names) / sizeof(basefn_names[0])) == (sizeof(basefn_list) / sizeof(basefn_list[0])));
int num_fns = sizeof(basefn_names) / sizeof(char *);
const int test_num = ARRAY_SIZE( test_list );
int main(int argc, const char *argv[])
{
return runTestHarness( argc, argv, num_fns, basefn_list, basefn_names, false, false, 0 );
return runTestHarness( argc, argv, test_num, test_list, false, false, 0 );
}

View File

@@ -29,7 +29,7 @@ extern int test_create_kernels_in_program(cl_device_id deviceID, cl_conte
extern int test_enqueue_task(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_repeated_setup_cleanup(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_for_bool_type(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_bool_type(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_platform_extensions(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_get_platform_info(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_get_sampler_info(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
@@ -39,7 +39,7 @@ extern int test_get_device_info(cl_device_id deviceID, cl_context context
extern int test_kernel_required_group_size(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_binary_get(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_program_binary_create(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_binary_create(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_release_kernel_order(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_release_during_execute(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);

View File

@@ -75,7 +75,7 @@ int test_binary_get(cl_device_id deviceID, cl_context context, cl_command_queue
}
int test_program_binary_create(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements)
int test_binary_create(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements)
{
/* To test this in a self-contained fashion, we have to create a program with
source, then get the binary, then use that binary to reload the program, and then verify */

View File

@@ -35,8 +35,7 @@ const char *kernel_with_bool[] = {
"}\n"
};
int test_for_bool_type(cl_device_id deviceID, cl_context context,
cl_command_queue queue, int num_elements)
int test_bool_type(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements)
{
cl_program program;

View File

@@ -30,234 +30,118 @@
cl_device_type gDeviceType = CL_DEVICE_TYPE_DEFAULT;
bool gTestRounding = false;
basefn basefn_list[] = {
test_hostptr,
test_fpmath_float,
test_fpmath_float2,
test_fpmath_float4,
test_intmath_int,
test_intmath_int2,
test_intmath_int4,
test_intmath_long,
test_intmath_long2,
test_intmath_long4,
test_hiloeo,
test_if,
test_sizeof,
test_loop,
test_pointer_cast,
test_local_arg_def,
test_local_kernel_def,
test_local_kernel_scope,
test_constant,
test_constant_source,
test_readimage,
test_readimage_int16,
test_readimage_fp32,
test_writeimage,
test_writeimage_int16,
test_writeimage_fp32,
test_multireadimageonefmt,
test_definition test_list[] = {
ADD_TEST( hostptr ),
ADD_TEST( fpmath_float ),
ADD_TEST( fpmath_float2 ),
ADD_TEST( fpmath_float4 ),
ADD_TEST( intmath_int ),
ADD_TEST( intmath_int2 ),
ADD_TEST( intmath_int4 ),
ADD_TEST( intmath_long ),
ADD_TEST( intmath_long2 ),
ADD_TEST( intmath_long4 ),
ADD_TEST( hiloeo ),
ADD_TEST( if ),
ADD_TEST( sizeof ),
ADD_TEST( loop ),
ADD_TEST( pointer_cast ),
ADD_TEST( local_arg_def ),
ADD_TEST( local_kernel_def ),
ADD_TEST( local_kernel_scope ),
ADD_TEST( constant ),
ADD_TEST( constant_source ),
ADD_TEST( readimage ),
ADD_TEST( readimage_int16 ),
ADD_TEST( readimage_fp32 ),
ADD_TEST( writeimage ),
ADD_TEST( writeimage_int16 ),
ADD_TEST( writeimage_fp32 ),
ADD_TEST( mri_one ),
test_multireadimagemultifmt,
test_image_r8,
test_barrier,
test_int2float,
test_float2int,
test_imagereadwrite,
test_imagereadwrite3d,
test_readimage3d,
test_readimage3d_int16,
test_readimage3d_fp32,
test_bufferreadwriterect,
test_arrayreadwrite,
test_arraycopy,
test_imagearraycopy,
test_imagearraycopy3d,
test_imagecopy,
test_imagecopy3d,
test_imagerandomcopy,
test_arrayimagecopy,
test_arrayimagecopy3d,
test_imagenpot,
ADD_TEST( mri_multiple ),
ADD_TEST( image_r8 ),
ADD_TEST( barrier ),
ADD_TEST( int2float ),
ADD_TEST( float2int ),
ADD_TEST( imagereadwrite ),
ADD_TEST( imagereadwrite3d ),
ADD_TEST( readimage3d ),
ADD_TEST( readimage3d_int16 ),
ADD_TEST( readimage3d_fp32 ),
ADD_TEST( bufferreadwriterect ),
ADD_TEST( arrayreadwrite ),
ADD_TEST( arraycopy ),
ADD_TEST( imagearraycopy ),
ADD_TEST( imagearraycopy3d ),
ADD_TEST( imagecopy ),
ADD_TEST( imagecopy3d ),
ADD_TEST( imagerandomcopy ),
ADD_TEST( arrayimagecopy ),
ADD_TEST( arrayimagecopy3d ),
ADD_TEST( imagenpot ),
test_vload_global,
test_vload_local,
test_vload_constant,
test_vload_private,
test_vstore_global,
test_vstore_local,
test_vstore_private,
ADD_TEST( vload_global ),
ADD_TEST( vload_local ),
ADD_TEST( vload_constant ),
ADD_TEST( vload_private ),
ADD_TEST( vstore_global ),
ADD_TEST( vstore_local ),
ADD_TEST( vstore_private ),
test_createkernelsinprogram,
test_imagedim_pow2,
test_imagedim_non_pow2,
test_image_param,
test_image_multipass_integer_coord,
test_image_multipass_float_coord,
test_explicit_s2v_bool,
test_explicit_s2v_char,
test_explicit_s2v_uchar,
test_explicit_s2v_short,
test_explicit_s2v_ushort,
test_explicit_s2v_int,
test_explicit_s2v_uint,
test_explicit_s2v_long,
test_explicit_s2v_ulong,
test_explicit_s2v_float,
test_explicit_s2v_double,
ADD_TEST( createkernelsinprogram ),
ADD_TEST( imagedim_pow2 ),
ADD_TEST( imagedim_non_pow2 ),
ADD_TEST( image_param ),
ADD_TEST( image_multipass_integer_coord ),
ADD_TEST( image_multipass_float_coord ),
ADD_TEST( explicit_s2v_bool ),
ADD_TEST( explicit_s2v_char ),
ADD_TEST( explicit_s2v_uchar ),
ADD_TEST( explicit_s2v_short ),
ADD_TEST( explicit_s2v_ushort ),
ADD_TEST( explicit_s2v_int ),
ADD_TEST( explicit_s2v_uint ),
ADD_TEST( explicit_s2v_long ),
ADD_TEST( explicit_s2v_ulong ),
ADD_TEST( explicit_s2v_float ),
ADD_TEST( explicit_s2v_double ),
test_enqueue_map_buffer,
test_enqueue_map_image,
ADD_TEST( enqueue_map_buffer ),
ADD_TEST( enqueue_map_image ),
test_work_item_functions,
ADD_TEST( work_item_functions ),
test_astype,
ADD_TEST( astype ),
test_async_copy_global_to_local,
test_async_copy_local_to_global,
test_async_strided_copy_global_to_local,
test_async_strided_copy_local_to_global,
test_prefetch,
ADD_TEST( async_copy_global_to_local ),
ADD_TEST( async_copy_local_to_global ),
ADD_TEST( async_strided_copy_global_to_local ),
ADD_TEST( async_strided_copy_local_to_global ),
ADD_TEST( prefetch ),
test_kernel_call_kernel_function,
test_host_numeric_constants,
test_kernel_numeric_constants,
test_kernel_limit_constants,
test_kernel_preprocessor_macros,
ADD_TEST( kernel_call_kernel_function ),
ADD_TEST( host_numeric_constants ),
ADD_TEST( kernel_numeric_constants ),
ADD_TEST( kernel_limit_constants ),
ADD_TEST( kernel_preprocessor_macros ),
test_basic_parameter_types,
test_vector_creation,
test_vec_type_hint,
test_kernel_memory_alignment_local,
test_kernel_memory_alignment_global,
test_kernel_memory_alignment_constant,
test_kernel_memory_alignment_private,
ADD_TEST( parameter_types ),
ADD_TEST( vector_creation ),
ADD_TEST( vec_type_hint ),
ADD_TEST( kernel_memory_alignment_local ),
ADD_TEST( kernel_memory_alignment_global ),
ADD_TEST( kernel_memory_alignment_constant ),
ADD_TEST( kernel_memory_alignment_private ),
test_global_work_offsets,
test_get_global_offset
ADD_TEST( global_work_offsets ),
ADD_TEST( get_global_offset ),
};
const char *basefn_names[] = {
"hostptr",
"fpmath_float",
"fpmath_float2",
"fpmath_float4",
"intmath_int",
"intmath_int2",
"intmath_int4",
"intmath_long",
"intmath_long2",
"intmath_long4",
"hiloeo",
"if",
"sizeof",
"loop",
"pointer_cast",
"local_arg_def",
"local_kernel_def",
"local_kernel_scope",
"constant",
"constant_source",
"readimage",
"readimage_int16",
"readimage_fp32",
"writeimage",
"writeimage_int16",
"writeimage_fp32",
"mri_one",
"mri_multiple",
"image_r8",
"barrier",
"int2float",
"float2int",
"imagereadwrite",
"imagereadwrite3d",
"readimage3d",
"readimage3d_int16",
"readimage3d_fp32",
"bufferreadwriterect",
"arrayreadwrite",
"arraycopy",
"imagearraycopy",
"imagearraycopy3d",
"imagecopy",
"imagecopy3d",
"imagerandomcopy",
"arrayimagecopy",
"arrayimagecopy3d",
"imagenpot",
"vload_global",
"vload_local",
"vload_constant",
"vload_private",
"vstore_global",
"vstore_local",
"vstore_private",
"createkernelsinprogram",
"imagedim_pow2",
"imagedim_non_pow2",
"image_param",
"image_multipass_integer_coord",
"image_multipass_float_coord",
"explicit_s2v_bool",
"explicit_s2v_char",
"explicit_s2v_uchar",
"explicit_s2v_short",
"explicit_s2v_ushort",
"explicit_s2v_int",
"explicit_s2v_uint",
"explicit_s2v_long",
"explicit_s2v_ulong",
"explicit_s2v_float",
"explicit_s2v_double",
"enqueue_map_buffer",
"enqueue_map_image",
"work_item_functions",
"astype",
"async_copy_global_to_local",
"async_copy_local_to_global",
"async_strided_copy_global_to_local",
"async_strided_copy_local_to_global",
"prefetch",
"kernel_call_kernel_function",
"host_numeric_constants",
"kernel_numeric_constants",
"kernel_limit_constants",
"kernel_preprocessor_macros",
"parameter_types",
"vector_creation",
"vec_type_hint",
"kernel_memory_alignment_local",
"kernel_memory_alignment_global",
"kernel_memory_alignment_constant",
"kernel_memory_alignment_private",
"global_work_offsets",
"get_global_offset",
};
ct_assert((sizeof(basefn_names) / sizeof(basefn_names[0])) == (sizeof(basefn_list) / sizeof(basefn_list[0])));
int num_fns = sizeof(basefn_names) / sizeof(char *);
const int test_num = ARRAY_SIZE( test_list );
int main(int argc, const char *argv[])
{
int err = runTestHarness( argc, argv, num_fns, basefn_list, basefn_names, false, false, 0 );
return err;
return runTestHarness( argc, argv, test_num, test_list, false, false, 0 );
}

View File

@@ -48,8 +48,8 @@ extern int test_readimage_fp32(cl_device_id deviceID, cl_context context, c
extern int test_writeimage(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_writeimage_int16(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_writeimage_fp32(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_multireadimageonefmt(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_multireadimagemultifmt(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_mri_one(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_mri_multiple(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_image_r8(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_simplebarrier(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_barrier(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
@@ -125,7 +125,7 @@ extern int test_kernel_preprocessor_macros(cl_device_id deviceID, cl_context
extern int test_kernel_call_kernel_function(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_basic_parameter_types(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements);
extern int test_parameter_types(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements);
extern int test_vector_creation(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_vec_type_hint(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);

View File

@@ -45,8 +45,7 @@ const char *kernel_code_long =
" result[1] = %s(ul);\n"
"}\n";
int
test_basic_parameter_types_long(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements)
int test_parameter_types_long(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements)
{
clMemWrapper results;
int error;
@@ -157,10 +156,9 @@ test_basic_parameter_types_long(cl_device_id device, cl_context context, cl_comm
return total_errors;
}
int
test_basic_parameter_types(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements)
int test_parameter_types(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements)
{
clMemWrapper results;
clMemWrapper results;
int error;
size_t global[3] = {1, 1, 1};
float results_back[7*16];
@@ -289,7 +287,7 @@ test_basic_parameter_types(cl_device_id device, cl_context context, cl_command_q
if (gHasLong) {
log_info("Testing long types...\n");
total_errors += test_basic_parameter_types_long( device, context, queue, num_elements );
total_errors += test_parameter_types_long( device, context, queue, num_elements );
}
else {
log_info("Longs unsupported, skipping.");

View File

@@ -110,7 +110,7 @@ verify_multireadimage(void *image[], float *outptr, int w, int h)
int
test_multireadimagemultifmt(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements)
test_mri_multiple(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements)
{
cl_mem streams[4];
cl_image_format img_format;

View File

@@ -92,7 +92,7 @@ verify_multireadimage(void *image[], int num_images, float *outptr, int w, int h
}
int test_multireadimageonefmt(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements)
int test_mri_one(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements)
{
cl_mem streams[8];
cl_image_format img_format;