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

@@ -31,273 +31,138 @@
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_wg_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( wg_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_progvar_prog_scope_misc,
test_progvar_prog_scope_uninit,
test_progvar_prog_scope_init,
test_progvar_func_scope,
ADD_TEST( progvar_prog_scope_misc ),
ADD_TEST( progvar_prog_scope_uninit ),
ADD_TEST( progvar_prog_scope_init ),
ADD_TEST( progvar_func_scope ),
test_global_work_offsets,
test_get_global_offset,
ADD_TEST( global_work_offsets ),
ADD_TEST( get_global_offset ),
test_global_linear_id,
test_local_linear_id,
test_enqueued_local_size,
ADD_TEST( global_linear_id ),
ADD_TEST( local_linear_id ),
ADD_TEST( enqueued_local_size ),
test_simple_read_image_pitch,
test_simple_write_image_pitch,
ADD_TEST( simple_read_image_pitch ),
ADD_TEST( simple_write_image_pitch ),
#if defined( __APPLE__ )
test_queue_priority,
ADD_TEST( queue_priority ),
#endif
test_get_linear_ids,
test_rw_image_access_qualifier
ADD_TEST( get_linear_ids ),
ADD_TEST( rw_image_access_qualifier ),
};
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",
"wg_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",
"progvar_prog_scope_misc",
"progvar_prog_scope_uninit",
"progvar_prog_scope_init",
"progvar_func_scope",
"global_work_offsets",
"get_global_offset",
"global_linear_id",
"local_linear_id",
"enqueued_local_size",
"simple_read_image_pitch",
"simple_write_image_pitch",
#if defined( __APPLE__ )
"queue_priority",
#endif
"get_linear_ids",
"test_rw_image_access_qualifier",
};
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

@@ -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);
@@ -126,7 +126,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

@@ -46,10 +46,9 @@ 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;
clMemWrapper results;
int error;
size_t global[3] = {1, 1, 1};
float results_back[2*16];
@@ -158,10 +157,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];
@@ -290,7 +288,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

@@ -111,7 +111,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

@@ -93,7 +93,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;