Skip to content

Commit

Permalink
workgroups: fix -Wsign-compare warnings
Browse files Browse the repository at this point in the history
In preparation of re-enabling -Wsign-compare globally, fix some
instances of this warning.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
  • Loading branch information
svenvh committed Jun 21, 2023
1 parent 50f9f06 commit dba946a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 13 deletions.
3 changes: 1 addition & 2 deletions test_conformance/workgroups/test_wg_all.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
}
Expand Down
3 changes: 1 addition & 2 deletions test_conformance/workgroups/test_wg_any.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
}
Expand Down
11 changes: 4 additions & 7 deletions test_conformance/workgroups/test_wg_broadcast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<n; i+=wg_size,group_id++)
{
int local_size = (n-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<local_size; j++)
{
Expand Down Expand Up @@ -172,7 +172,6 @@ test_work_group_broadcast_1D(cl_device_id device, cl_context context, cl_command
size_t wg_size[1];
size_t num_elements;
int err;
int i;
MTdata d;

err = create_single_kernel_helper(context, &program, &kernel, 1,
Expand Down Expand Up @@ -207,7 +206,7 @@ test_work_group_broadcast_1D(cl_device_id device, cl_context context, cl_command

p = input_ptr[0];
d = init_genrand( gRandomSeed );
for (i=0; i<num_elements; i++)
for (size_t i = 0; i < num_elements; i++)
{
p[i] = get_random_float((float)(-100000.f * M_PI), (float)(100000.f * M_PI) ,d);
}
Expand Down Expand Up @@ -278,7 +277,6 @@ test_work_group_broadcast_2D(cl_device_id device, cl_context context, cl_command
size_t num_workgroups;
size_t num_elements;
int err;
int i;
MTdata d;

err = create_single_kernel_helper(context, &program, &kernel, 1,
Expand Down Expand Up @@ -333,7 +331,7 @@ test_work_group_broadcast_2D(cl_device_id device, cl_context context, cl_command

p = input_ptr[0];
d = init_genrand( gRandomSeed );
for (i=0; i<num_elements; i++)
for (size_t i = 0; i < num_elements; i++)
{
p[i] = get_random_float((float)(-100000.f * M_PI), (float)(100000.f * M_PI) ,d);
}
Expand Down Expand Up @@ -402,7 +400,6 @@ test_work_group_broadcast_3D(cl_device_id device, cl_context context, cl_command
size_t num_workgroups;
size_t num_elements;
int err;
int i;
MTdata d;

err = create_single_kernel_helper(context, &program, &kernel, 1,
Expand Down Expand Up @@ -458,7 +455,7 @@ test_work_group_broadcast_3D(cl_device_id device, cl_context context, cl_command

p = input_ptr[0];
d = init_genrand( gRandomSeed );
for (i=0; i<num_elements; i++)
for (size_t i = 0; i < num_elements; i++)
{
p[i] = get_random_float((float)(-100000.f * M_PI), (float)(100000.f * M_PI) ,d);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ int do_test(cl_device_id device, cl_context context, cl_command_queue queue,
int do_test_work_group_suggested_local_size(
cl_device_id device, cl_context context, cl_command_queue queue,
bool (*skip_cond)(size_t), size_t start, size_t end, size_t incr,
cl_long max_local_mem_size, size_t global_work_offset[], num_dims dim)
cl_ulong max_local_mem_size, size_t global_work_offset[], num_dims dim)
{
clProgramWrapper scan_program;
clKernelWrapper scan_kernel;
Expand Down Expand Up @@ -300,7 +300,7 @@ int test_work_group_suggested_local_size_1D(cl_device_id device,
"Skipping the test.\n");
return TEST_SKIPPED_ITSELF;
}
cl_long max_local_mem_size;
cl_ulong max_local_mem_size;
cl_int err =
clGetDeviceInfo(device, CL_DEVICE_LOCAL_MEM_SIZE,
sizeof(max_local_mem_size), &max_local_mem_size, NULL);
Expand Down

0 comments on commit dba946a

Please sign in to comment.