@@ -1016,16 +1016,6 @@ bool verifyCommonImagePropertiesSupport(
10161016 }
10171017 }
10181018
1019- // Verify unnormalized channel type support.
1020- // LevelZero currently doesn't support unnormalized channel types.
1021- switch (pImageFormat->channelType ) {
1022- default :
1023- break ;
1024- case UR_IMAGE_CHANNEL_TYPE_UNORM_INT8:
1025- case UR_IMAGE_CHANNEL_TYPE_UNORM_INT16:
1026- return false ;
1027- }
1028-
10291019 return supported;
10301020}
10311021
@@ -1358,126 +1348,60 @@ ur_result_t urBindlessImagesImportExternalSemaphoreExp(
13581348 " {} function not supported!" , __FUNCTION__);
13591349 return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
13601350 }
1361- if (UrPlatform->ZeExternalSemaphoreExt .LoaderExtension ) {
1362- ze_external_semaphore_ext_desc_t SemDesc = {
1363- ZE_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_EXT_DESC, nullptr ,
1364- ZE_EXTERNAL_SEMAPHORE_EXT_FLAG_OPAQUE_FD};
1365- ze_external_semaphore_ext_handle_t ExtSemaphoreHandle;
1366- ze_external_semaphore_fd_ext_desc_t FDExpDesc = {
1367- ZE_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_FD_EXT_DESC, nullptr , 0 };
1368- ze_external_semaphore_win32_ext_desc_t Win32ExpDesc = {
1369- ZE_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_WIN32_EXT_DESC, nullptr , nullptr ,
1370- nullptr };
1371- void *pNext = const_cast <void *>(pExternalSemaphoreDesc->pNext );
1372- while (pNext != nullptr ) {
1373- const ur_base_desc_t *BaseDesc =
1374- static_cast <const ur_base_desc_t *>(pNext);
1375- if (BaseDesc->stype == UR_STRUCTURE_TYPE_EXP_FILE_DESCRIPTOR) {
1376- auto FileDescriptor =
1377- static_cast <const ur_exp_file_descriptor_t *>(pNext);
1378- FDExpDesc.fd = FileDescriptor->fd ;
1379- SemDesc.pNext = &FDExpDesc;
1380- switch (semHandleType) {
1381- case UR_EXP_EXTERNAL_SEMAPHORE_TYPE_OPAQUE_FD:
1382- SemDesc.flags = ZE_EXTERNAL_SEMAPHORE_EXT_FLAG_OPAQUE_FD;
1383- break ;
1384- case UR_EXP_EXTERNAL_SEMAPHORE_TYPE_TIMELINE_FD:
1385- SemDesc.flags =
1386- ZE_EXTERNAL_SEMAPHORE_EXT_FLAG_VK_TIMELINE_SEMAPHORE_FD;
1387- break ;
1388- default :
1389- return UR_RESULT_ERROR_INVALID_VALUE;
1390- }
1391- } else if (BaseDesc->stype == UR_STRUCTURE_TYPE_EXP_WIN32_HANDLE) {
1392- SemDesc.pNext = &Win32ExpDesc;
1393- auto Win32Handle = static_cast <const ur_exp_win32_handle_t *>(pNext);
1394- switch (semHandleType) {
1395- case UR_EXP_EXTERNAL_SEMAPHORE_TYPE_WIN32_NT:
1396- SemDesc.flags = ZE_EXTERNAL_SEMAPHORE_EXT_FLAG_OPAQUE_WIN32;
1397- break ;
1398- case UR_EXP_EXTERNAL_SEMAPHORE_TYPE_WIN32_NT_DX12_FENCE:
1399- SemDesc.flags = ZE_EXTERNAL_SEMAPHORE_EXT_FLAG_D3D12_FENCE;
1400- break ;
1401- case UR_EXP_EXTERNAL_SEMAPHORE_TYPE_TIMELINE_WIN32_NT:
1402- SemDesc.flags =
1403- ZE_EXTERNAL_SEMAPHORE_EXT_FLAG_VK_TIMELINE_SEMAPHORE_WIN32;
1404- break ;
1405- default :
1406- return UR_RESULT_ERROR_INVALID_VALUE;
1407- }
1408- Win32ExpDesc.handle = Win32Handle->handle ;
1351+ ze_external_semaphore_ext_desc_t SemDesc = {
1352+ ZE_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_EXT_DESC, nullptr ,
1353+ ZE_EXTERNAL_SEMAPHORE_EXT_FLAG_OPAQUE_FD};
1354+ ze_external_semaphore_ext_handle_t ExtSemaphoreHandle;
1355+ ze_external_semaphore_fd_ext_desc_t FDExpDesc = {
1356+ ZE_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_FD_EXT_DESC, nullptr , 0 };
1357+ ze_external_semaphore_win32_ext_desc_t Win32ExpDesc = {
1358+ ZE_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_WIN32_EXT_DESC, nullptr , nullptr ,
1359+ nullptr };
1360+ void *pNext = const_cast <void *>(pExternalSemaphoreDesc->pNext );
1361+ while (pNext != nullptr ) {
1362+ const ur_base_desc_t *BaseDesc = static_cast <const ur_base_desc_t *>(pNext);
1363+ if (BaseDesc->stype == UR_STRUCTURE_TYPE_EXP_FILE_DESCRIPTOR) {
1364+ auto FileDescriptor =
1365+ static_cast <const ur_exp_file_descriptor_t *>(pNext);
1366+ FDExpDesc.fd = FileDescriptor->fd ;
1367+ SemDesc.pNext = &FDExpDesc;
1368+ switch (semHandleType) {
1369+ case UR_EXP_EXTERNAL_SEMAPHORE_TYPE_OPAQUE_FD:
1370+ SemDesc.flags = ZE_EXTERNAL_SEMAPHORE_EXT_FLAG_OPAQUE_FD;
1371+ break ;
1372+ case UR_EXP_EXTERNAL_SEMAPHORE_TYPE_TIMELINE_FD:
1373+ SemDesc.flags = ZE_EXTERNAL_SEMAPHORE_EXT_FLAG_VK_TIMELINE_SEMAPHORE_FD;
1374+ break ;
1375+ default :
1376+ return UR_RESULT_ERROR_INVALID_VALUE;
14091377 }
1410- pNext = const_cast <void *>(BaseDesc->pNext );
1411- }
1412- ZE2UR_CALL (UrPlatform->ZeExternalSemaphoreExt .zexImportExternalSemaphoreExp ,
1413- (hDevice->ZeDevice , &SemDesc, &ExtSemaphoreHandle));
1414- *phExternalSemaphoreHandle =
1415- (ur_exp_external_semaphore_handle_t )ExtSemaphoreHandle;
1416-
1417- } else {
1418- ze_intel_external_semaphore_exp_desc_t SemDesc = {
1419- ZE_INTEL_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_EXP_DESC, nullptr ,
1420- ZE_EXTERNAL_SEMAPHORE_EXP_FLAGS_OPAQUE_FD};
1421- ze_intel_external_semaphore_exp_handle_t ExtSemaphoreHandle;
1422- ze_intel_external_semaphore_desc_fd_exp_desc_t FDExpDesc = {
1423- ZE_INTEL_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_FD_EXP_DESC, nullptr , 0 };
1424- _ze_intel_external_semaphore_win32_exp_desc_t Win32ExpDesc = {
1425- ZE_INTEL_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_WIN32_EXP_DESC, nullptr ,
1426- nullptr , nullptr };
1427- void *pNext = const_cast <void *>(pExternalSemaphoreDesc->pNext );
1428- while (pNext != nullptr ) {
1429- const ur_base_desc_t *BaseDesc =
1430- static_cast <const ur_base_desc_t *>(pNext);
1431- if (BaseDesc->stype == UR_STRUCTURE_TYPE_EXP_FILE_DESCRIPTOR) {
1432- auto FileDescriptor =
1433- static_cast <const ur_exp_file_descriptor_t *>(pNext);
1434- FDExpDesc.fd = FileDescriptor->fd ;
1435- SemDesc.pNext = &FDExpDesc;
1436- switch (semHandleType) {
1437- case UR_EXP_EXTERNAL_SEMAPHORE_TYPE_OPAQUE_FD:
1438- SemDesc.flags = ZE_EXTERNAL_SEMAPHORE_EXP_FLAGS_OPAQUE_FD;
1439- break ;
1440- case UR_EXP_EXTERNAL_SEMAPHORE_TYPE_TIMELINE_FD:
1441- SemDesc.flags = ZE_EXTERNAL_SEMAPHORE_EXP_FLAGS_TIMELINE_SEMAPHORE_FD;
1442- break ;
1443- default :
1444- return UR_RESULT_ERROR_INVALID_VALUE;
1445- }
1446- } else if (BaseDesc->stype == UR_STRUCTURE_TYPE_EXP_WIN32_HANDLE) {
1447- SemDesc.pNext = &Win32ExpDesc;
1448- auto Win32Handle = static_cast <const ur_exp_win32_handle_t *>(pNext);
1449- switch (semHandleType) {
1450- case UR_EXP_EXTERNAL_SEMAPHORE_TYPE_WIN32_NT:
1451- SemDesc.flags = ZE_EXTERNAL_SEMAPHORE_EXP_FLAGS_OPAQUE_WIN32;
1452- break ;
1453- case UR_EXP_EXTERNAL_SEMAPHORE_TYPE_WIN32_NT_DX12_FENCE:
1454- SemDesc.flags = ZE_EXTERNAL_SEMAPHORE_EXP_FLAGS_D3D12_FENCE;
1455- break ;
1456- case UR_EXP_EXTERNAL_SEMAPHORE_TYPE_TIMELINE_WIN32_NT:
1457- SemDesc.flags =
1458- ZE_EXTERNAL_SEMAPHORE_EXP_FLAGS_TIMELINE_SEMAPHORE_WIN32;
1459- break ;
1460- default :
1461- return UR_RESULT_ERROR_INVALID_VALUE;
1462- }
1463- Win32ExpDesc.handle = Win32Handle->handle ;
1378+ } else if (BaseDesc->stype == UR_STRUCTURE_TYPE_EXP_WIN32_HANDLE) {
1379+ SemDesc.pNext = &Win32ExpDesc;
1380+ auto Win32Handle = static_cast <const ur_exp_win32_handle_t *>(pNext);
1381+ switch (semHandleType) {
1382+ case UR_EXP_EXTERNAL_SEMAPHORE_TYPE_WIN32_NT:
1383+ SemDesc.flags = ZE_EXTERNAL_SEMAPHORE_EXT_FLAG_OPAQUE_WIN32;
1384+ break ;
1385+ case UR_EXP_EXTERNAL_SEMAPHORE_TYPE_WIN32_NT_DX12_FENCE:
1386+ SemDesc.flags = ZE_EXTERNAL_SEMAPHORE_EXT_FLAG_D3D12_FENCE;
1387+ break ;
1388+ case UR_EXP_EXTERNAL_SEMAPHORE_TYPE_TIMELINE_WIN32_NT:
1389+ SemDesc.flags =
1390+ ZE_EXTERNAL_SEMAPHORE_EXT_FLAG_VK_TIMELINE_SEMAPHORE_WIN32;
1391+ break ;
1392+ default :
1393+ return UR_RESULT_ERROR_INVALID_VALUE;
14641394 }
1465- pNext = const_cast < void *>(BaseDesc-> pNext ) ;
1395+ Win32ExpDesc. handle = Win32Handle-> handle ;
14661396 }
1467-
1468- ze_device_handle_t translatedDevice;
1469- ZE2UR_CALL (zelLoaderTranslateHandle, (ZEL_HANDLE_DEVICE, hDevice->ZeDevice ,
1470- (void **)&translatedDevice));
1471- // If the L0 loader is not aware of the extension, the handles need to be
1472- // translated
1473- ZE2UR_CALL (
1474- UrPlatform->ZeExternalSemaphoreExt .zexExpImportExternalSemaphoreExp ,
1475- (translatedDevice, &SemDesc, &ExtSemaphoreHandle));
1476-
1477- *phExternalSemaphoreHandle =
1478- (ur_exp_external_semaphore_handle_t )ExtSemaphoreHandle;
1397+ pNext = const_cast <void *>(BaseDesc->pNext );
14791398 }
14801399
1400+ ZE2UR_CALL (UrPlatform->ZeExternalSemaphoreExt .zexImportExternalSemaphoreExp ,
1401+ (hDevice->ZeDevice , &SemDesc, &ExtSemaphoreHandle));
1402+ *phExternalSemaphoreHandle =
1403+ (ur_exp_external_semaphore_handle_t )ExtSemaphoreHandle;
1404+
14811405 return UR_RESULT_SUCCESS;
14821406}
14831407
@@ -1490,15 +1414,9 @@ ur_result_t urBindlessImagesReleaseExternalSemaphoreExp(
14901414 " {} function not supported!" , __FUNCTION__);
14911415 return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
14921416 }
1493- if (UrPlatform->ZeExternalSemaphoreExt .LoaderExtension ) {
1494- ZE2UR_CALL (
1495- UrPlatform->ZeExternalSemaphoreExt .zexDeviceReleaseExternalSemaphoreExp ,
1496- ((ze_external_semaphore_ext_handle_t )hExternalSemaphore));
1497- } else {
1498- ZE2UR_CALL (UrPlatform->ZeExternalSemaphoreExt
1499- .zexExpDeviceReleaseExternalSemaphoreExp ,
1500- ((ze_intel_external_semaphore_exp_handle_t )hExternalSemaphore));
1501- }
1417+ ZE2UR_CALL (
1418+ UrPlatform->ZeExternalSemaphoreExt .zexDeviceReleaseExternalSemaphoreExp ,
1419+ ((ze_external_semaphore_ext_handle_t )hExternalSemaphore));
15021420
15031421 return UR_RESULT_SUCCESS;
15041422}
0 commit comments