From 18046e65d17783d432143e247038ebebed0e82df Mon Sep 17 00:00:00 2001 From: Grzegorz Wawiorko Date: Mon, 25 Nov 2019 10:24:26 +0100 Subject: [PATCH] Fixes issue #499 - Test basic from master branch on OCL 1.2 device (#500) * Fixes issue #499 - Test basic from master branch on OCL 1.2 device * Restore pitch tests for CL1.X --- test_conformance/basic/main.c | 22 +++++++++---------- test_conformance/basic/test_sizeof.c | 33 +++++++++++++++++----------- 2 files changed, 31 insertions(+), 24 deletions(-) diff --git a/test_conformance/basic/main.c b/test_conformance/basic/main.c index 68f0b225..b02bf3c4 100644 --- a/test_conformance/basic/main.c +++ b/test_conformance/basic/main.c @@ -1,6 +1,6 @@ // // Copyright (c) 2017 The Khronos Group Inc. -// +// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -63,7 +63,7 @@ test_definition test_list[] = { ADD_TEST( mri_multiple ), ADD_TEST( image_r8 ), ADD_TEST( barrier ), - ADD_TEST( wg_barrier ), + ADD_TEST_VERSION( wg_barrier, Version(2, 0) ), ADD_TEST( int2float ), ADD_TEST( float2int ), ADD_TEST( imagereadwrite ), @@ -136,17 +136,17 @@ test_definition test_list[] = { ADD_TEST( kernel_memory_alignment_constant ), ADD_TEST( kernel_memory_alignment_private ), - ADD_TEST( progvar_prog_scope_misc ), - ADD_TEST( progvar_prog_scope_uninit ), - ADD_TEST( progvar_prog_scope_init ), - ADD_TEST( progvar_func_scope ), + ADD_TEST_VERSION( progvar_prog_scope_misc, Version(2, 0) ), + ADD_TEST_VERSION( progvar_prog_scope_uninit, Version(2, 0) ), + ADD_TEST_VERSION( progvar_prog_scope_init, Version(2, 0) ), + ADD_TEST_VERSION( progvar_func_scope, Version(2, 0) ), ADD_TEST( global_work_offsets ), ADD_TEST( get_global_offset ), - ADD_TEST( global_linear_id ), - ADD_TEST( local_linear_id ), - ADD_TEST( enqueued_local_size ), + ADD_TEST_VERSION( global_linear_id, Version(2, 0) ), + ADD_TEST_VERSION( local_linear_id, Version(2, 0) ), + ADD_TEST_VERSION( enqueued_local_size, Version(2, 0) ), ADD_TEST( simple_read_image_pitch ), ADD_TEST( simple_write_image_pitch ), @@ -155,8 +155,8 @@ test_definition test_list[] = { ADD_TEST( queue_priority ), #endif - ADD_TEST( get_linear_ids ), - ADD_TEST( rw_image_access_qualifier ), + ADD_TEST_VERSION( get_linear_ids, Version(2, 0) ), + ADD_TEST_VERSION( rw_image_access_qualifier, Version(2, 0) ), }; const int test_num = ARRAY_SIZE( test_list ); diff --git a/test_conformance/basic/test_sizeof.c b/test_conformance/basic/test_sizeof.c index d37c5688..a480223f 100644 --- a/test_conformance/basic/test_sizeof.c +++ b/test_conformance/basic/test_sizeof.c @@ -1,6 +1,6 @@ // // Copyright (c) 2017 The Khronos Group Inc. -// +// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -24,7 +24,7 @@ -cl_int get_type_size( cl_context context, cl_command_queue queue, const char *type, cl_ulong *size ) +cl_int get_type_size( cl_context context, cl_command_queue queue, const char *type, cl_ulong *size, cl_device_id device ) { const char *sizeof_kernel_code[4] = { @@ -49,8 +49,15 @@ cl_int get_type_size( cl_context context, cl_command_queue queue, const char *ty { sizeof_kernel_code[0] = "#pragma OPENCL EXTENSION cl_khr_fp16 : enable\n"; } + size_t major = 0; + size_t minor = 0; + bool deviceLt20 = false; + int error = get_device_version(device, &major, &minor); + if (major < 2) { + deviceLt20 = true; + } - cl_int err = create_single_kernel_helper_with_build_options(context, &p, &k, 4, sizeof_kernel_code, "test_sizeof", "-cl-std=CL2.0"); + cl_int err = create_single_kernel_helper_with_build_options(context, &p, &k, 4, sizeof_kernel_code, "test_sizeof", deviceLt20 ? "" : "-cl-std=CL2.0"); if( err ) return err; @@ -180,7 +187,7 @@ int test_sizeof(cl_device_id device, cl_context context, cl_command_queue queue, } test = CL_ULONG_MAX; - err = get_type_size( context, queue, scalar_table[i].name, &test ); + err = get_type_size( context, queue, scalar_table[i].name, &test, device); if( err ) return err; if( test != scalar_table[i].size ) @@ -215,7 +222,7 @@ int test_sizeof(cl_device_id device, cl_context context, cl_command_queue queue, sprintf( name, "%s%ld", vector_table[i].name, j ); test = CL_ULONG_MAX; - err = get_type_size( context, queue, name, &test ); + err = get_type_size( context, queue, name, &test, device ); if( err ) return err; if( test != j * vector_table[i].size ) @@ -237,7 +244,7 @@ int test_sizeof(cl_device_id device, cl_context context, cl_command_queue queue, for( i = 0; i < sizeof( ptr_table ) / sizeof( ptr_table[0] ); i++ ) { test = CL_ULONG_MAX; - err = get_type_size( context, queue, ptr_table[i], &test ); + err = get_type_size( context, queue, ptr_table[i], &test, device ); if( err ) return err; if( test != ptr_size ) @@ -250,7 +257,7 @@ int test_sizeof(cl_device_id device, cl_context context, cl_command_queue queue, // Check that intptr_t is large enough test = CL_ULONG_MAX; - err = get_type_size( context, queue, "intptr_t", &test ); + err = get_type_size( context, queue, "intptr_t", &test, device ); if( err ) return err; if( test < ptr_size ) @@ -267,7 +274,7 @@ int test_sizeof(cl_device_id device, cl_context context, cl_command_queue queue, // Check that uintptr_t is large enough test = CL_ULONG_MAX; - err = get_type_size( context, queue, "uintptr_t", &test ); + err = get_type_size( context, queue, "uintptr_t", &test, device ); if( err ) return err; if( test < ptr_size ) @@ -308,7 +315,7 @@ int test_sizeof(cl_device_id device, cl_context context, cl_command_queue queue, } test = CL_ULONG_MAX; - err = get_type_size( context, queue, other_types[i], &test ); + err = get_type_size( context, queue, other_types[i], &test, device ); if( err ) return err; if( ! IsPowerOfTwo( test ) ) @@ -326,7 +333,7 @@ int test_sizeof(cl_device_id device, cl_context context, cl_command_queue queue, { log_info( "\tcl_khr_fp64:" ); test = CL_ULONG_MAX; - err = get_type_size( context, queue, "double", &test ); + err = get_type_size( context, queue, "double", &test, device ); if( err ) return err; if( test != 8 ) @@ -343,7 +350,7 @@ int test_sizeof(cl_device_id device, cl_context context, cl_command_queue queue, sprintf( name, "double%ld", j ); test = CL_ULONG_MAX; - err = get_type_size( context, queue, name, &test ); + err = get_type_size( context, queue, name, &test, device ); if( err ) return err; if( test != 8*j ) @@ -361,7 +368,7 @@ int test_sizeof(cl_device_id device, cl_context context, cl_command_queue queue, { log_info( "\tcl_khr_fp16:" ); test = CL_ULONG_MAX; - err = get_type_size( context, queue, "half", &test ); + err = get_type_size( context, queue, "half", &test, device ); if( err ) return err; if( test != 2 ) @@ -378,7 +385,7 @@ int test_sizeof(cl_device_id device, cl_context context, cl_command_queue queue, sprintf( name, "half%ld", j ); test = CL_ULONG_MAX; - err = get_type_size( context, queue, name, &test ); + err = get_type_size( context, queue, name, &test, device ); if( err ) return err; if( test != 2*j )