Skip to content

Commit 633e159

Browse files
uwedolinskybb-ur
authored andcommitted
added event handling to urEnqueueUSMPrefetch (#19887)
Adds missing event handling to `urEnqueueUSMPrefetch` in the Native CPU adapter. This aims to fix random fails in `SYCL/USM/dep_events.cpp`. Also removes unneeded call to `urEventWait`.
1 parent b13f8e1 commit 633e159

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

source/adapters/native_cpu/enqueue.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferCopy(
431431
ur_mem_handle_t hBufferDst, size_t srcOffset, size_t dstOffset, size_t size,
432432
uint32_t numEventsInWaitList, const ur_event_handle_t *phEventWaitList,
433433
ur_event_handle_t *phEvent) {
434-
urEventWait(numEventsInWaitList, phEventWaitList);
435434
const void *SrcPtr = hBufferSrc->_mem + srcOffset;
436435
void *DstPtr = hBufferDst->_mem + dstOffset;
437436
return doCopy_impl(hQueue, DstPtr, SrcPtr, size, numEventsInWaitList,
@@ -601,13 +600,14 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMMemcpy(
601600
}
602601

603602
UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMPrefetch(
604-
ur_queue_handle_t /*hQueue*/, const void * /*pMem*/, size_t /*size*/,
605-
ur_usm_migration_flags_t /*flags*/, uint32_t /*numEventsInWaitList*/,
606-
const ur_event_handle_t * /*phEventWaitList*/,
607-
ur_event_handle_t * /*phEvent*/) {
603+
ur_queue_handle_t hQueue, const void * /*pMem*/, size_t /*size*/,
604+
ur_usm_migration_flags_t /*flags*/, uint32_t numEventsInWaitList,
605+
const ur_event_handle_t *phEventWaitList, ur_event_handle_t *phEvent) {
608606

609607
// TODO: properly implement USM prefetch
610-
return UR_RESULT_SUCCESS;
608+
return withTimingEvent(UR_COMMAND_USM_PREFETCH, hQueue, numEventsInWaitList,
609+
phEventWaitList, phEvent,
610+
[]() { return UR_RESULT_SUCCESS; });
611611
}
612612

613613
UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMAdvise(

0 commit comments

Comments
 (0)