Skip to content

Commit b4ddb8d

Browse files
committed
Handle translating all events given Exp
Signed-off-by: Neil R. Spruit <[email protected]>
1 parent 869d5ec commit b4ddb8d

File tree

1 file changed

+18
-2
lines changed
  • unified-runtime/source/adapters/level_zero

1 file changed

+18
-2
lines changed

unified-runtime/source/adapters/level_zero/image.cpp

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -990,6 +990,14 @@ ur_result_t urBindlessImagesWaitExternalSemaphoreExp(
990990
ZE2UR_CALL(zelLoaderTranslateHandle,
991991
(ZEL_HANDLE_EVENT, ZeEvent, (void **)&translatedEvent));
992992
}
993+
std::vector<ze_event_handle_t> EventHandles(WaitList.Length + 1, nullptr);
994+
if (WaitList.Length > 0) {
995+
for (size_t i = 0; i < WaitList.Length; i++) {
996+
ze_event_handle_t ZeEvent = WaitList.ZeEventList[i];
997+
ZE2UR_CALL(zelLoaderTranslateHandle,
998+
(ZEL_HANDLE_EVENT, ZeEvent, (void **)&EventHandles[i + 1]));
999+
}
1000+
}
9931001
ze_intel_external_semaphore_wait_params_exp_t WaitParams = {
9941002
ZE_INTEL_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_WAIT_PARAMS_EXP, nullptr, 0};
9951003
WaitParams.value = hasValue ? waitValue : 0;
@@ -998,7 +1006,7 @@ ur_result_t urBindlessImagesWaitExternalSemaphoreExp(
9981006
ZE2UR_CALL(UrPlatform->ZeExternalSemaphoreExt
9991007
.zexExpCommandListAppendWaitExternalSemaphoresExp,
10001008
(translatedCommandList, 1, &hExtSemaphore, &WaitParams,
1001-
translatedEvent, WaitList.Length, WaitList.ZeEventList));
1009+
translatedEvent, WaitList.Length, EventHandles.data()));
10021010
}
10031011

10041012
return UR_RESULT_SUCCESS;
@@ -1074,10 +1082,18 @@ ur_result_t urBindlessImagesSignalExternalSemaphoreExp(
10741082
ZE2UR_CALL(zelLoaderTranslateHandle,
10751083
(ZEL_HANDLE_EVENT, ZeEvent, (void **)&translatedEvent));
10761084
}
1085+
std::vector<ze_event_handle_t> EventHandles(WaitList.Length + 1, nullptr);
1086+
if (WaitList.Length > 0) {
1087+
for (size_t i = 0; i < WaitList.Length; i++) {
1088+
ze_event_handle_t ZeEvent = WaitList.ZeEventList[i];
1089+
ZE2UR_CALL(zelLoaderTranslateHandle,
1090+
(ZEL_HANDLE_EVENT, ZeEvent, (void **)&EventHandles[i + 1]));
1091+
}
1092+
}
10771093
ZE2UR_CALL(UrPlatform->ZeExternalSemaphoreExt
10781094
.zexExpCommandListAppendSignalExternalSemaphoresExp,
10791095
(translatedCommandList, 1, &hExtSemaphore, &SignalParams,
1080-
translatedEvent, WaitList.Length, WaitList.ZeEventList));
1096+
translatedEvent, WaitList.Length, EventHandles.data()));
10811097
}
10821098

10831099
return UR_RESULT_SUCCESS;

0 commit comments

Comments
 (0)