Skip to content

Commit cbea600

Browse files
authored
[SYCL][UR][L0 v2] Implement missing bindless images functionality (#19808)
Implement urBindlessImagesSignalExternalSemaphoreExp and urBindlessImagesWaitExternalSemaphoreExp. The implementation is the same as in the legace adapter, except that we don't to a fallback in case old loader is used (v2 is supposed to be used with a new enough L0 loader version).
1 parent 0d4249c commit cbea600

File tree

1 file changed

+57
-10
lines changed

1 file changed

+57
-10
lines changed

unified-runtime/source/adapters/level_zero/v2/command_list_manager.cpp

Lines changed: 57 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -907,19 +907,66 @@ ur_result_t ur_command_list_manager::bindlessImagesImageCopyExp(
907907
}
908908

909909
ur_result_t ur_command_list_manager::bindlessImagesWaitExternalSemaphoreExp(
910-
ur_exp_external_semaphore_handle_t /*hSemaphore*/, bool /*hasWaitValue*/,
911-
uint64_t /*waitValue*/, uint32_t /*numEventsInWaitList*/,
912-
const ur_event_handle_t * /*phEventWaitList*/,
913-
ur_event_handle_t /*phEvent*/) {
914-
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
910+
ur_exp_external_semaphore_handle_t hSemaphore, bool hasWaitValue,
911+
uint64_t waitValue, uint32_t numEventsInWaitList,
912+
const ur_event_handle_t *phEventWaitList, ur_event_handle_t phEvent) {
913+
auto hPlatform = hContext->getPlatform();
914+
if (!hPlatform->ZeExternalSemaphoreExt.Supported == false ||
915+
!hPlatform->ZeExternalSemaphoreExt.LoaderExtension) {
916+
UR_LOG_LEGACY(ERR,
917+
logger::LegacyMessage("[UR][L0] {} function not supported!"),
918+
"{} function not supported!", __FUNCTION__);
919+
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
920+
}
921+
922+
auto zeSignalEvent =
923+
getSignalEvent(phEvent, UR_COMMAND_EXTERNAL_SEMAPHORE_WAIT_EXP);
924+
auto [pWaitEvents, numWaitEvents] =
925+
getWaitListView(phEventWaitList, numEventsInWaitList);
926+
927+
ze_external_semaphore_wait_params_ext_t waitParams = {
928+
ZE_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_WAIT_PARAMS_EXT, nullptr, 0};
929+
waitParams.value = hasWaitValue ? waitValue : 0;
930+
ze_external_semaphore_ext_handle_t hExtSemaphore =
931+
reinterpret_cast<ze_external_semaphore_ext_handle_t>(hSemaphore);
932+
ZE2UR_CALL(hPlatform->ZeExternalSemaphoreExt
933+
.zexCommandListAppendWaitExternalSemaphoresExp,
934+
(zeCommandList.get(), 1, &hExtSemaphore, &waitParams,
935+
zeSignalEvent, numWaitEvents, pWaitEvents));
936+
937+
return UR_RESULT_SUCCESS;
915938
}
916939

917940
ur_result_t ur_command_list_manager::bindlessImagesSignalExternalSemaphoreExp(
918-
ur_exp_external_semaphore_handle_t /*hSemaphore*/, bool /*hasSignalValue*/,
919-
uint64_t /*signalValue*/, uint32_t /*numEventsInWaitList*/,
920-
const ur_event_handle_t * /*phEventWaitList*/,
921-
ur_event_handle_t /*phEvent*/) {
922-
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
941+
ur_exp_external_semaphore_handle_t hSemaphore, bool hasSignalValue,
942+
uint64_t signalValue, uint32_t numEventsInWaitList,
943+
const ur_event_handle_t *phEventWaitList, ur_event_handle_t phEvent) {
944+
auto hPlatform = hContext->getPlatform();
945+
if (!hPlatform->ZeExternalSemaphoreExt.Supported == false ||
946+
!hPlatform->ZeExternalSemaphoreExt.LoaderExtension) {
947+
UR_LOG_LEGACY(ERR,
948+
logger::LegacyMessage("[UR][L0] {} function not supported!"),
949+
"{} function not supported!", __FUNCTION__);
950+
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
951+
}
952+
953+
auto zeSignalEvent =
954+
getSignalEvent(phEvent, UR_COMMAND_EXTERNAL_SEMAPHORE_SIGNAL_EXP);
955+
auto [pWaitEvents, numWaitEvents] =
956+
getWaitListView(phEventWaitList, numEventsInWaitList);
957+
958+
ze_external_semaphore_signal_params_ext_t signalParams = {
959+
ZE_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_EXT, nullptr, 0};
960+
signalParams.value = hasSignalValue ? signalValue : 0;
961+
ze_external_semaphore_ext_handle_t hExtSemaphore =
962+
reinterpret_cast<ze_external_semaphore_ext_handle_t>(hSemaphore);
963+
964+
ZE2UR_CALL(hPlatform->ZeExternalSemaphoreExt
965+
.zexCommandListAppendSignalExternalSemaphoresExp,
966+
(zeCommandList.get(), 1, &hExtSemaphore, &signalParams,
967+
zeSignalEvent, numWaitEvents, pWaitEvents));
968+
969+
return UR_RESULT_SUCCESS;
923970
}
924971

925972
ur_result_t ur_command_list_manager::appendNativeCommandExp(

0 commit comments

Comments
 (0)