mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Using helper functions for clCreateKernel (#1064)
* Using helper functions for clCreateKernel Uses of clCreateKernel following create program helper functions, have been incorporated into create_single_kernel_helper when suitable. Contributes #31 Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com> * Skip tests using clCompileProgram in offline mode Contributes #31 Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com> * Using type wrappers when using kernel helper functions Also includes fix for windows build Fixes #31 Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com> * Remove clReleaseKernel for wrapped kernel Fixes #31 Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
This commit is contained in:
@@ -525,11 +525,10 @@ int test_repeated_setup_cleanup(cl_device_id deviceID, cl_context context, cl_co
|
||||
local_queue = clCreateCommandQueue(local_context, deviceID, 0, &error);
|
||||
test_error( error, "clCreateCommandQueue failed");
|
||||
|
||||
error = create_single_kernel_helper(local_context, &local_program, NULL, 1, &repeate_test_kernel, NULL);
|
||||
test_error( error, "Unable to build test program" );
|
||||
|
||||
local_kernel = clCreateKernel(local_program, "test_kernel", &error);
|
||||
test_error( error, "clCreateKernel failed");
|
||||
error = create_single_kernel_helper(
|
||||
local_context, &local_program, &local_kernel, 1,
|
||||
&repeate_test_kernel, "test_kernel");
|
||||
test_error(error, "Unable to create kernel");
|
||||
|
||||
local_mem_in = clCreateBuffer(local_context, CL_MEM_READ_ONLY, TEST_SIZE*sizeof(cl_int), NULL, &error);
|
||||
test_error( error, "clCreateBuffer failed");
|
||||
|
||||
@@ -157,14 +157,13 @@ int test_null_buffer_arg(cl_device_id device, cl_context context,
|
||||
|
||||
// prep kernel:
|
||||
if (gIsEmbedded)
|
||||
status = create_single_kernel_helper(context, &program, NULL, 1, &kernel_string, NULL);
|
||||
status = create_single_kernel_helper(context, &program, &kernel, 1,
|
||||
&kernel_string, "test_kernel");
|
||||
else
|
||||
status = create_single_kernel_helper(context, &program, NULL, 1, &kernel_string_long, NULL);
|
||||
status = create_single_kernel_helper(
|
||||
context, &program, &kernel, 1, &kernel_string_long, "test_kernel");
|
||||
|
||||
test_error(status, "Unable to build test program");
|
||||
|
||||
kernel = clCreateKernel(program, "test_kernel", &status);
|
||||
test_error(status, "CreateKernel failed.");
|
||||
test_error(status, "Unable to create kernel");
|
||||
|
||||
cl_mem dev_src = clCreateBuffer(context, CL_MEM_READ_ONLY, NITEMS*sizeof(cl_float),
|
||||
NULL, NULL);
|
||||
|
||||
@@ -251,11 +251,9 @@ int test_retain_mem_object_set_kernel_arg(cl_device_id deviceID, cl_context cont
|
||||
err = clSetMemObjectDestructorCallback( buffer, callback, nullptr );
|
||||
test_error( err, "Unable to set destructor callback" );
|
||||
|
||||
err = create_single_kernel_helper( context, &program, nullptr, 1, testProgram, nullptr );
|
||||
test_error( err, "Unable to build sample program" );
|
||||
|
||||
kernel = clCreateKernel( program, "sample_test", &err );
|
||||
test_error( err, "Unable to create sample_test kernel" );
|
||||
err = create_single_kernel_helper(context, &program, &kernel, 1,
|
||||
testProgram, "sample_test");
|
||||
test_error(err, "Unable to build sample program and sample_test kernel");
|
||||
|
||||
err = clSetKernelArg( kernel, 0, sizeof(cl_mem), &buffer );
|
||||
test_error( err, "Unable to set kernel argument" );
|
||||
|
||||
@@ -28,14 +28,11 @@ int test_release_kernel_order(cl_device_id deviceID, cl_context context, cl_comm
|
||||
int error;
|
||||
const char *testProgram[] = { "__kernel void sample_test(__global int *data){}" };
|
||||
|
||||
/* Create a test program */
|
||||
error = create_single_kernel_helper(context, &program, NULL, 1, testProgram, NULL);
|
||||
/* Create a test program and kernel from it */
|
||||
error = create_single_kernel_helper(context, &program, &kernel, 1,
|
||||
testProgram, "sample_test");
|
||||
test_error( error, "Unable to build sample program to test with" );
|
||||
|
||||
/* And create a kernel from it */
|
||||
kernel = clCreateKernel( program, "sample_test", &error );
|
||||
test_error( error, "Unable to create kernel" );
|
||||
|
||||
/* Now try freeing the program first, then the kernel. If refcounts are right, this should work just fine */
|
||||
clReleaseProgram( program );
|
||||
clReleaseKernel( kernel );
|
||||
|
||||
Reference in New Issue
Block a user