Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix backwards compatibility usage of Get*ProcAddrTable #231

Merged
merged 1 commit into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 44 additions & 22 deletions source/lib/ze_libddi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,18 @@ namespace ze_lib

if( ZE_RESULT_SUCCESS == result )
{
// Optional
auto getTable = reinterpret_cast<ze_pfnGetRTASBuilderExpProcAddrTable_t>(
GET_FUNCTION_PTR(loader, "zeGetRTASBuilderExpProcAddrTable") );
result = getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.RTASBuilderExp );
getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.RTASBuilderExp );
}

if( ZE_RESULT_SUCCESS == result )
{
// Optional
auto getTable = reinterpret_cast<ze_pfnGetRTASParallelOperationExpProcAddrTable_t>(
GET_FUNCTION_PTR(loader, "zeGetRTASParallelOperationExpProcAddrTable") );
result = getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.RTASParallelOperationExp );
getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.RTASParallelOperationExp );
}

if( ZE_RESULT_SUCCESS == result )
Expand All @@ -51,9 +53,10 @@ namespace ze_lib

if( ZE_RESULT_SUCCESS == result )
{
// Optional
auto getTable = reinterpret_cast<ze_pfnGetDriverExpProcAddrTable_t>(
GET_FUNCTION_PTR(loader, "zeGetDriverExpProcAddrTable") );
result = getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.DriverExp );
getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.DriverExp );
}

if( ZE_RESULT_SUCCESS == result )
Expand All @@ -65,9 +68,10 @@ namespace ze_lib

if( ZE_RESULT_SUCCESS == result )
{
// Optional
auto getTable = reinterpret_cast<ze_pfnGetDeviceExpProcAddrTable_t>(
GET_FUNCTION_PTR(loader, "zeGetDeviceExpProcAddrTable") );
result = getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.DeviceExp );
getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.DeviceExp );
}

if( ZE_RESULT_SUCCESS == result )
Expand All @@ -93,9 +97,10 @@ namespace ze_lib

if( ZE_RESULT_SUCCESS == result )
{
// Optional
auto getTable = reinterpret_cast<ze_pfnGetCommandListExpProcAddrTable_t>(
GET_FUNCTION_PTR(loader, "zeGetCommandListExpProcAddrTable") );
result = getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.CommandListExp );
getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.CommandListExp );
}

if( ZE_RESULT_SUCCESS == result )
Expand All @@ -107,9 +112,10 @@ namespace ze_lib

if( ZE_RESULT_SUCCESS == result )
{
// Optional
auto getTable = reinterpret_cast<ze_pfnGetEventExpProcAddrTable_t>(
GET_FUNCTION_PTR(loader, "zeGetEventExpProcAddrTable") );
result = getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.EventExp );
getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.EventExp );
}

if( ZE_RESULT_SUCCESS == result )
Expand All @@ -135,9 +141,10 @@ namespace ze_lib

if( ZE_RESULT_SUCCESS == result )
{
// Optional
auto getTable = reinterpret_cast<ze_pfnGetImageExpProcAddrTable_t>(
GET_FUNCTION_PTR(loader, "zeGetImageExpProcAddrTable") );
result = getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.ImageExp );
getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.ImageExp );
}

if( ZE_RESULT_SUCCESS == result )
Expand All @@ -149,9 +156,10 @@ namespace ze_lib

if( ZE_RESULT_SUCCESS == result )
{
// Optional
auto getTable = reinterpret_cast<ze_pfnGetKernelExpProcAddrTable_t>(
GET_FUNCTION_PTR(loader, "zeGetKernelExpProcAddrTable") );
result = getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.KernelExp );
getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.KernelExp );
}

if( ZE_RESULT_SUCCESS == result )
Expand All @@ -163,9 +171,10 @@ namespace ze_lib

if( ZE_RESULT_SUCCESS == result )
{
// Optional
auto getTable = reinterpret_cast<ze_pfnGetMemExpProcAddrTable_t>(
GET_FUNCTION_PTR(loader, "zeGetMemExpProcAddrTable") );
result = getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.MemExp );
getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.MemExp );
}

if( ZE_RESULT_SUCCESS == result )
Expand Down Expand Up @@ -205,16 +214,18 @@ namespace ze_lib

if( ZE_RESULT_SUCCESS == result )
{
// Optional
auto getTable = reinterpret_cast<ze_pfnGetFabricEdgeExpProcAddrTable_t>(
GET_FUNCTION_PTR(loader, "zeGetFabricEdgeExpProcAddrTable") );
result = getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.FabricEdgeExp );
getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.FabricEdgeExp );
}

