From dba946aa152f1814a5565268be16b572739742de Mon Sep 17 00:00:00 2001 From: Sven van Haastregt Date: Wed, 21 Jun 2023 17:49:07 +0100 Subject: [PATCH] workgroups: fix -Wsign-compare warnings In preparation of re-enabling -Wsign-compare globally, fix some instances of this warning. Signed-off-by: Sven van Haastregt --- test_conformance/workgroups/test_wg_all.cpp | 3 +-- test_conformance/workgroups/test_wg_any.cpp | 3 +-- test_conformance/workgroups/test_wg_broadcast.cpp | 11 ++++------- .../workgroups/test_wg_suggested_local_work_size.cpp | 4 ++-- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/test_conformance/workgroups/test_wg_all.cpp b/test_conformance/workgroups/test_wg_all.cpp index 41abd1249..f9b574e45 100644 --- a/test_conformance/workgroups/test_wg_all.cpp +++ b/test_conformance/workgroups/test_wg_all.cpp @@ -75,7 +75,6 @@ test_work_group_all(cl_device_id device, cl_context context, cl_command_queue qu size_t wg_size[1]; size_t num_elements; int err; - int i; MTdata d; err = create_single_kernel_helper(context, &program, &kernel, 1, @@ -110,7 +109,7 @@ test_work_group_all(cl_device_id device, cl_context context, cl_command_queue qu p = input_ptr[0]; d = init_genrand( gRandomSeed ); - for (i=0; i<(num_elements+1); i++) + for (size_t i = 0; i < (num_elements + 1); i++) { p[i] = get_random_float((float)(-100000.f * M_PI), (float)(100000.f * M_PI) ,d); } diff --git a/test_conformance/workgroups/test_wg_any.cpp b/test_conformance/workgroups/test_wg_any.cpp index e0242cfb4..f7ff899a3 100644 --- a/test_conformance/workgroups/test_wg_any.cpp +++ b/test_conformance/workgroups/test_wg_any.cpp @@ -75,7 +75,6 @@ test_work_group_any(cl_device_id device, cl_context context, cl_command_queue qu size_t wg_size[1]; size_t num_elements; int err; - int i; MTdata d; err = create_single_kernel_helper(context, &program, &kernel, 1, @@ -110,7 +109,7 @@ test_work_group_any(cl_device_id device, cl_context context, cl_command_queue qu p = input_ptr[0]; d = init_genrand( gRandomSeed ); - for (i=0; i<(num_elements+1); i++) + for (size_t i = 0; i < (num_elements + 1); i++) { p[i] = get_random_float((float)(-100000.f * M_PI), (float)(100000.f * M_PI) ,d); } diff --git a/test_conformance/workgroups/test_wg_broadcast.cpp b/test_conformance/workgroups/test_wg_broadcast.cpp index e24ac7b98..a4cb0c6fe 100644 --- a/test_conformance/workgroups/test_wg_broadcast.cpp +++ b/test_conformance/workgroups/test_wg_broadcast.cpp @@ -70,7 +70,7 @@ verify_wg_broadcast_1D(float *inptr, float *outptr, size_t n, size_t wg_size) for (i=0,group_id=0; i wg_size ? wg_size : (n-i); + size_t local_size = (n - i) > wg_size ? wg_size : (n - i); float broadcast_result = inptr[i + (group_id % local_size)]; for (j=0; j