Migrate workgroups suite to the new test registration framework (#2308)

Contributes to #2181

Signed-off-by: Kévin Petit <kpet@free.fr>
This commit is contained in:
Kévin Petit
2025-03-11 22:00:38 +00:00
committed by GitHub
parent 641ffeaa67
commit bb604702a5
7 changed files with 133 additions and 261 deletions

View File

@@ -20,8 +20,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include "procs.h"
#include "testBase.h"
const char *wg_all_kernel_code =
"__kernel void test_wg_all(global float *input, global int *output)\n"
@@ -65,8 +64,7 @@ verify_wg_all(float *inptr, int *outptr, size_t n, size_t wg_size)
return 0;
}
int
test_work_group_all(cl_device_id device, cl_context context, cl_command_queue queue, int n_elems)
REGISTER_TEST_VERSION(work_group_all, Version(2, 0))
{
cl_mem streams[2];
cl_float *input_ptr[1], *p;
@@ -74,8 +72,7 @@ test_work_group_all(cl_device_id device, cl_context context, cl_command_queue qu
cl_program program;
cl_kernel kernel;
size_t threads[1];
size_t wg_size[1];
size_t num_elements;
size_t wg_size[1];
int err;
MTdata d;
@@ -88,8 +85,6 @@ test_work_group_all(cl_device_id device, cl_context context, cl_command_queue qu
err = get_max_allowed_1d_work_group_size_on_device(device, kernel, wg_size);
test_error(err, "get_max_allowed_1d_work_group_size_on_device failed");
num_elements = n_elems;
input_ptr[0] = (cl_float*)malloc(sizeof(cl_float) * (num_elements+1));
output_ptr = (cl_int*)malloc(sizeof(cl_int) * (num_elements+1));
streams[0] =
@@ -111,7 +106,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 (size_t i = 0; i < (num_elements + 1); i++)
for (int i = 0; i < (num_elements + 1); i++)
{
p[i] = get_random_float((float)(-100000.f * M_PI), (float)(100000.f * M_PI) ,d);
}
@@ -133,7 +128,7 @@ test_work_group_all(cl_device_id device, cl_context context, cl_command_queue qu
}
// Line below is troublesome...
threads[0] = (size_t)n_elems;
threads[0] = (size_t)num_elements;
err = clEnqueueNDRangeKernel( queue, kernel, 1, NULL, threads, wg_size, 0, NULL, NULL );
if (err != CL_SUCCESS)
{