Support for power limit extensions

Boiler plate implementation of power limit
extension functions.

Related-To: LOCI-3125, LOCI-3193

Signed-off-by: Bellekallu Rajkiran <bellekallu.rajkiran@intel.com>
This commit is contained in:
Bellekallu Rajkiran
2022-07-05 09:48:01 +00:00
committed by Compute-Runtime-Automation
parent 97a3368aad
commit e1ba6d825a
14 changed files with 108 additions and 4 deletions

View File

@@ -188,6 +188,14 @@ ze_result_t LinuxPowerImp::setEnergyThreshold(double threshold) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
ze_result_t LinuxPowerImp::getLimitsExt(uint32_t *pCount, zes_power_limit_ext_desc_t *pSustained) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
ze_result_t LinuxPowerImp::setLimitsExt(uint32_t *pCount, zes_power_limit_ext_desc_t *pSustained) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
bool LinuxPowerImp::isHwmonDir(std::string name) {
if (isSubdevice == false && (name == i915)) {
return true;

View File

@@ -25,6 +25,8 @@ class LinuxPowerImp : public OsPower, NEO::NonCopyableOrMovableClass {
ze_result_t setLimits(const zes_power_sustained_limit_t *pSustained, const zes_power_burst_limit_t *pBurst, const zes_power_peak_limit_t *pPeak) override;
ze_result_t getEnergyThreshold(zes_energy_threshold_t *pThreshold) override;
ze_result_t setEnergyThreshold(double threshold) override;
ze_result_t getLimitsExt(uint32_t *pCount, zes_power_limit_ext_desc_t *pSustained) override;
ze_result_t setLimitsExt(uint32_t *pCount, zes_power_limit_ext_desc_t *pSustained) override;
bool isPowerModuleSupported() override;
bool isHwmonDir(std::string name);

View File

@@ -123,6 +123,14 @@ ze_result_t LinuxPowerImp::setLimits(const zes_power_sustained_limit_t *pSustain
return result;
}
ze_result_t LinuxPowerImp::getLimitsExt(uint32_t *pCount, zes_power_limit_ext_desc_t *pSustained) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
ze_result_t LinuxPowerImp::setLimitsExt(uint32_t *pCount, zes_power_limit_ext_desc_t *pSustained) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
ze_result_t LinuxPowerImp::getEnergyThreshold(zes_energy_threshold_t *pThreshold) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}

View File

@@ -25,6 +25,8 @@ class LinuxPowerImp : public OsPower, NEO::NonCopyableOrMovableClass {
ze_result_t setLimits(const zes_power_sustained_limit_t *pSustained, const zes_power_burst_limit_t *pBurst, const zes_power_peak_limit_t *pPeak) override;
ze_result_t getEnergyThreshold(zes_energy_threshold_t *pThreshold) override;
ze_result_t setEnergyThreshold(double threshold) override;
ze_result_t getLimitsExt(uint32_t *pCount, zes_power_limit_ext_desc_t *pSustained) override;
ze_result_t setLimitsExt(uint32_t *pCount, zes_power_limit_ext_desc_t *pSustained) override;
bool isPowerModuleSupported() override;
bool isHwmonDir(std::string name);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -20,6 +20,8 @@ class OsPower {
virtual ze_result_t setLimits(const zes_power_sustained_limit_t *pSustained, const zes_power_burst_limit_t *pBurst, const zes_power_peak_limit_t *pPeak) = 0;
virtual ze_result_t getEnergyThreshold(zes_energy_threshold_t *pThreshold) = 0;
virtual ze_result_t setEnergyThreshold(double threshold) = 0;
virtual ze_result_t getLimitsExt(uint32_t *pCount, zes_power_limit_ext_desc_t *pSustained) = 0;
virtual ze_result_t setLimitsExt(uint32_t *pCount, zes_power_limit_ext_desc_t *pSustained) = 0;
virtual bool isPowerModuleSupported() = 0;
static OsPower *create(OsSysman *pOsSysman, ze_bool_t onSubdevice, uint32_t subdeviceId);

View File

@@ -30,6 +30,8 @@ class Power : _zet_sysman_pwr_handle_t, _zes_pwr_handle_t {
virtual ze_result_t powerSetLimits(const zes_power_sustained_limit_t *pSustained, const zes_power_burst_limit_t *pBurst, const zes_power_peak_limit_t *pPeak) = 0;
virtual ze_result_t powerGetEnergyThreshold(zes_energy_threshold_t *pThreshold) = 0;
virtual ze_result_t powerSetEnergyThreshold(double threshold) = 0;
virtual ze_result_t powerGetLimitsExt(uint32_t *pCount, zes_power_limit_ext_desc_t *pSustained) = 0;
virtual ze_result_t powerSetLimitsExt(uint32_t *pCount, zes_power_limit_ext_desc_t *pSustained) = 0;
static Power *fromHandle(zes_pwr_handle_t handle) {
return static_cast<Power *>(handle);

View File

@@ -27,6 +27,15 @@ ze_result_t PowerImp::powerGetLimits(zes_power_sustained_limit_t *pSustained, ze
ze_result_t PowerImp::powerSetLimits(const zes_power_sustained_limit_t *pSustained, const zes_power_burst_limit_t *pBurst, const zes_power_peak_limit_t *pPeak) {
return pOsPower->setLimits(pSustained, pBurst, pPeak);
}
ze_result_t PowerImp::powerGetLimitsExt(uint32_t *pCount, zes_power_limit_ext_desc_t *pSustained) {
return pOsPower->getLimitsExt(pCount, pSustained);
}
ze_result_t PowerImp::powerSetLimitsExt(uint32_t *pCount, zes_power_limit_ext_desc_t *pSustained) {
return pOsPower->setLimitsExt(pCount, pSustained);
}
ze_result_t PowerImp::powerGetEnergyThreshold(zes_energy_threshold_t *pThreshold) {
return pOsPower->getEnergyThreshold(pThreshold);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -21,6 +21,8 @@ class PowerImp : public Power, NEO::NonCopyableOrMovableClass {
ze_result_t powerSetLimits(const zes_power_sustained_limit_t *pSustained, const zes_power_burst_limit_t *pBurst, const zes_power_peak_limit_t *pPeak) override;
ze_result_t powerGetEnergyThreshold(zes_energy_threshold_t *pThreshold) override;
ze_result_t powerSetEnergyThreshold(double threshold) override;
ze_result_t powerGetLimitsExt(uint32_t *pCount, zes_power_limit_ext_desc_t *pSustained) override;
ze_result_t powerSetLimitsExt(uint32_t *pCount, zes_power_limit_ext_desc_t *pSustained) override;
PowerImp() = default;
PowerImp(OsSysman *pOsSysman, ze_device_handle_t device);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -327,6 +327,14 @@ bool WddmPowerImp::isPowerModuleSupported() {
return ((status == ZE_RESULT_SUCCESS) && (enabled));
}
ze_result_t WddmPowerImp::getLimitsExt(uint32_t *pCount, zes_power_limit_ext_desc_t *pSustained) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
ze_result_t WddmPowerImp::setLimitsExt(uint32_t *pCount, zes_power_limit_ext_desc_t *pSustained) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
WddmPowerImp::WddmPowerImp(OsSysman *pOsSysman, ze_bool_t onSubdevice, uint32_t subdeviceId) {
WddmSysmanImp *pWddmSysmanImp = static_cast<WddmSysmanImp *>(pOsSysman);
pKmdSysManager = &pWddmSysmanImp->getKmdSysManager();

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -21,6 +21,8 @@ class WddmPowerImp : public OsPower, NEO::NonCopyableOrMovableClass {
ze_result_t setLimits(const zes_power_sustained_limit_t *pSustained, const zes_power_burst_limit_t *pBurst, const zes_power_peak_limit_t *pPeak) override;
ze_result_t getEnergyThreshold(zes_energy_threshold_t *pThreshold) override;
ze_result_t setEnergyThreshold(double threshold) override;
ze_result_t getLimitsExt(uint32_t *pCount, zes_power_limit_ext_desc_t *pSustained) override;
ze_result_t setLimitsExt(uint32_t *pCount, zes_power_limit_ext_desc_t *pSustained) override;
bool isPowerModuleSupported() override;
WddmPowerImp(OsSysman *pOsSysman, ze_bool_t onSubdevice, uint32_t subdeviceId);