Skip to content

Commit bad94a5

Browse files
committed
[L0] fix buffer map/unmap host event usecase
Signed-off-by: Neil R. Spruit <[email protected]>
1 parent 5c504a7 commit bad94a5

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

source/adapters/level_zero/memory.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -884,8 +884,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferMap(
884884
Queue, Event, UR_COMMAND_MEM_BUFFER_MAP, Queue->CommandListMap.end(),
885885
IsInternal, false));
886886

887-
UR_CALL(setSignalEvent(Queue, UseCopyEngine, &ZeEvent, Event,
888-
NumEventsInWaitList, EventWaitList));
887+
ZeEvent = (*Event)->ZeEvent;
889888
(*Event)->WaitList = TmpWaitList;
890889
}
891890

@@ -988,6 +987,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferMap(
988987
char *ZeHandleSrc;
989988
UR_CALL(Buffer->getZeHandle(ZeHandleSrc, AccessMode, Queue->Device));
990989

990+
UR_CALL(setSignalEvent(Queue, UseCopyEngine, &ZeEvent, Event,
991+
NumEventsInWaitList, EventWaitList));
992+
991993
ZE2UR_CALL(zeCommandListAppendMemoryCopy,
992994
(ZeCommandList, *RetMap, ZeHandleSrc + Offset, Size, ZeEvent,
993995
WaitList.Length, WaitList.ZeEventList));
@@ -1042,8 +1044,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemUnmap(
10421044
UR_CALL(createEventAndAssociateQueue(Queue, Event, UR_COMMAND_MEM_UNMAP,
10431045
Queue->CommandListMap.end(),
10441046
IsInternal, false));
1045-
UR_CALL(setSignalEvent(Queue, UseCopyEngine, &ZeEvent, Event,
1046-
NumEventsInWaitList, EventWaitList));
1047+
ZeEvent = (*Event)->ZeEvent;
10471048
(*Event)->WaitList = TmpWaitList;
10481049
}
10491050

@@ -1116,6 +1117,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemUnmap(
11161117
UR_CALL(Buffer->getZeHandle(ZeHandleDst, ur_mem_handle_t_::write_only,
11171118
Queue->Device));
11181119

1120+
UR_CALL(setSignalEvent(Queue, UseCopyEngine, &ZeEvent, Event,
1121+
NumEventsInWaitList, EventWaitList));
1122+
11191123
ZE2UR_CALL(zeCommandListAppendMemoryCopy,
11201124
(ZeCommandList, ZeHandleDst + MapInfo.Offset, MappedPtr,
11211125
MapInfo.Size, ZeEvent, (*Event)->WaitList.Length,

0 commit comments

Comments
 (0)