@@ -90,7 +90,10 @@ const char* clone_kernel_test_kernel[] = {
9090 __kernel void set_kernel_exec_info_kernel(int iarg, __global BufPtr* buffer)
9191 {
9292 buffer->store[0] = iarg;
93- })"
93+ }
94+
95+ __kernel void test_kernel_empty(){}
96+ )"
9497};
9598
9699typedef struct
@@ -674,6 +677,60 @@ int test_cloned_kernel_exec_info(cl_device_id deviceID, cl_context context,
674677 }
675678}
676679
680+ int test_empty_enqueue_helper (cl_command_queue queue, cl_kernel srcKernel)
681+ {
682+ cl_int error;
683+ size_t ndrange1 = 1 ;
684+
685+ // enqueue - srcKernel
686+ error = clEnqueueNDRangeKernel (queue, srcKernel, 1 , NULL , &ndrange1, NULL ,
687+ 0 , NULL , NULL );
688+ test_error (error, " clEnqueueNDRangeKernel failed" );
689+
690+ error = clFinish (queue);
691+ test_error (error, " clFinish failed" );
692+
693+ return TEST_PASS;
694+ }
695+
696+ int test_cloned_kernel_empty_args (cl_device_id deviceID, cl_context context,
697+ cl_command_queue queue, int num_elements)
698+ {
699+ cl_int error;
700+ clProgramWrapper program;
701+ clKernelWrapper srcKernel;
702+
703+ // Create srcKernel to test with
704+ error = create_single_kernel_helper (context, &program, &srcKernel, 1 ,
705+ clone_kernel_test_kernel,
706+ " test_kernel_empty" );
707+ test_error (error,
708+ " Unable to create srcKernel for test_cloned_kernel_empty_args" );
709+
710+ // enqueue - srcKernel
711+ if (test_empty_enqueue_helper (queue, srcKernel) != 0 )
712+ {
713+ test_fail (" test_empty_enqueue_helper failed for srcKernel.\n " );
714+ }
715+
716+ // clone the srcKernel
717+ clKernelWrapper cloneKernel_1 = clCloneKernel (srcKernel, &error);
718+ test_error (error, " clCloneKernel failed for cloneKernel_1" );
719+
720+ if (test_empty_enqueue_helper (queue, cloneKernel_1) != 0 )
721+ {
722+ test_fail (" test_empty_enqueue_helper failed for cloneKernel_1.\n " );
723+ }
724+
725+ // enqueue - srcKernel again
726+ if (test_empty_enqueue_helper (queue, srcKernel) != 0 )
727+ {
728+ test_fail (" test_empty_enqueue_helper failed for srcKernel on retry.\n " );
729+ }
730+
731+ return TEST_PASS;
732+ }
733+
677734REGISTER_TEST_VERSION (clone_kernel, Version(2 , 1 ))
678735{
679736 if (test_buff_image_multiple_args (device, context, queue, num_elements)
@@ -694,5 +751,11 @@ REGISTER_TEST_VERSION(clone_kernel, Version(2, 1))
694751 test_fail (" clCloneKernel test_cloned_kernel_exec_info failed.\n " );
695752 }
696753
754+ if (test_cloned_kernel_empty_args (device, context, queue, num_elements)
755+ == TEST_FAIL)
756+ {
757+ test_fail (" clCloneKernel test_cloned_kernel_empty_args failed.\n " );
758+ }
759+
697760 return TEST_PASS;
698761}
0 commit comments