diff --git a/test_conformance/CMakeLists.txt b/test_conformance/CMakeLists.txt index 498f3a3d06..1f1970afd8 100644 --- a/test_conformance/CMakeLists.txt +++ b/test_conformance/CMakeLists.txt @@ -1,10 +1,6 @@ # Remember current source directory (`test_conformance'). set( CLConf_Install_Base_Dir "${CMAKE_CURRENT_SOURCE_DIR}" ) -if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?Clang") - add_cxx_flag_if_supported(-Wno-narrowing) -endif() - set(HARNESS_LIB harness) add_subdirectory( allocations ) diff --git a/test_conformance/api/test_queries.cpp b/test_conformance/api/test_queries.cpp index c82017ba60..2c4bdb1072 100644 --- a/test_conformance/api/test_queries.cpp +++ b/test_conformance/api/test_queries.cpp @@ -154,7 +154,7 @@ int sampler_param_test(cl_sampler sampler, cl_sampler_info param_name, return 0; } -static cl_int normalized_coord_values[] = { CL_TRUE, CL_FALSE }; +static cl_bool normalized_coord_values[] = { CL_TRUE, CL_FALSE }; static cl_addressing_mode addressing_mode_values[] = { CL_ADDRESS_NONE, CL_ADDRESS_CLAMP_TO_EDGE, CL_ADDRESS_CLAMP, CL_ADDRESS_REPEAT, CL_ADDRESS_MIRRORED_REPEAT diff --git a/test_conformance/atomics/test_atomics.cpp b/test_conformance/atomics/test_atomics.cpp index caa4b78f6e..db0d000a7b 100644 --- a/test_conformance/atomics/test_atomics.cpp +++ b/test_conformance/atomics/test_atomics.cpp @@ -1292,8 +1292,8 @@ cl_long test_atomic_and_result_long(size_t size, cl_long *startRefValues, int test_atomic_and(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { - TestFns set = { 0xffffffff, - 0xffffffffffffffffLL, + TestFns set = { (cl_int)0xffffffff, + (cl_long)0xffffffffffffffffLL, test_bitwise_num_results, test_atomic_and_result_int, NULL, diff --git a/test_conformance/basic/CMakeLists.txt b/test_conformance/basic/CMakeLists.txt index bf1f3bd63a..7292bc9d37 100644 --- a/test_conformance/basic/CMakeLists.txt +++ b/test_conformance/basic/CMakeLists.txt @@ -1,5 +1,9 @@ set(MODULE_NAME BASIC) +if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?Clang") + add_cxx_flag_if_supported(-Wno-narrowing) +endif() + set(${MODULE_NAME}_SOURCES main.cpp test_fpmath.cpp diff --git a/test_conformance/compiler/CMakeLists.txt b/test_conformance/compiler/CMakeLists.txt index e703471d28..5806469a98 100644 --- a/test_conformance/compiler/CMakeLists.txt +++ b/test_conformance/compiler/CMakeLists.txt @@ -1,5 +1,9 @@ set(MODULE_NAME COMPILER) +if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?Clang") + add_cxx_flag_if_supported(-Wno-narrowing) +endif() + set(${MODULE_NAME}_SOURCES main.cpp test_build_helpers.cpp diff --git a/test_conformance/computeinfo/main.cpp b/test_conformance/computeinfo/main.cpp index 478f19f4b9..3f0551687e 100644 --- a/test_conformance/computeinfo/main.cpp +++ b/test_conformance/computeinfo/main.cpp @@ -35,11 +35,11 @@ typedef struct } device_info; device_info device_infos[] = { - { CL_DEVICE_TYPE_DEFAULT, "CL_DEVICE_TYPE_DEFAULT", -1, NULL }, - { CL_DEVICE_TYPE_CPU, "CL_DEVICE_TYPE_CPU", -1, NULL }, - { CL_DEVICE_TYPE_GPU, "CL_DEVICE_TYPE_GPU", -1, NULL }, - { CL_DEVICE_TYPE_ACCELERATOR, "CL_DEVICE_TYPE_ACCELERATOR", -1, NULL }, - { CL_DEVICE_TYPE_ALL, "CL_DEVICE_TYPE_ALL", -1, NULL }, + { CL_DEVICE_TYPE_DEFAULT, "CL_DEVICE_TYPE_DEFAULT", 0, NULL }, + { CL_DEVICE_TYPE_CPU, "CL_DEVICE_TYPE_CPU", 0, NULL }, + { CL_DEVICE_TYPE_GPU, "CL_DEVICE_TYPE_GPU", 0, NULL }, + { CL_DEVICE_TYPE_ACCELERATOR, "CL_DEVICE_TYPE_ACCELERATOR", 0, NULL }, + { CL_DEVICE_TYPE_ALL, "CL_DEVICE_TYPE_ALL", 0, NULL }, }; // config types diff --git a/test_conformance/conversions/CMakeLists.txt b/test_conformance/conversions/CMakeLists.txt index e2e9766725..32990ebae4 100644 --- a/test_conformance/conversions/CMakeLists.txt +++ b/test_conformance/conversions/CMakeLists.txt @@ -1,5 +1,9 @@ set(MODULE_NAME CONVERSIONS) +if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?Clang") + add_cxx_flag_if_supported(-Wno-narrowing) +endif() + set (${MODULE_NAME}_SOURCES Sleep.cpp test_conversions.cpp basic_test_conversions.cpp ) diff --git a/test_conformance/device_execution/execute_block.cpp b/test_conformance/device_execution/execute_block.cpp index 5b7ee2f1c4..bd876113eb 100644 --- a/test_conformance/device_execution/execute_block.cpp +++ b/test_conformance/device_execution/execute_block.cpp @@ -1016,7 +1016,7 @@ int test_execute_block(cl_device_id device, cl_context context, cl_command_queue size_t ret_len; cl_int n, err_ret, res = 0; clCommandQueueWrapper dev_queue; - cl_int kernel_results[MAX_GWS] = {0xDEADBEEF}; + cl_int kernel_results[MAX_GWS] = { (cl_int)0xDEADBEEF }; size_t max_local_size = 1; err_ret = clGetDeviceInfo(device, CL_DEVICE_MAX_WORK_GROUP_SIZE, sizeof(max_local_size), &max_local_size, &ret_len); diff --git a/test_conformance/device_partition/test_device_partition.cpp b/test_conformance/device_partition/test_device_partition.cpp index cb53605ab1..3f1253692a 100644 --- a/test_conformance/device_partition/test_device_partition.cpp +++ b/test_conformance/device_partition/test_device_partition.cpp @@ -353,7 +353,8 @@ int test_device_set(size_t deviceCount, size_t queueCount, cl_device_id *devices } -int init_device_partition_test(cl_device_id parentDevice, cl_uint &maxComputeUnits, cl_uint &maxSubDevices) +int init_device_partition_test(cl_device_id parentDevice, + cl_uint &maxComputeUnits, cl_uint &maxSubDevices) { int err = clGetDeviceInfo(parentDevice, CL_DEVICE_MAX_COMPUTE_UNITS, sizeof(maxComputeUnits), &maxComputeUnits, NULL); test_error( err, "Unable to get maximal number of compute units" ); @@ -449,14 +450,21 @@ int test_partition_of_device(cl_device_id deviceID, cl_context context, cl_comma #define PROPERTY_TYPES 8 cl_device_partition_property partitionProp[PROPERTY_TYPES][5] = { - { CL_DEVICE_PARTITION_EQUALLY, maxComputeUnits / 2, 0, 0, 0 } , - { CL_DEVICE_PARTITION_BY_COUNTS, 1, maxComputeUnits - 1, CL_DEVICE_PARTITION_BY_COUNTS_LIST_END, 0 } , - { CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN, CL_DEVICE_AFFINITY_DOMAIN_NUMA, 0, 0, 0 } , - { CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN, CL_DEVICE_AFFINITY_DOMAIN_L4_CACHE, 0, 0, 0 } , - { CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN, CL_DEVICE_AFFINITY_DOMAIN_L3_CACHE, 0, 0, 0 } , - { CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN, CL_DEVICE_AFFINITY_DOMAIN_L2_CACHE, 0, 0, 0 } , - { CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN, CL_DEVICE_AFFINITY_DOMAIN_L1_CACHE, 0, 0, 0 } , - { CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN, CL_DEVICE_AFFINITY_DOMAIN_NEXT_PARTITIONABLE, 0, 0, 0 } + { CL_DEVICE_PARTITION_EQUALLY, (cl_int)maxComputeUnits / 2, 0, 0, 0 }, + { CL_DEVICE_PARTITION_BY_COUNTS, 1, (cl_int)maxComputeUnits - 1, + CL_DEVICE_PARTITION_BY_COUNTS_LIST_END, 0 }, + { CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN, + CL_DEVICE_AFFINITY_DOMAIN_NUMA, 0, 0, 0 }, + { CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN, + CL_DEVICE_AFFINITY_DOMAIN_L4_CACHE, 0, 0, 0 }, + { CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN, + CL_DEVICE_AFFINITY_DOMAIN_L3_CACHE, 0, 0, 0 }, + { CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN, + CL_DEVICE_AFFINITY_DOMAIN_L2_CACHE, 0, 0, 0 }, + { CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN, + CL_DEVICE_AFFINITY_DOMAIN_L1_CACHE, 0, 0, 0 }, + { CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN, + CL_DEVICE_AFFINITY_DOMAIN_NEXT_PARTITIONABLE, 0, 0, 0 } }; // loop thru each type, creating sub-devices for each type diff --git a/test_conformance/extensions/cl_khr_command_buffer/command_buffer_printf.cpp b/test_conformance/extensions/cl_khr_command_buffer/command_buffer_printf.cpp index 80fac2ada1..f0e4f56770 100644 --- a/test_conformance/extensions/cl_khr_command_buffer/command_buffer_printf.cpp +++ b/test_conformance/extensions/cl_khr_command_buffer/command_buffer_printf.cpp @@ -175,7 +175,7 @@ struct CommandBufferPrintfTest : public BasicCommandBufferTest nullptr, &error); test_error(error, "clCreateBuffer failed"); - cl_int offset[] = { 0, max_pattern_length }; + cl_uint offset[] = { 0, max_pattern_length }; off_mem = clCreateBuffer(context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, sizeof(offset), offset, &error); @@ -274,7 +274,7 @@ struct CommandBufferPrintfTest : public BasicCommandBufferTest &pattern[0], 0, nullptr, nullptr); test_error(error, "clEnqueueWriteBuffer failed"); - cl_int offset[] = { 0, pattern.size() - 1 }; + size_t offset[] = { 0, pattern.size() - 1 }; error = clEnqueueWriteBuffer(queue, off_mem, CL_TRUE, 0, sizeof(offset), offset, 0, nullptr, nullptr); test_error(error, "clEnqueueWriteBuffer failed"); diff --git a/test_conformance/extensions/cl_khr_command_buffer/negative_command_buffer_create.cpp b/test_conformance/extensions/cl_khr_command_buffer/negative_command_buffer_create.cpp index 5cc287c0bb..751711f1ba 100644 --- a/test_conformance/extensions/cl_khr_command_buffer/negative_command_buffer_create.cpp +++ b/test_conformance/extensions/cl_khr_command_buffer/negative_command_buffer_create.cpp @@ -115,7 +115,8 @@ struct CreateCommandBufferRepeatedProperties : public BasicCommandBufferTest TEST_FAIL); cl_command_buffer_properties_khr invalid_properties[3] = { - CL_COMMAND_BUFFER_FLAGS_KHR, CL_INVALID_PROPERTY, 0 + CL_COMMAND_BUFFER_FLAGS_KHR, + (cl_command_buffer_properties_khr)CL_INVALID_PROPERTY, 0 }; command_buffer = diff --git a/test_conformance/extensions/cl_khr_semaphore/test_semaphores_negative_create.cpp b/test_conformance/extensions/cl_khr_semaphore/test_semaphores_negative_create.cpp index 753e6f42f1..35aeaa988c 100644 --- a/test_conformance/extensions/cl_khr_semaphore/test_semaphores_negative_create.cpp +++ b/test_conformance/extensions/cl_khr_semaphore/test_semaphores_negative_create.cpp @@ -165,7 +165,8 @@ struct CreateInvalidMultiDeviceProperty : public SemaphoreTestBase test_error(err, "Unable to get maximal number of compute units"); cl_device_partition_property partitionProp[] = { - CL_DEVICE_PARTITION_EQUALLY, maxComputeUnits / 2, 0 + CL_DEVICE_PARTITION_EQUALLY, + static_cast(maxComputeUnits / 2), 0 }; cl_uint deviceCount = 0; @@ -238,7 +239,8 @@ struct CreateInvalidDevice : public SemaphoreTestBase test_error(err, "Unable to get maximal number of compute units"); cl_device_partition_property partitionProp[] = { - CL_DEVICE_PARTITION_EQUALLY, maxComputeUnits / 2, 0 + CL_DEVICE_PARTITION_EQUALLY, + static_cast(maxComputeUnits / 2), 0 }; cl_uint deviceCount = 0; diff --git a/test_conformance/integer_ops/CMakeLists.txt b/test_conformance/integer_ops/CMakeLists.txt index 7bc991f8d5..9966ca6fe4 100644 --- a/test_conformance/integer_ops/CMakeLists.txt +++ b/test_conformance/integer_ops/CMakeLists.txt @@ -1,5 +1,9 @@ set(MODULE_NAME INTEGER_OPS) +if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?Clang") + add_cxx_flag_if_supported(-Wno-narrowing) +endif() + set(${MODULE_NAME}_SOURCES main.cpp test_int_basic_ops.cpp diff --git a/test_conformance/non_uniform_work_group/CMakeLists.txt b/test_conformance/non_uniform_work_group/CMakeLists.txt index 30c3a84610..7db5bcbb11 100644 --- a/test_conformance/non_uniform_work_group/CMakeLists.txt +++ b/test_conformance/non_uniform_work_group/CMakeLists.txt @@ -1,5 +1,9 @@ set(MODULE_NAME NON_UNIFORM_WORK_GROUP) +if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?Clang") + add_cxx_flag_if_supported(-Wno-narrowing) +endif() + set(${MODULE_NAME}_SOURCES main.cpp test_advanced_2d.cpp diff --git a/test_conformance/profiling/execute.cpp b/test_conformance/profiling/execute.cpp index 44b1bcd4bf..d4fd51e390 100644 --- a/test_conformance/profiling/execute.cpp +++ b/test_conformance/profiling/execute.cpp @@ -314,7 +314,7 @@ static int kernelFilter( cl_device_id device, cl_context context, cl_command_que // read output image size_t origin[3] = { 0, 0, 0 }; - size_t region[3] = { w, h, 1 }; + size_t region[3] = { (size_t)w, (size_t)h, 1 }; err = clEnqueueReadImage( queue, memobjs[1], true, origin, region, 0, 0, outptr, 0, NULL, NULL); if( err != CL_SUCCESS ){ print_error( err, "clReadImage failed\n" ); diff --git a/test_conformance/profiling/readImage.cpp b/test_conformance/profiling/readImage.cpp index 9ba6b472e7..fd4da128e1 100644 --- a/test_conformance/profiling/readImage.cpp +++ b/test_conformance/profiling/readImage.cpp @@ -233,7 +233,7 @@ int read_image( cl_device_id device, cl_context context, cl_command_queue queue, } size_t origin[3] = { 0, 0, 0 }; - size_t region[3] = { w, h, 1 }; + size_t region[3] = { (size_t)w, (size_t)h, 1 }; err = clEnqueueReadImage( queue, memobjs[0], false, origin, region, 0, 0, dst, 0, NULL, &readEvent ); if( err != CL_SUCCESS ){ print_error( err, "clReadImage2D failed" ); diff --git a/test_conformance/profiling/writeImage.cpp b/test_conformance/profiling/writeImage.cpp index ec2fbdaf3b..e2a6dd5935 100644 --- a/test_conformance/profiling/writeImage.cpp +++ b/test_conformance/profiling/writeImage.cpp @@ -472,7 +472,7 @@ int write_image( cl_device_id device, cl_context context, cl_command_queue queue } size_t origin[3] = { 0, 0, 0 }; - size_t region[3] = { w, h, 1 }; + size_t region[3] = { (size_t)w, (size_t)h, 1 }; err = clEnqueueWriteImage( queue, memobjs[0], false, origin, region, 0, 0, inptr, 0, NULL, &writeEvent ); if( err != CL_SUCCESS ){ clReleaseMemObject(memobjs[0]); diff --git a/test_conformance/spir/main.cpp b/test_conformance/spir/main.cpp index ca02e5c21b..9a13b405c6 100644 --- a/test_conformance/spir/main.cpp +++ b/test_conformance/spir/main.cpp @@ -155,7 +155,8 @@ static void get_spir_version(cl_device_id device, { auto major = v[v.find('.') - 1]; auto minor = v[v.find('.') + 1]; - versions.push_back(Version{ major - '0', minor - '0' }); + versions.push_back( + Version{ (cl_uint)(major - '0'), (cl_uint)(minor - '0') }); } } diff --git a/test_conformance/spirv_new/CMakeLists.txt b/test_conformance/spirv_new/CMakeLists.txt index 16a61b4075..4fb7cb8f96 100644 --- a/test_conformance/spirv_new/CMakeLists.txt +++ b/test_conformance/spirv_new/CMakeLists.txt @@ -34,6 +34,10 @@ set(TEST_HARNESS_SOURCES ../../test_conformance/math_brute_force/utility.cpp ) +if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?Clang") + add_cxx_flag_if_supported(-Wno-narrowing) +endif() + set(${MODULE_NAME}_SOURCES ${SPIRV_NEW_SOURCES} ${TEST_HARNESS_SOURCES}) include(../CMakeCommon.txt)