From bf481e6103446d953bed88b8aa29964fc2c7f031 Mon Sep 17 00:00:00 2001 From: "Kulkarni, Ashwin Kumar" Date: Fri, 6 Jan 2023 06:34:26 +0000 Subject: [PATCH] Add Stub Sysman APIs for Level zero specification 1.5 Related-To: LOCI-3841 Signed-off-by: Kulkarni, Ashwin Kumar --- level_zero/api/sysman/ze_sysman_loader.cpp | 69 +++- .../api/sysman/zes_sysman_api_entrypoints.h | 319 +++++++++++++++++- 2 files changed, 386 insertions(+), 2 deletions(-) diff --git a/level_zero/api/sysman/ze_sysman_loader.cpp b/level_zero/api/sysman/ze_sysman_loader.cpp index ed990c62533fa..1f3d7929c3868 100644 --- a/level_zero/api/sysman/ze_sysman_loader.cpp +++ b/level_zero/api/sysman/ze_sysman_loader.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2022 Intel Corporation + * Copyright (C) 2020-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -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; } @@ -92,6 +123,8 @@ zesGetDriverProcAddrTable( pDdiTable->pfnEventListen = L0::zesDriverEventListen; pDdiTable->pfnEventListenEx = L0::zesDriverEventListenEx; + pDdiTable->pfnGet = L0::zesDriverGet; + return result; } @@ -172,6 +205,7 @@ zesGetFabricPortProcAddrTable( pDdiTable->pfnSetConfig = L0::zesFabricPortSetConfig; pDdiTable->pfnGetState = L0::zesFabricPortGetState; pDdiTable->pfnGetThroughput = L0::zesFabricPortGetThroughput; + pDdiTable->pfnGetFabricErrorCounters = L0::zesFabricPortGetFabricErrorCounters; return result; } @@ -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; +} diff --git a/level_zero/api/sysman/zes_sysman_api_entrypoints.h b/level_zero/api/sysman/zes_sysman_api_entrypoints.h index 94061747562b4..30d7e82ae41ab 100644 --- a/level_zero/api/sysman/zes_sysman_api_entrypoints.h +++ b/level_zero/api/sysman/zes_sysman_api_entrypoints.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2022 Intel Corporation + * Copyright (C) 2020-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -691,6 +691,137 @@ ze_result_t zesDeviceSetEccState( return L0::SysmanDevice::deviceSetEccState(hDevice, newState, pState); } +ze_result_t zesOverclockGetDomainProperties( + zes_overclock_handle_t hDomainHandle, + zes_overclock_properties_t *pDomainProperties) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ze_result_t zesOverclockGetDomainVFProperties( + zes_overclock_handle_t hDomainHandle, + zes_vf_property_t *pVFProperties) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ze_result_t zesOverclockGetDomainControlProperties( + zes_overclock_handle_t hDomainHandle, + zes_overclock_control_t domainControl, + zes_control_property_t *pControlProperties) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ze_result_t zesOverclockGetControlCurrentValue( + zes_overclock_handle_t hDomainHandle, + zes_overclock_control_t domainControl, + double *pValue) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ze_result_t zesOverclockGetControlPendingValue( + zes_overclock_handle_t hDomainHandle, + zes_overclock_control_t domainControl, + double *pValue) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ze_result_t zesOverclockSetControlUserValue( + zes_overclock_handle_t hDomainHandle, + zes_overclock_control_t domainControl, + double pValue, + zes_pending_action_t *pPendingAction) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ze_result_t zesOverclockGetControlState( + zes_overclock_handle_t hDomainHandle, + zes_overclock_control_t domainControl, + zes_control_state_t *pControlState, + zes_pending_action_t *pPendingAction) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ze_result_t zesOverclockGetVFPointValues( + zes_overclock_handle_t hDomainHandle, + zes_vf_type_t vfType, + zes_vf_array_type_t vfArrayType, + uint32_t pointIndex, + uint32_t *pointValue) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ze_result_t zesOverclockSetVFPointValues( + zes_overclock_handle_t hDomainHandle, + zes_vf_type_t vfType, + uint32_t pointIndex, + uint32_t pointValue) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ze_result_t zesFabricPortGetFabricErrorCounters( + zes_fabric_port_handle_t hPort, + zes_fabric_port_error_counters_t *pErrors) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ze_result_t zesInit( + zes_init_flags_t flags) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ze_result_t zesDeviceGet( + zes_driver_handle_t hDriver, + uint32_t *pCount, + zes_device_handle_t *phDevices) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ze_result_t zesDriverGet( + uint32_t *pCount, + zes_driver_handle_t *phDrivers) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ze_result_t zesDeviceSetOverclockWaiver( + zes_device_handle_t hDevice) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ze_result_t zesDeviceGetOverclockDomains( + zes_device_handle_t hDevice, + uint32_t *pOverclockDomains) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ze_result_t zesDeviceGetOverclockControls( + zes_device_handle_t hDevice, + zes_overclock_domain_t domainType, + uint32_t *pAvailableControls) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ze_result_t zesDeviceResetOverclockSettings( + zes_device_handle_t hDevice, + ze_bool_t onShippedState) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ze_result_t zesDeviceReadOverclockState( + zes_device_handle_t hDevice, + zes_overclock_mode_t *pOverclockMode, + ze_bool_t *pWaiverSetting, + ze_bool_t *pOverclockState, + zes_pending_action_t *pPendingAction, + ze_bool_t *pPendingReset) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ze_result_t zesDeviceEnumOverclockDomains( + zes_device_handle_t hDevice, + uint32_t *pCount, + zes_overclock_handle_t *phDomainHandle) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + } // namespace L0 extern "C" { @@ -1629,4 +1760,190 @@ ZE_APIEXPORT ze_result_t ZE_APICALL zesTemperatureGetState( hTemperature, pTemperature); } + +ZE_APIEXPORT ze_result_t ZE_APICALL zesOverclockGetDomainProperties( + zes_overclock_handle_t hDomainHandle, + zes_overclock_properties_t *pDomainProperties) { + return L0::zesOverclockGetDomainProperties( + hDomainHandle, + pDomainProperties); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL zesOverclockGetDomainVFProperties( + zes_overclock_handle_t hDomainHandle, + zes_vf_property_t *pVFProperties) { + return L0::zesOverclockGetDomainVFProperties( + hDomainHandle, + pVFProperties); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL zesOverclockGetDomainControlProperties( + zes_overclock_handle_t hDomainHandle, + zes_overclock_control_t domainControl, + zes_control_property_t *pControlProperties) { + return L0::zesOverclockGetDomainControlProperties( + hDomainHandle, + domainControl, + pControlProperties); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL zesOverclockGetControlCurrentValue( + zes_overclock_handle_t hDomainHandle, + zes_overclock_control_t domainControl, + double *pValue) { + return L0::zesOverclockGetControlCurrentValue( + hDomainHandle, + domainControl, + pValue); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL zesOverclockGetControlPendingValue( + zes_overclock_handle_t hDomainHandle, + zes_overclock_control_t domainControl, + double *pValue) { + return L0::zesOverclockGetControlPendingValue( + hDomainHandle, + domainControl, + pValue); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL zesOverclockSetControlUserValue( + zes_overclock_handle_t hDomainHandle, + zes_overclock_control_t domainControl, + double pValue, + zes_pending_action_t *pPendingAction) { + return L0::zesOverclockSetControlUserValue( + hDomainHandle, + domainControl, + pValue, + pPendingAction); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL zesOverclockGetControlState( + zes_overclock_handle_t hDomainHandle, + zes_overclock_control_t domainControl, + zes_control_state_t *pControlState, + zes_pending_action_t *pPendingAction) { + return L0::zesOverclockGetControlState( + hDomainHandle, + domainControl, + pControlState, + pPendingAction); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL zesOverclockGetVFPointValues( + zes_overclock_handle_t hDomainHandle, + zes_vf_type_t vfType, + zes_vf_array_type_t vfArrayType, + uint32_t pointIndex, + uint32_t *pointValue) { + return L0::zesOverclockGetVFPointValues( + hDomainHandle, + vfType, + vfArrayType, + pointIndex, + pointValue); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL zesOverclockSetVFPointValues( + zes_overclock_handle_t hDomainHandle, + zes_vf_type_t vfType, + uint32_t pointIndex, + uint32_t pointValue) { + return L0::zesOverclockSetVFPointValues( + hDomainHandle, + vfType, + pointIndex, + pointValue); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL zesFabricPortGetFabricErrorCounters( + zes_fabric_port_handle_t hPort, + zes_fabric_port_error_counters_t *pErrors) { + return L0::zesFabricPortGetFabricErrorCounters( + hPort, + pErrors); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL zesInit( + zes_init_flags_t flags) { + return L0::zesInit( + flags); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL zesDeviceGet( + zes_driver_handle_t hDriver, + uint32_t *pCount, + zes_device_handle_t *phDevices) { + return L0::zesDeviceGet( + hDriver, + pCount, + phDevices); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL zesDriverGet( + uint32_t *pCount, + zes_driver_handle_t *phDrivers) { + return L0::zesDriverGet( + pCount, + phDrivers); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL zesDeviceSetOverclockWaiver( + zes_device_handle_t hDevice) { + return L0::zesDeviceSetOverclockWaiver( + hDevice); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL zesDeviceGetOverclockDomains( + zes_device_handle_t hDevice, + uint32_t *pOverclockDomains) { + return L0::zesDeviceGetOverclockDomains( + hDevice, + pOverclockDomains); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL zesDeviceGetOverclockControls( + zes_device_handle_t hDevice, + zes_overclock_domain_t domainType, + uint32_t *pAvailableControls) { + return L0::zesDeviceGetOverclockControls( + hDevice, + domainType, + pAvailableControls); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL zesDeviceResetOverclockSettings( + zes_device_handle_t hDevice, + ze_bool_t onShippedState) { + return L0::zesDeviceResetOverclockSettings( + hDevice, + onShippedState); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL zesDeviceReadOverclockState( + zes_device_handle_t hDevice, + zes_overclock_mode_t *pOverclockMode, + ze_bool_t *pWaiverSetting, + ze_bool_t *pOverclockState, + zes_pending_action_t *pPendingAction, + ze_bool_t *pPendingReset) { + return L0::zesDeviceReadOverclockState( + hDevice, + pOverclockMode, + pWaiverSetting, + pOverclockState, + pPendingAction, + pPendingReset); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL zesDeviceEnumOverclockDomains( + zes_device_handle_t hDevice, + uint32_t *pCount, + zes_overclock_handle_t *phDomainHandle) { + return L0::zesDeviceEnumOverclockDomains( + hDevice, + pCount, + phDomainHandle); +} }