@@ -69,7 +69,7 @@ TEST_F(TestQueueSubmit, CheckSubmitRange_saxpy)
6969 DPCTLSyclDeviceSelectorRef DSRef = nullptr ;
7070 DPCTLSyclDeviceRef DRef = nullptr ;
7171
72- EXPECT_NO_FATAL_FAILURE (DSRef = DPCTLDefaultSelector_Create ( ));
72+ EXPECT_NO_FATAL_FAILURE (DSRef = DPCTLFilterSelector_Create ( " opencl:cpu:0 " ));
7373 EXPECT_NO_FATAL_FAILURE (DRef = DPCTLDevice_CreateFromSelector (DSRef));
7474 DPCTLDeviceMgr_PrintDeviceInfo (DRef);
7575 ASSERT_TRUE (DRef);
@@ -123,3 +123,61 @@ TEST_F(TestQueueSubmit, CheckSubmitRange_saxpy)
123123 DPCTLDevice_Delete (DRef);
124124 DPCTLDeviceSelector_Delete (DSRef);
125125}
126+
127+ TEST_F (TestQueueSubmit, CheckEvent_Copy)
128+ {
129+ DPCTLSyclDeviceSelectorRef DSRef = nullptr ;
130+ DPCTLSyclDeviceRef DRef = nullptr ;
131+
132+ DSRef = DPCTLFilterSelector_Create (" opencl:cpu:0" );
133+ DRef = DPCTLDevice_CreateFromSelector (DSRef);
134+ auto QRef =
135+ DPCTLQueue_CreateForDevice (DRef, nullptr , DPCTL_DEFAULT_PROPERTY);
136+ auto CRef = DPCTLQueue_GetContext (QRef);
137+ auto PRef = DPCTLProgram_CreateFromSpirv (CRef, spirvBuffer.data (),
138+ spirvFileSize, nullptr );
139+
140+ auto AxpyKernel = DPCTLProgram_GetKernel (PRef, " axpy" );
141+
142+ // Create the input args
143+ auto a = DPCTLmalloc_shared (SIZE * sizeof (float ), QRef);
144+ auto b = DPCTLmalloc_shared (SIZE * sizeof (float ), QRef);
145+ auto c = DPCTLmalloc_shared (SIZE * sizeof (float ), QRef);
146+
147+ auto a_ptr = reinterpret_cast <float *>(unwrap (a));
148+ auto b_ptr = reinterpret_cast <float *>(unwrap (b));
149+ // Initialize a,b
150+ for (auto i = 0ul ; i < SIZE; ++i) {
151+ a_ptr[i] = i + 1.0 ;
152+ b_ptr[i] = i + 2.0 ;
153+ }
154+
155+ // Create kernel args for axpy
156+ float d = 10.0 ;
157+ size_t Range[] = {SIZE};
158+ void *args2[4 ] = {unwrap (a), unwrap (b), unwrap (c), (void *)&d};
159+ DPCTLKernelArgType addKernelArgTypes[] = {DPCTL_VOID_PTR, DPCTL_VOID_PTR,
160+ DPCTL_VOID_PTR, DPCTL_FLOAT};
161+ auto ERef = DPCTLQueue_SubmitRange (
162+ AxpyKernel, QRef, args2, addKernelArgTypes, 4 , Range, 1 , nullptr , 0 );
163+
164+ // Event test
165+ ASSERT_TRUE (ERef != nullptr );
166+ DPCTLSyclEventRef Copied_ERef = nullptr ;
167+ EXPECT_NO_FATAL_FAILURE (Copied_ERef = DPCTLEvent_Copy (ERef));
168+ EXPECT_TRUE (bool (Copied_ERef));
169+ EXPECT_NO_FATAL_FAILURE (DPCTLEvent_Delete (Copied_ERef));
170+ DPCTLQueue_Wait (QRef);
171+
172+ // clean ups
173+ DPCTLEvent_Delete (ERef);
174+ DPCTLKernel_Delete (AxpyKernel);
175+ DPCTLfree_with_queue ((DPCTLSyclUSMRef)a, QRef);
176+ DPCTLfree_with_queue ((DPCTLSyclUSMRef)b, QRef);
177+ DPCTLfree_with_queue ((DPCTLSyclUSMRef)c, QRef);
178+ DPCTLQueue_Delete (QRef);
179+ DPCTLContext_Delete (CRef);
180+ DPCTLProgram_Delete (PRef);
181+ DPCTLDevice_Delete (DRef);
182+ DPCTLDeviceSelector_Delete (DSRef);
183+ }
0 commit comments