@@ -92,6 +92,7 @@ const char* clone_kernel_test_kernel[] = {
9292 " {\n "
9393 " buffer->store[0] = iarg;\n "
9494 " }\n "
95+ " __kernel void test_kernel_empty(){}\n "
9596};
9697
9798typedef struct
@@ -681,6 +682,60 @@ int test_cloned_kernel_exec_info(cl_device_id deviceID, cl_context context,
681682 return TEST_PASS;
682683}
683684
685+ int test_empty_enqueue_helper (cl_command_queue queue, cl_kernel* srcKernel)
686+ {
687+ cl_int error;
688+ size_t ndrange1 = 1 ;
689+
690+ // enqueue - srcKernel
691+ error = clEnqueueNDRangeKernel (queue, *srcKernel, 1 , NULL , &ndrange1, NULL ,
692+ 0 , NULL , NULL );
693+ test_error (error, " clEnqueueNDRangeKernel failed" );
694+
695+ error = clFinish (queue);
696+ test_error (error, " clFinish failed" );
697+
698+ return TEST_PASS;
699+ }
700+
701+ int test_cloned_kernel_empty_args (cl_device_id deviceID, cl_context context,
702+ cl_command_queue queue, int num_elements)
703+ {
704+ cl_int error;
705+ clProgramWrapper program;
706+ clKernelWrapper srcKernel;
707+
708+ // Create srcKernel to test with
709+ error = create_single_kernel_helper (context, &program, &srcKernel, 1 ,
710+ clone_kernel_test_kernel,
711+ " test_kernel_empty" );
712+ test_error (error,
713+ " Unable to create srcKernel for test_cloned_kernel_empty_args" );
714+
715+ // enqueue - srcKernel
716+ if (test_empty_enqueue_helper (queue, &srcKernel) != 0 )
717+ {
718+ test_fail (" test_empty_enqueue_helper failed for srcKernel.\n " );
719+ }
720+
721+ // clone the srcKernel
722+ clKernelWrapper cloneKernel_1 = clCloneKernel (srcKernel, &error);
723+ test_error (error, " clCloneKernel failed for cloneKernel_1" );
724+
725+ if (test_empty_enqueue_helper (queue, &cloneKernel_1) != TEST_PASS)
726+ {
727+ test_fail (" test_empty_enqueue_helper failed for cloneKernel_1.\n " );
728+ }
729+
730+ // enqueue - srcKernel again
731+ if (test_empty_enqueue_helper (queue, &srcKernel) != TEST_PASS)
732+ {
733+ test_fail (" test_empty_enqueue_helper failed for srcKernel on retry.\n " );
734+ }
735+
736+ return TEST_PASS;
737+ }
738+
684739REGISTER_TEST_VERSION (clone_kernel, Version(2 , 1 ))
685740{
686741 if (test_buff_image_multiple_args (device, context, queue, num_elements)
@@ -701,5 +756,11 @@ REGISTER_TEST_VERSION(clone_kernel, Version(2, 1))
701756 test_fail (" clCloneKernel test_cloned_kernel_exec_info failed.\n " );
702757 }
703758
759+ if (test_cloned_kernel_empty_args (device, context, queue, num_elements)
760+ != TEST_PASS)
761+ {
762+ test_fail (" clCloneKernel test_cloned_kernel_empty_args failed.\n " );
763+ }
764+
704765 return TEST_PASS;
705766}
0 commit comments