if( ZE_RESULT_SUCCESS == result )
{
// Optional
auto getTable = reinterpret_cast<ze_pfnGetFabricVertexExpProcAddrTable_t>(
GET_FUNCTION_PTR(loader, "zeGetFabricVertexExpProcAddrTable") );
result = getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.FabricVertexExp );
getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.FabricVertexExp );
}

return result;
Expand All @@ -231,12 +242,14 @@ namespace ze_lib

if( ZE_RESULT_SUCCESS == result )
{
result = zeGetRTASBuilderExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.RTASBuilderExp );
// Optional
zeGetRTASBuilderExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.RTASBuilderExp );
}

if( ZE_RESULT_SUCCESS == result )
{
result = zeGetRTASParallelOperationExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.RTASParallelOperationExp );
// Optional
zeGetRTASParallelOperationExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.RTASParallelOperationExp );
}

if( ZE_RESULT_SUCCESS == result )
Expand All @@ -246,7 +259,8 @@ namespace ze_lib

if( ZE_RESULT_SUCCESS == result )
{
result = zeGetDriverExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.DriverExp );
// Optional
zeGetDriverExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.DriverExp );
}

if( ZE_RESULT_SUCCESS == result )
Expand All @@ -256,7 +270,8 @@ namespace ze_lib

if( ZE_RESULT_SUCCESS == result )
{
result = zeGetDeviceExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.DeviceExp );
// Optional
zeGetDeviceExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.DeviceExp );
}

if( ZE_RESULT_SUCCESS == result )
Expand All @@ -276,7 +291,8 @@ namespace ze_lib

if( ZE_RESULT_SUCCESS == result )
{
result = zeGetCommandListExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.CommandListExp );
// Optional
zeGetCommandListExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.CommandListExp );
}

if( ZE_RESULT_SUCCESS == result )
Expand All @@ -286,7 +302,8 @@ namespace ze_lib

if( ZE_RESULT_SUCCESS == result )
{
result = zeGetEventExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.EventExp );
// Optional
zeGetEventExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.EventExp );
}

if( ZE_RESULT_SUCCESS == result )
Expand All @@ -306,7 +323,8 @@ namespace ze_lib

if( ZE_RESULT_SUCCESS == result )
{
result = zeGetImageExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.ImageExp );
// Optional
zeGetImageExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.ImageExp );
}

if( ZE_RESULT_SUCCESS == result )
Expand All @@ -316,7 +334,8 @@ namespace ze_lib

if( ZE_RESULT_SUCCESS == result )
{
result = zeGetKernelExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.KernelExp );
// Optional
zeGetKernelExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.KernelExp );
}

if( ZE_RESULT_SUCCESS == result )
Expand All @@ -326,7 +345,8 @@ namespace ze_lib

if( ZE_RESULT_SUCCESS == result )
{
result = zeGetMemExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.MemExp );
// Optional
zeGetMemExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.MemExp );
}

if( ZE_RESULT_SUCCESS == result )
Expand Down Expand Up @@ -356,12 +376,14 @@ namespace ze_lib

if( ZE_RESULT_SUCCESS == result )
{
result = zeGetFabricEdgeExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.FabricEdgeExp );
// Optional
zeGetFabricEdgeExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.FabricEdgeExp );
}

if( ZE_RESULT_SUCCESS == result )
{
result = zeGetFabricVertexExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.FabricVertexExp );
// Optional
zeGetFabricVertexExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.FabricVertexExp );
}

return result;
Expand Down
42 changes: 28 additions & 14 deletions source/lib/zes_libddi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ namespace ze_lib

if( ZE_RESULT_SUCCESS == result )
{
// Optional
auto getTable = reinterpret_cast<zes_pfnGetGlobalProcAddrTable_t>(
GET_FUNCTION_PTR(loader, "zesGetGlobalProcAddrTable") );
result = getTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Global );
getTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Global );
}

if( ZE_RESULT_SUCCESS == result )
Expand All @@ -37,9 +38,10 @@ namespace ze_lib

if( ZE_RESULT_SUCCESS == result )
{
// Optional
auto getTable = reinterpret_cast<zes_pfnGetDeviceExpProcAddrTable_t>(
GET_FUNCTION_PTR(loader, "zesGetDeviceExpProcAddrTable") );
result = getTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.DeviceExp );
getTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.DeviceExp );
}

