Skip to content

Commit

Permalink
create compat header for 1.10 abi breakage
Browse files Browse the repository at this point in the history
Signed-off-by: Neil R. Spruit <[email protected]>
  • Loading branch information
nrspruit committed Sep 13, 2024
1 parent e8975fe commit b9b7660
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 15 deletions.
1 change: 1 addition & 0 deletions source/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ target_sources(${TARGET_LOADER_NAME}
${CMAKE_CURRENT_SOURCE_DIR}/ze_lib.h
${CMAKE_CURRENT_SOURCE_DIR}/ze_lib.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ze_tracing_register_cb_libapi.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ze_loader_compat.h
)


Expand Down
9 changes: 5 additions & 4 deletions source/lib/ze_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <vector>
#include <mutex>
#include <atomic>
#include "ze_loader_compat.h"

namespace ze_lib
{
Expand All @@ -44,17 +45,17 @@ namespace ze_lib
std::atomic<ze_dditable_t *> zeDdiTable = {nullptr};

ze_result_t zetDdiTableInit();
std::atomic<zet_dditable_t *> zetDdiTable = {nullptr};
std::atomic<zet_dditable_compat_t *> zetDdiTable = {nullptr};

ze_result_t zesDdiTableInit();
std::atomic<zes_dditable_t *> zesDdiTable = {nullptr};
std::atomic<zes_dditable_compat_t *> zesDdiTable = {nullptr};

ze_result_t zelTracingDdiTableInit();
zel_tracing_dditable_t zelTracingDdiTable = {};
std::atomic<ze_dditable_t *> pTracingZeDdiTable = {nullptr};
ze_dditable_t initialzeDdiTable;
zet_dditable_t initialzetDdiTable;
zes_dditable_t initialzesDdiTable;
zet_dditable_compat_t initialzetDdiTable;
zes_dditable_compat_t initialzesDdiTable;
std::atomic_uint32_t tracingLayerEnableCounter{0};

HMODULE tracing_lib = nullptr;
Expand Down
4 changes: 2 additions & 2 deletions source/lib/zes_libddi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ namespace ze_lib

if( ZE_RESULT_SUCCESS == result )
{
result = zesGetDeviceExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.DeviceExp );
result = zesGetDeviceExpProcAddrTable( ZE_API_VERSION_CURRENT, reinterpret_cast<zes_device_exp_dditable_t *>(&initialzesDdiTable.DeviceExp) );
}

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

if( ZE_RESULT_SUCCESS == result )
{
result = zesGetVFManagementExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.VFManagementExp );
result = zesGetVFManagementExpProcAddrTable( ZE_API_VERSION_CURRENT, reinterpret_cast<zes_vf_management_exp_dditable_t *>(&initialzesDdiTable.VFManagementExp) );
}

return result;
Expand Down
2 changes: 1 addition & 1 deletion source/lib/zet_libddi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ namespace ze_lib

if( ZE_RESULT_SUCCESS == result )
{
result = zetGetMetricGroupExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzetDdiTable.MetricGroupExp );
result = zetGetMetricGroupExpProcAddrTable( ZE_API_VERSION_CURRENT, reinterpret_cast< zet_metric_group_exp_dditable_t *>(&initialzetDdiTable.MetricGroupExp) );
}

if( ZE_RESULT_SUCCESS == result )
Expand Down
5 changes: 3 additions & 2 deletions source/loader/ze_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@
*/
#pragma once
#include "ze_singleton.h"
#include "../lib/ze_loader_compat.h"

//////////////////////////////////////////////////////////////////////////
struct dditable_t
{
ze_dditable_t ze;
zet_dditable_t zet;
zes_dditable_t zes;
zet_dditable_compat_t zet;
zes_dditable_compat_t zes;
};

//////////////////////////////////////////////////////////////////////////
Expand Down
8 changes: 4 additions & 4 deletions source/loader/zes_ldrddi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4570,7 +4570,7 @@ zesGetDeviceExpProcAddrTable(
GET_FUNCTION_PTR( drv.handle, "zesGetDeviceExpProcAddrTable") );
if(!getTable)
continue;
result = getTable( version, &drv.dditable.zes.DeviceExp);
result = getTable( version, reinterpret_cast<zes_device_exp_dditable_t*>(&drv.dditable.zes.DeviceExp));
}


Expand All @@ -4585,7 +4585,7 @@ zesGetDeviceExpProcAddrTable(
else
{
// return pointers directly to driver's DDIs
*pDdiTable = loader::context->sysmanInstanceDrivers->front().dditable.zes.DeviceExp;
pDdiTable = reinterpret_cast<zes_device_exp_dditable_t*>(&loader::context->sysmanInstanceDrivers->front().dditable.zes.DeviceExp);
}
}

Expand Down Expand Up @@ -6214,7 +6214,7 @@ zesGetVFManagementExpProcAddrTable(
GET_FUNCTION_PTR( drv.handle, "zesGetVFManagementExpProcAddrTable") );
if(!getTable)
continue;
result = getTable( version, &drv.dditable.zes.VFManagementExp);
result = getTable( version, reinterpret_cast<zes_vf_management_exp_dditable_t*>(&drv.dditable.zes.VFManagementExp));
}


Expand All @@ -6230,7 +6230,7 @@ zesGetVFManagementExpProcAddrTable(
else
{
// return pointers directly to driver's DDIs
*pDdiTable = loader::context->sysmanInstanceDrivers->front().dditable.zes.VFManagementExp;
pDdiTable = reinterpret_cast<zes_vf_management_exp_dditable_t*>(&loader::context->sysmanInstanceDrivers->front().dditable.zes.VFManagementExp);
}
}

Expand Down
4 changes: 2 additions & 2 deletions source/loader/zet_ldrddi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3206,7 +3206,7 @@ zetGetMetricGroupExpProcAddrTable(
GET_FUNCTION_PTR( drv.handle, "zetGetMetricGroupExpProcAddrTable") );
if(!getTable)
continue;
result = getTable( version, &drv.dditable.zet.MetricGroupExp);
result = getTable( version, reinterpret_cast<zet_metric_group_exp_dditable_t*>(&drv.dditable.zet.MetricGroupExp));
}


Expand All @@ -3227,7 +3227,7 @@ zetGetMetricGroupExpProcAddrTable(
else
{
// return pointers directly to driver's DDIs
*pDdiTable = loader::context->zeDrivers.front().dditable.zet.MetricGroupExp;
pDdiTable = reinterpret_cast<zet_metric_group_exp_dditable_t*>(&loader::context->zeDrivers.front().dditable.zet.MetricGroupExp);
}
}

Expand Down

0 comments on commit b9b7660

Please sign in to comment.