Skip to content

Commit

Permalink
Add Stub Sysman APIs for Level zero specification 1.5
Browse files Browse the repository at this point in the history
Related-To: LOCI-3841

Signed-off-by: Kulkarni, Ashwin Kumar <[email protected]>
  • Loading branch information
AshwinKumarKulkarni authored and Compute-Runtime-Automation committed Feb 7, 2023
1 parent c6ae892 commit bf481e6
Show file tree
Hide file tree
Showing 2 changed files with 386 additions and 2 deletions.
69 changes: 68 additions & 1 deletion level_zero/api/sysman/ze_sysman_loader.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2022 Intel Corporation
* Copyright (C) 2020-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
Expand Down Expand Up @@ -68,6 +68,37 @@ zesGetDeviceProcAddrTable(
pDdiTable->pfnEccConfigurable = L0::zesDeviceEccConfigurable;
pDdiTable->pfnGetEccState = L0::zesDeviceGetEccState;
pDdiTable->pfnSetEccState = L0::zesDeviceSetEccState;
pDdiTable->pfnGet = L0::zesDeviceGet;
pDdiTable->pfnSetOverclockWaiver = L0::zesDeviceSetOverclockWaiver;
pDdiTable->pfnGetOverclockDomains = L0::zesDeviceGetOverclockDomains;
pDdiTable->pfnGetOverclockControls = L0::zesDeviceGetOverclockControls;
pDdiTable->pfnResetOverclockSettings = L0::zesDeviceResetOverclockSettings;
pDdiTable->pfnReadOverclockState = L0::zesDeviceReadOverclockState;
pDdiTable->pfnEnumOverclockDomains = L0::zesDeviceEnumOverclockDomains;

return result;
}

ZE_DLLEXPORT ze_result_t ZE_APICALL
zesGetGlobalProcAddrTable(
ze_api_version_t version,
zes_global_dditable_t *pDdiTable) {
if (nullptr == pDdiTable)
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
if (ZE_MAJOR_VERSION(driver_ddiTable.version) != ZE_MAJOR_VERSION(version) ||
ZE_MINOR_VERSION(driver_ddiTable.version) > ZE_MINOR_VERSION(version))
return ZE_RESULT_ERROR_UNSUPPORTED_VERSION;
ze_result_t result = ZE_RESULT_SUCCESS;

NEO::EnvironmentVariableReader envReader;
bool isSysManEnabled =
envReader.getSetting("ZES_ENABLE_SYSMAN", false);
if (false == isSysManEnabled) {
*pDdiTable = {};
return result;
}
pDdiTable->pfnInit = L0::zesInit;

return result;
}

Expand All @@ -92,6 +123,8 @@ zesGetDriverProcAddrTable(

pDdiTable->pfnEventListen = L0::zesDriverEventListen;
pDdiTable->pfnEventListenEx = L0::zesDriverEventListenEx;
pDdiTable->pfnGet = L0::zesDriverGet;

return result;
}

Expand Down Expand Up @@ -172,6 +205,7 @@ zesGetFabricPortProcAddrTable(
pDdiTable->pfnSetConfig = L0::zesFabricPortSetConfig;
pDdiTable->pfnGetState = L0::zesFabricPortGetState;
pDdiTable->pfnGetThroughput = L0::zesFabricPortGetThroughput;
pDdiTable->pfnGetFabricErrorCounters = L0::zesFabricPortGetFabricErrorCounters;

return result;
}
Expand Down Expand Up @@ -516,3 +550,36 @@ zesGetTemperatureProcAddrTable(

return result;
}

ZE_DLLEXPORT ze_result_t ZE_APICALL
zesGetOverclockProcAddrTable(
ze_api_version_t version, ///< [in] API version requested
zes_overclock_dditable_t *pDdiTable ///< [in,out] pointer to table of DDI function pointers
) {
if (nullptr == pDdiTable)
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
if (ZE_MAJOR_VERSION(driver_ddiTable.version) != ZE_MAJOR_VERSION(version) ||
ZE_MINOR_VERSION(driver_ddiTable.version) > ZE_MINOR_VERSION(version))
return ZE_RESULT_ERROR_UNSUPPORTED_VERSION;
ze_result_t result = ZE_RESULT_SUCCESS;

NEO::EnvironmentVariableReader envReader;
bool isSysManEnabled =
envReader.getSetting("ZES_ENABLE_SYSMAN", false);
if (false == isSysManEnabled) {
*pDdiTable = {};
return result;
}

pDdiTable->pfnGetDomainProperties = L0::zesOverclockGetDomainProperties;
pDdiTable->pfnGetDomainVFProperties = L0::zesOverclockGetDomainVFProperties;
pDdiTable->pfnGetDomainControlProperties = L0::zesOverclockGetDomainControlProperties;
pDdiTable->pfnGetControlCurrentValue = L0::zesOverclockGetControlCurrentValue;
pDdiTable->pfnGetControlPendingValue = L0::zesOverclockGetControlPendingValue;
pDdiTable->pfnSetControlUserValue = L0::zesOverclockSetControlUserValue;
pDdiTable->pfnGetControlState = L0::zesOverclockGetControlState;
pDdiTable->pfnGetVFPointValues = L0::zesOverclockGetVFPointValues;
pDdiTable->pfnSetVFPointValues = L0::zesOverclockSetVFPointValues;

return result;
}
Loading

0 comments on commit bf481e6

Please sign in to comment.