mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Migrate API suite to the new test registration framework (#2196)
Contributes to #2181 Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
This commit is contained in:
@@ -33,7 +33,7 @@ static void CL_CALLBACK test_native_kernel_fn( void *userData )
|
||||
args->dest[ i ] = args->source[ i ];
|
||||
}
|
||||
|
||||
int test_native_kernel(cl_device_id device, cl_context context, cl_command_queue queue, int n_elems )
|
||||
REGISTER_TEST(native_kernel)
|
||||
{
|
||||
int error;
|
||||
RandomSeed seed( gRandomSeed );
|
||||
@@ -46,7 +46,7 @@ int test_native_kernel(cl_device_id device, cl_context context, cl_command_queue
|
||||
}
|
||||
|
||||
clMemWrapper streams[ 2 ];
|
||||
std::vector<cl_int> inBuffer(n_elems), outBuffer(n_elems);
|
||||
std::vector<cl_int> inBuffer(num_elements), outBuffer(num_elements);
|
||||
clEventWrapper finishEvent;
|
||||
|
||||
struct arg_struct
|
||||
@@ -58,21 +58,22 @@ int test_native_kernel(cl_device_id device, cl_context context, cl_command_queue
|
||||
|
||||
|
||||
// Create some input values
|
||||
generate_random_data(kInt, n_elems, seed, inBuffer.data());
|
||||
generate_random_data(kInt, num_elements, seed, inBuffer.data());
|
||||
|
||||
// Create I/O streams
|
||||
streams[0] =
|
||||
clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, n_elems * sizeof(cl_int),
|
||||
inBuffer.data(), &error);
|
||||
clCreateBuffer(context, CL_MEM_COPY_HOST_PTR,
|
||||
num_elements * sizeof(cl_int), inBuffer.data(), &error);
|
||||
test_error( error, "Unable to create I/O stream" );
|
||||
streams[ 1 ] = clCreateBuffer( context, 0, n_elems * sizeof(cl_int), NULL, &error );
|
||||
streams[1] =
|
||||
clCreateBuffer(context, 0, num_elements * sizeof(cl_int), NULL, &error);
|
||||
test_error( error, "Unable to create I/O stream" );
|
||||
|
||||
|
||||
// Set up the arrays to call with
|
||||
args.inputStream = streams[ 0 ];
|
||||
args.outputStream = streams[ 1 ];
|
||||
args.count = n_elems;
|
||||
args.count = num_elements;
|
||||
|
||||
void * memLocs[ 2 ] = { &args.inputStream, &args.outputStream };
|
||||
|
||||
@@ -94,11 +95,11 @@ int test_native_kernel(cl_device_id device, cl_context context, cl_command_queue
|
||||
|
||||
// Now read the results and verify
|
||||
error = clEnqueueReadBuffer(queue, streams[1], CL_TRUE, 0,
|
||||
n_elems * sizeof(cl_int), outBuffer.data(), 0,
|
||||
NULL, NULL);
|
||||
num_elements * sizeof(cl_int), outBuffer.data(),
|
||||
0, NULL, NULL);
|
||||
test_error( error, "Unable to read results" );
|
||||
|
||||
for( int i = 0; i < n_elems; i++ )
|
||||
for (int i = 0; i < num_elements; i++)
|
||||
{
|
||||
if (inBuffer[i] != outBuffer[i])
|
||||
{
|
||||
@@ -111,8 +112,3 @@ int test_native_kernel(cl_device_id device, cl_context context, cl_command_queue
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user