Skip to content

Commit 04882ba

Browse files
committed
[NativeCPU] Handle null phEvent.
The documentation for urEnqueueKernelLaunch marks phEvent as optional, so make sure we only set it if provided.
1 parent e2df8ac commit 04882ba

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

source/adapters/native_cpu/enqueue.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -244,15 +244,17 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueKernelLaunch(
244244
#endif // NATIVECPU_USE_OCK
245245
event->set_futures(futures);
246246

247-
*phEvent = event;
247+
if (phEvent) {
248+
*phEvent = event;
249+
}
248250
event->set_callback([hKernel, event]() {
249251
event->tick_end();
250252
// TODO: avoid calling clear() here.
251253
hKernel->_localArgInfo.clear();
252254
});
253255

254256
if (hQueue->isInOrder()) {
255-
urEventWait(1, phEvent);
257+
urEventWait(1, &event);
256258
}
257259

258260
return UR_RESULT_SUCCESS;

0 commit comments

Comments
 (0)