if( ZE_RESULT_SUCCESS == result )
Expand All @@ -51,9 +53,10 @@ namespace ze_lib

if( ZE_RESULT_SUCCESS == result )
{
// Optional
auto getTable = reinterpret_cast<zes_pfnGetDriverExpProcAddrTable_t>(
GET_FUNCTION_PTR(loader, "zesGetDriverExpProcAddrTable") );
result = getTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.DriverExp );
getTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.DriverExp );
}

if( ZE_RESULT_SUCCESS == result )
Expand Down Expand Up @@ -93,9 +96,10 @@ namespace ze_lib

if( ZE_RESULT_SUCCESS == result )
{
// Optional
auto getTable = reinterpret_cast<zes_pfnGetFirmwareExpProcAddrTable_t>(
GET_FUNCTION_PTR(loader, "zesGetFirmwareExpProcAddrTable") );
result = getTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.FirmwareExp );
getTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.FirmwareExp );
}

if( ZE_RESULT_SUCCESS == result )
Expand All @@ -121,9 +125,10 @@ namespace ze_lib

if( ZE_RESULT_SUCCESS == result )
{
// Optional
auto getTable = reinterpret_cast<zes_pfnGetOverclockProcAddrTable_t>(
GET_FUNCTION_PTR(loader, "zesGetOverclockProcAddrTable") );
result = getTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Overclock );
getTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Overclock );
}

if( ZE_RESULT_SUCCESS == result )
Expand Down Expand Up @@ -156,9 +161,10 @@ namespace ze_lib

if( ZE_RESULT_SUCCESS == result )
{
// Optional
auto getTable = reinterpret_cast<zes_pfnGetRasExpProcAddrTable_t>(
GET_FUNCTION_PTR(loader, "zesGetRasExpProcAddrTable") );
result = getTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.RasExp );
getTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.RasExp );
}

if( ZE_RESULT_SUCCESS == result )
Expand All @@ -184,9 +190,10 @@ namespace ze_lib

if( ZE_RESULT_SUCCESS == result )
{
// Optional
auto getTable = reinterpret_cast<zes_pfnGetVFManagementExpProcAddrTable_t>(
GET_FUNCTION_PTR(loader, "zesGetVFManagementExpProcAddrTable") );
result = getTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.VFManagementExp );
getTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.VFManagementExp );
}

return result;
Expand All @@ -198,7 +205,8 @@ namespace ze_lib

if( ZE_RESULT_SUCCESS == result )
{
result = zesGetGlobalProcAddrTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Global );
// Optional
zesGetGlobalProcAddrTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Global );
}

if( ZE_RESULT_SUCCESS == result )
Expand All @@ -208,7 +216,8 @@ namespace ze_lib

if( ZE_RESULT_SUCCESS == result )
{
result = zesGetDeviceExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.DeviceExp );
// Optional
zesGetDeviceExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.DeviceExp );
}

if( ZE_RESULT_SUCCESS == result )
Expand All @@ -218,7 +227,8 @@ namespace ze_lib

if( ZE_RESULT_SUCCESS == result )
{
result = zesGetDriverExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.DriverExp );
// Optional
zesGetDriverExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.DriverExp );
}

if( ZE_RESULT_SUCCESS == result )
Expand Down Expand Up @@ -248,7 +258,8 @@ namespace ze_lib

if( ZE_RESULT_SUCCESS == result )
{
result = zesGetFirmwareExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.FirmwareExp );
// Optional
zesGetFirmwareExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.FirmwareExp );
}

if( ZE_RESULT_SUCCESS == result )
Expand All @@ -268,7 +279,8 @@ namespace ze_lib

if( ZE_RESULT_SUCCESS == result )
{
result = zesGetOverclockProcAddrTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Overclock );
// Optional
zesGetOverclockProcAddrTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Overclock );
}

if( ZE_RESULT_SUCCESS == result )
Expand All @@ -293,7 +305,8 @@ namespace ze_lib

if( ZE_RESULT_SUCCESS == result )
{
result = zesGetRasExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.RasExp );
// Optional
zesGetRasExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.RasExp );
}

if( ZE_RESULT_SUCCESS == result )
Expand All @@ -313,7 +326,8 @@ namespace ze_lib

if( ZE_RESULT_SUCCESS == result )
{
result = zesGetVFManagementExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.VFManagementExp );
// Optional
zesGetVFManagementExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.VFManagementExp );
}

return result;
Expand Down
Loading
Loading