Skip to content

Commit

Permalink
[NativeCPU] Handle null phEvent.
Browse files Browse the repository at this point in the history
The documentation for urEnqueueKernelLaunch marks phEvent as optional,
so make sure we only set it if provided.
  • Loading branch information
hvdijk committed Feb 3, 2025
1 parent e2df8ac commit 04882ba
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions source/adapters/native_cpu/enqueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,15 +244,17 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueKernelLaunch(
#endif // NATIVECPU_USE_OCK
event->set_futures(futures);

*phEvent = event;
if (phEvent) {
*phEvent = event;
}
event->set_callback([hKernel, event]() {
event->tick_end();
// TODO: avoid calling clear() here.
hKernel->_localArgInfo.clear();
});

if (hQueue->isInOrder()) {
urEventWait(1, phEvent);
urEventWait(1, &event);
}

return UR_RESULT_SUCCESS;
Expand Down

0 comments on commit 04882ba

Please sign in to comment.