mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 23:03:02 +08:00
Revert "feature: Add Memory and GPU domain support for getEnergyCounter()"
This reverts commit 0be4ebe6c2.
Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
b9fb514ad2
commit
2345979800
@@ -27,10 +27,6 @@ class SysmanProductHelper;
|
||||
|
||||
using SysmanProductHelperCreateFunctionType = std::unique_ptr<SysmanProductHelper> (*)();
|
||||
extern SysmanProductHelperCreateFunctionType sysmanProductHelperFactory[IGFX_MAX_PRODUCT];
|
||||
static const std::map<zes_power_domain_t, KmdSysman::PowerDomainsType> powerGroupToDomainTypeMap = {
|
||||
{ZES_POWER_DOMAIN_CARD, KmdSysman::PowerDomainsType::powerDomainCard},
|
||||
{ZES_POWER_DOMAIN_PACKAGE, KmdSysman::PowerDomainsType::powerDomainPackage},
|
||||
};
|
||||
|
||||
class SysmanProductHelper {
|
||||
public:
|
||||
@@ -55,12 +51,6 @@ class SysmanProductHelper {
|
||||
// Memory
|
||||
virtual ze_result_t getMemoryBandWidth(zes_mem_bandwidth_t *pBandwidth, WddmSysmanImp *pWddmSysmanImp) = 0;
|
||||
|
||||
// Power
|
||||
virtual std::vector<zes_power_domain_t> getNumberOfPowerDomainsSupported(WddmSysmanImp *pWddmSysmanImp) = 0;
|
||||
virtual ze_result_t getPowerProperties(zes_power_properties_t *pProperties, zes_power_domain_t powerDomain, WddmSysmanImp *pWddmSysmanImp) = 0;
|
||||
virtual ze_result_t getPowerPropertiesExt(zes_power_ext_properties_t *pExtPoperties, zes_power_domain_t powerDomain, WddmSysmanImp *pWddmSysmanImp) = 0;
|
||||
virtual ze_result_t getPowerEnergyCounter(zes_power_energy_counter_t *pEnergy, zes_power_domain_t powerDomain, WddmSysmanImp *pWddmSysmanImp) = 0;
|
||||
|
||||
// Pmt
|
||||
virtual std::map<unsigned long, std::map<std::string, uint32_t>> *getGuidToKeyOffsetMap() = 0;
|
||||
|
||||
|
||||
@@ -35,12 +35,6 @@ class SysmanProductHelperHw : public SysmanProductHelper {
|
||||
// Memory
|
||||
ze_result_t getMemoryBandWidth(zes_mem_bandwidth_t *pBandwidth, WddmSysmanImp *pWddmSysmanImp) override;
|
||||
|
||||
// Power
|
||||
std::vector<zes_power_domain_t> getNumberOfPowerDomainsSupported(WddmSysmanImp *pWddmSysmanImp) override;
|
||||
ze_result_t getPowerProperties(zes_power_properties_t *pProperties, zes_power_domain_t powerDomain, WddmSysmanImp *pWddmSysmanImp) override;
|
||||
ze_result_t getPowerPropertiesExt(zes_power_ext_properties_t *pExtPoperties, zes_power_domain_t powerDomain, WddmSysmanImp *pWddmSysmanImp) override;
|
||||
ze_result_t getPowerEnergyCounter(zes_power_energy_counter_t *pEnergy, zes_power_domain_t powerDomain, WddmSysmanImp *pWddmSysmanImp) override;
|
||||
|
||||
// Pmt
|
||||
std::map<unsigned long, std::map<std::string, uint32_t>> *getGuidToKeyOffsetMap() override;
|
||||
|
||||
|
||||
@@ -150,152 +150,6 @@ ze_result_t SysmanProductHelperHw<gfxProduct>::getMemoryBandWidth(zes_mem_bandwi
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
std::vector<zes_power_domain_t> SysmanProductHelperHw<gfxProduct>::getNumberOfPowerDomainsSupported(WddmSysmanImp *pWddmSysmanImp) {
|
||||
KmdSysManager *pKmdSysManager = &pWddmSysmanImp->getKmdSysManager();
|
||||
KmdSysman::RequestProperty request;
|
||||
KmdSysman::ResponseProperty response;
|
||||
|
||||
request.commandId = KmdSysman::Command::Get;
|
||||
request.componentId = KmdSysman::Component::PowerComponent;
|
||||
request.requestId = KmdSysman::Requests::Power::NumPowerDomains;
|
||||
|
||||
ze_result_t status = pKmdSysManager->requestSingle(request, response);
|
||||
|
||||
std::vector<zes_power_domain_t> powerDomains;
|
||||
if (status != ZE_RESULT_SUCCESS) {
|
||||
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr,
|
||||
"No power domains are supported, power handles will not be created.\n");
|
||||
return powerDomains;
|
||||
}
|
||||
|
||||
uint32_t supportedPowerDomains = 0;
|
||||
memcpy_s(&supportedPowerDomains, sizeof(uint32_t), response.dataBuffer, sizeof(uint32_t));
|
||||
|
||||
switch (supportedPowerDomains) {
|
||||
case 1:
|
||||
powerDomains.push_back(ZES_POWER_DOMAIN_PACKAGE);
|
||||
break;
|
||||
case 2:
|
||||
powerDomains.push_back(ZES_POWER_DOMAIN_PACKAGE);
|
||||
powerDomains.push_back(ZES_POWER_DOMAIN_CARD);
|
||||
break;
|
||||
default:
|
||||
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr,
|
||||
"Unexpected value returned by KMD, power handles will not be created.\n");
|
||||
break;
|
||||
}
|
||||
return powerDomains;
|
||||
}
|
||||
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
ze_result_t SysmanProductHelperHw<gfxProduct>::getPowerProperties(zes_power_properties_t *pProperties, zes_power_domain_t powerDomain, WddmSysmanImp *pWddmSysmanImp) {
|
||||
KmdSysManager *pKmdSysManager = &pWddmSysmanImp->getKmdSysManager();
|
||||
pProperties->onSubdevice = false;
|
||||
pProperties->subdeviceId = 0;
|
||||
|
||||
std::vector<KmdSysman::RequestProperty> vRequests = {};
|
||||
std::vector<KmdSysman::ResponseProperty> vResponses = {};
|
||||
KmdSysman::RequestProperty request = {};
|
||||
|
||||
request.commandId = KmdSysman::Command::Get;
|
||||
request.componentId = KmdSysman::Component::PowerComponent;
|
||||
request.paramInfo = static_cast<uint32_t>(powerGroupToDomainTypeMap.at(powerDomain));
|
||||
request.requestId = KmdSysman::Requests::Power::EnergyThresholdSupported;
|
||||
vRequests.push_back(request);
|
||||
|
||||
request.requestId = KmdSysman::Requests::Power::TdpDefault;
|
||||
vRequests.push_back(request);
|
||||
|
||||
request.requestId = KmdSysman::Requests::Power::MinPowerLimitDefault;
|
||||
vRequests.push_back(request);
|
||||
|
||||
request.requestId = KmdSysman::Requests::Power::MaxPowerLimitDefault;
|
||||
vRequests.push_back(request);
|
||||
|
||||
ze_result_t status = pKmdSysManager->requestMultiple(vRequests, vResponses);
|
||||
|
||||
if ((status != ZE_RESULT_SUCCESS) || (vResponses.size() != vRequests.size())) {
|
||||
return status;
|
||||
}
|
||||
|
||||
if (vResponses[0].returnCode == KmdSysman::Success) {
|
||||
memcpy_s(&pProperties->canControl, sizeof(ze_bool_t), vResponses[0].dataBuffer, sizeof(ze_bool_t));
|
||||
memcpy_s(&pProperties->isEnergyThresholdSupported, sizeof(ze_bool_t), vResponses[0].dataBuffer, sizeof(ze_bool_t));
|
||||
}
|
||||
|
||||
pProperties->defaultLimit = -1;
|
||||
if (vResponses[1].returnCode == KmdSysman::Success) {
|
||||
memcpy_s(&pProperties->defaultLimit, sizeof(uint32_t), vResponses[1].dataBuffer, sizeof(uint32_t));
|
||||
}
|
||||
|
||||
pProperties->minLimit = -1;
|
||||
if (vResponses[2].returnCode == KmdSysman::Success) {
|
||||
memcpy_s(&pProperties->minLimit, sizeof(uint32_t), vResponses[2].dataBuffer, sizeof(uint32_t));
|
||||
}
|
||||
|
||||
pProperties->maxLimit = -1;
|
||||
if (vResponses[3].returnCode == KmdSysman::Success) {
|
||||
memcpy_s(&pProperties->maxLimit, sizeof(uint32_t), vResponses[3].dataBuffer, sizeof(uint32_t));
|
||||
}
|
||||
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
ze_result_t SysmanProductHelperHw<gfxProduct>::getPowerPropertiesExt(zes_power_ext_properties_t *pExtPoperties, zes_power_domain_t powerDomain, WddmSysmanImp *pWddmSysmanImp) {
|
||||
KmdSysManager *pKmdSysManager = &pWddmSysmanImp->getKmdSysManager();
|
||||
pExtPoperties->domain = powerDomain;
|
||||
if (pExtPoperties->defaultLimit) {
|
||||
KmdSysman::RequestProperty request;
|
||||
KmdSysman::ResponseProperty response;
|
||||
|
||||
request.commandId = KmdSysman::Command::Get;
|
||||
request.componentId = KmdSysman::Component::PowerComponent;
|
||||
request.paramInfo = static_cast<uint32_t>(powerGroupToDomainTypeMap.at(powerDomain));
|
||||
request.requestId = KmdSysman::Requests::Power::TdpDefault;
|
||||
|
||||
ze_result_t status = pKmdSysManager->requestSingle(request, response);
|
||||
pExtPoperties->defaultLimit->limit = -1;
|
||||
|
||||
if (status == ZE_RESULT_SUCCESS) {
|
||||
memcpy_s(&pExtPoperties->defaultLimit->limit, sizeof(uint32_t), response.dataBuffer, sizeof(uint32_t));
|
||||
}
|
||||
|
||||
pExtPoperties->defaultLimit->limitUnit = ZES_LIMIT_UNIT_POWER;
|
||||
pExtPoperties->defaultLimit->enabledStateLocked = true;
|
||||
pExtPoperties->defaultLimit->intervalValueLocked = true;
|
||||
pExtPoperties->defaultLimit->limitValueLocked = true;
|
||||
pExtPoperties->defaultLimit->source = ZES_POWER_SOURCE_ANY;
|
||||
pExtPoperties->defaultLimit->level = ZES_POWER_LEVEL_UNKNOWN;
|
||||
}
|
||||
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
ze_result_t SysmanProductHelperHw<gfxProduct>::getPowerEnergyCounter(zes_power_energy_counter_t *pEnergy, zes_power_domain_t powerDomain, WddmSysmanImp *pWddmSysmanImp) {
|
||||
KmdSysManager *pKmdSysManager = &pWddmSysmanImp->getKmdSysManager();
|
||||
uint64_t energyCounter64Bit = 0;
|
||||
KmdSysman::RequestProperty request;
|
||||
KmdSysman::ResponseProperty response;
|
||||
|
||||
request.commandId = KmdSysman::Command::Get;
|
||||
request.componentId = KmdSysman::Component::PowerComponent;
|
||||
request.paramInfo = static_cast<uint32_t>(powerGroupToDomainTypeMap.at(powerDomain));
|
||||
request.requestId = KmdSysman::Requests::Power::CurrentEnergyCounter64Bit;
|
||||
|
||||
ze_result_t status = pKmdSysManager->requestSingle(request, response);
|
||||
|
||||
if (status == ZE_RESULT_SUCCESS) {
|
||||
memcpy_s(&energyCounter64Bit, sizeof(uint64_t), response.dataBuffer, sizeof(uint64_t));
|
||||
pEnergy->energy = energyCounter64Bit;
|
||||
pEnergy->timestamp = SysmanDevice::getSysmanTimestamp();
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
std::map<unsigned long, std::map<std::string, uint32_t>> *SysmanProductHelperHw<gfxProduct>::getGuidToKeyOffsetMap() {
|
||||
return nullptr;
|
||||
|
||||
@@ -20,20 +20,11 @@ namespace Sysman {
|
||||
|
||||
constexpr static auto gfxProduct = IGFX_BMG;
|
||||
|
||||
// XTAL clock frequency is denoted as an integer between [0-3] with a predefined value for each number. This vector defines the predefined value for each integer represented by the index of the vector.
|
||||
static const std::vector<double> indexToXtalClockFrequecyMap = {24, 19.2, 38.4, 25};
|
||||
|
||||
static std::map<unsigned long, std::map<std::string, uint32_t>> guidToKeyOffsetMap = {
|
||||
{0x1e2f8200, // BMG PUNIT rev 1
|
||||
{{"XTAL_CLK_FREQUENCY", 1},
|
||||
{"VRAM_BANDWIDTH", 14},
|
||||
{"XTAL_COUNT", 128},
|
||||
{"VCCGT_ENERGY_ACCUMULATOR", 407},
|
||||
{"VCCDDR_ENERGY_ACCUMULATOR", 410}}},
|
||||
{{"VRAM_BANDWIDTH", 14}}},
|
||||
{0x5e2f8210, // BMG OOBMSM rev 15
|
||||
{{"PACKAGE_ENERGY_STATUS_SKU", 34},
|
||||
{"PLATFORM_ENERGY_STATUS", 35},
|
||||
{"SOC_THERMAL_SENSORS_TEMPERATURE_0_2_0_GTTMMADR[1]", 41},
|
||||
{{"SOC_THERMAL_SENSORS_TEMPERATURE_0_2_0_GTTMMADR[1]", 41},
|
||||
{"VRAM_TEMPERATURE_0_2_0_GTTMMADR", 42},
|
||||
{"rx_byte_count_lsb", 70},
|
||||
{"rx_byte_count_msb", 69},
|
||||
@@ -591,228 +582,6 @@ ze_result_t SysmanProductHelperHw<gfxProduct>::getMemoryBandWidth(zes_mem_bandwi
|
||||
return status;
|
||||
}
|
||||
|
||||
template <>
|
||||
std::vector<zes_power_domain_t> SysmanProductHelperHw<gfxProduct>::getNumberOfPowerDomainsSupported(WddmSysmanImp *pWddmSysmanImp) {
|
||||
KmdSysManager *pKmdSysManager = &pWddmSysmanImp->getKmdSysManager();
|
||||
KmdSysman::RequestProperty request;
|
||||
KmdSysman::ResponseProperty response;
|
||||
|
||||
request.commandId = KmdSysman::Command::Get;
|
||||
request.componentId = KmdSysman::Component::PowerComponent;
|
||||
request.requestId = KmdSysman::Requests::Power::NumPowerDomains;
|
||||
|
||||
ze_result_t status = pKmdSysManager->requestSingle(request, response);
|
||||
|
||||
std::vector<zes_power_domain_t> powerDomains;
|
||||
if (status != ZE_RESULT_SUCCESS) {
|
||||
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr,
|
||||
"No power domains are supported, power handles will not be created.\n");
|
||||
return powerDomains;
|
||||
}
|
||||
|
||||
uint32_t supportedPowerDomains = 0;
|
||||
memcpy_s(&supportedPowerDomains, sizeof(uint32_t), response.dataBuffer, sizeof(uint32_t));
|
||||
|
||||
switch (supportedPowerDomains) {
|
||||
case 1:
|
||||
powerDomains.push_back(ZES_POWER_DOMAIN_PACKAGE);
|
||||
break;
|
||||
case 2:
|
||||
powerDomains.push_back(ZES_POWER_DOMAIN_PACKAGE);
|
||||
powerDomains.push_back(ZES_POWER_DOMAIN_CARD);
|
||||
break;
|
||||
default:
|
||||
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr,
|
||||
"Unexpected value returned by KMD, power handles will not be created.\n");
|
||||
break;
|
||||
}
|
||||
|
||||
PlatformMonitoringTech *pPmt = pWddmSysmanImp->getSysmanPmt();
|
||||
if (pPmt != nullptr) {
|
||||
powerDomains.push_back(ZES_POWER_DOMAIN_MEMORY);
|
||||
powerDomains.push_back(ZES_POWER_DOMAIN_GPU);
|
||||
}
|
||||
return powerDomains;
|
||||
}
|
||||
|
||||
template <>
|
||||
ze_result_t SysmanProductHelperHw<gfxProduct>::getPowerProperties(zes_power_properties_t *pProperties, zes_power_domain_t powerDomain, WddmSysmanImp *pWddmSysmanImp) {
|
||||
if (powerDomain == ZES_POWER_DOMAIN_CARD || powerDomain == ZES_POWER_DOMAIN_PACKAGE) {
|
||||
KmdSysManager *pKmdSysManager = &pWddmSysmanImp->getKmdSysManager();
|
||||
pProperties->onSubdevice = false;
|
||||
pProperties->subdeviceId = 0;
|
||||
|
||||
std::vector<KmdSysman::RequestProperty> vRequests = {};
|
||||
std::vector<KmdSysman::ResponseProperty> vResponses = {};
|
||||
KmdSysman::RequestProperty request = {};
|
||||
|
||||
request.commandId = KmdSysman::Command::Get;
|
||||
request.componentId = KmdSysman::Component::PowerComponent;
|
||||
request.paramInfo = static_cast<uint32_t>(powerGroupToDomainTypeMap.at(powerDomain));
|
||||
request.requestId = KmdSysman::Requests::Power::EnergyThresholdSupported;
|
||||
vRequests.push_back(request);
|
||||
|
||||
request.requestId = KmdSysman::Requests::Power::TdpDefault;
|
||||
vRequests.push_back(request);
|
||||
|
||||
request.requestId = KmdSysman::Requests::Power::MinPowerLimitDefault;
|
||||
vRequests.push_back(request);
|
||||
|
||||
request.requestId = KmdSysman::Requests::Power::MaxPowerLimitDefault;
|
||||
vRequests.push_back(request);
|
||||
|
||||
ze_result_t status = pKmdSysManager->requestMultiple(vRequests, vResponses);
|
||||
|
||||
if ((status != ZE_RESULT_SUCCESS) || (vResponses.size() != vRequests.size())) {
|
||||
return status;
|
||||
}
|
||||
|
||||
if (vResponses[0].returnCode == KmdSysman::Success) {
|
||||
memcpy_s(&pProperties->canControl, sizeof(ze_bool_t), vResponses[0].dataBuffer, sizeof(ze_bool_t));
|
||||
memcpy_s(&pProperties->isEnergyThresholdSupported, sizeof(ze_bool_t), vResponses[0].dataBuffer, sizeof(ze_bool_t));
|
||||
}
|
||||
|
||||
pProperties->defaultLimit = -1;
|
||||
if (vResponses[1].returnCode == KmdSysman::Success) {
|
||||
memcpy_s(&pProperties->defaultLimit, sizeof(uint32_t), vResponses[1].dataBuffer, sizeof(uint32_t));
|
||||
}
|
||||
|
||||
pProperties->minLimit = -1;
|
||||
if (vResponses[2].returnCode == KmdSysman::Success) {
|
||||
memcpy_s(&pProperties->minLimit, sizeof(uint32_t), vResponses[2].dataBuffer, sizeof(uint32_t));
|
||||
}
|
||||
|
||||
pProperties->maxLimit = -1;
|
||||
if (vResponses[3].returnCode == KmdSysman::Success) {
|
||||
memcpy_s(&pProperties->maxLimit, sizeof(uint32_t), vResponses[3].dataBuffer, sizeof(uint32_t));
|
||||
}
|
||||
return ZE_RESULT_SUCCESS;
|
||||
} else if (powerDomain == ZES_POWER_DOMAIN_MEMORY || powerDomain == ZES_POWER_DOMAIN_GPU) {
|
||||
PlatformMonitoringTech *pPmt = pWddmSysmanImp->getSysmanPmt();
|
||||
if (pPmt == nullptr) {
|
||||
return ZE_RESULT_ERROR_UNKNOWN;
|
||||
}
|
||||
pProperties->onSubdevice = false;
|
||||
pProperties->subdeviceId = 0;
|
||||
pProperties->canControl = false;
|
||||
pProperties->isEnergyThresholdSupported = false;
|
||||
pProperties->defaultLimit = -1;
|
||||
pProperties->minLimit = -1;
|
||||
pProperties->maxLimit = -1;
|
||||
return ZE_RESULT_SUCCESS;
|
||||
} else {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
}
|
||||
|
||||
template <>
|
||||
ze_result_t SysmanProductHelperHw<gfxProduct>::getPowerPropertiesExt(zes_power_ext_properties_t *pExtPoperties, zes_power_domain_t powerDomain, WddmSysmanImp *pWddmSysmanImp) {
|
||||
if (powerDomain == ZES_POWER_DOMAIN_CARD || powerDomain == ZES_POWER_DOMAIN_PACKAGE) {
|
||||
KmdSysManager *pKmdSysManager = &pWddmSysmanImp->getKmdSysManager();
|
||||
pExtPoperties->domain = powerDomain;
|
||||
if (pExtPoperties->defaultLimit) {
|
||||
KmdSysman::RequestProperty request;
|
||||
KmdSysman::ResponseProperty response;
|
||||
|
||||
request.commandId = KmdSysman::Command::Get;
|
||||
request.componentId = KmdSysman::Component::PowerComponent;
|
||||
request.paramInfo = static_cast<uint32_t>(powerGroupToDomainTypeMap.at(powerDomain));
|
||||
request.requestId = KmdSysman::Requests::Power::TdpDefault;
|
||||
|
||||
ze_result_t status = pKmdSysManager->requestSingle(request, response);
|
||||
pExtPoperties->defaultLimit->limit = -1;
|
||||
|
||||
if (status == ZE_RESULT_SUCCESS) {
|
||||
memcpy_s(&pExtPoperties->defaultLimit->limit, sizeof(uint32_t), response.dataBuffer, sizeof(uint32_t));
|
||||
}
|
||||
|
||||
pExtPoperties->defaultLimit->limitUnit = ZES_LIMIT_UNIT_POWER;
|
||||
pExtPoperties->defaultLimit->enabledStateLocked = true;
|
||||
pExtPoperties->defaultLimit->intervalValueLocked = true;
|
||||
pExtPoperties->defaultLimit->limitValueLocked = true;
|
||||
pExtPoperties->defaultLimit->source = ZES_POWER_SOURCE_ANY;
|
||||
pExtPoperties->defaultLimit->level = ZES_POWER_LEVEL_UNKNOWN;
|
||||
}
|
||||
return ZE_RESULT_SUCCESS;
|
||||
} else if (powerDomain == ZES_POWER_DOMAIN_MEMORY || powerDomain == ZES_POWER_DOMAIN_GPU) {
|
||||
pExtPoperties->domain = powerDomain;
|
||||
if (pExtPoperties->defaultLimit) {
|
||||
pExtPoperties->defaultLimit->limit = -1;
|
||||
pExtPoperties->defaultLimit->limitUnit = ZES_LIMIT_UNIT_POWER;
|
||||
pExtPoperties->defaultLimit->enabledStateLocked = true;
|
||||
pExtPoperties->defaultLimit->intervalValueLocked = true;
|
||||
pExtPoperties->defaultLimit->limitValueLocked = true;
|
||||
pExtPoperties->defaultLimit->source = ZES_POWER_SOURCE_ANY;
|
||||
pExtPoperties->defaultLimit->level = ZES_POWER_LEVEL_UNKNOWN;
|
||||
}
|
||||
return ZE_RESULT_SUCCESS;
|
||||
} else {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
}
|
||||
|
||||
template <>
|
||||
ze_result_t SysmanProductHelperHw<gfxProduct>::getPowerEnergyCounter(zes_power_energy_counter_t *pEnergy, zes_power_domain_t powerDomain, WddmSysmanImp *pWddmSysmanImp) {
|
||||
ze_result_t status = ZE_RESULT_SUCCESS;
|
||||
uint32_t energyCounter = 0;
|
||||
std::string key;
|
||||
|
||||
PlatformMonitoringTech *pPmt = pWddmSysmanImp->getSysmanPmt();
|
||||
if (pPmt == nullptr) {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
|
||||
switch (powerDomain) {
|
||||
case ZES_POWER_DOMAIN_PACKAGE:
|
||||
key = "PACKAGE_ENERGY_STATUS_SKU";
|
||||
break;
|
||||
case ZES_POWER_DOMAIN_CARD:
|
||||
key = "PLATFORM_ENERGY_STATUS";
|
||||
break;
|
||||
case ZES_POWER_DOMAIN_MEMORY:
|
||||
key = "VCCDDR_ENERGY_ACCUMULATOR";
|
||||
break;
|
||||
case ZES_POWER_DOMAIN_GPU:
|
||||
key = "VCCGT_ENERGY_ACCUMULATOR";
|
||||
break;
|
||||
default:
|
||||
DEBUG_BREAK_IF(true);
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
break;
|
||||
}
|
||||
|
||||
status = pPmt->readValue(key, energyCounter);
|
||||
|
||||
if (status != ZE_RESULT_SUCCESS) {
|
||||
return status;
|
||||
}
|
||||
|
||||
// Energy counter is in U(18.14) format. Need to convert it into uint64_t
|
||||
uint32_t integerPart = static_cast<uint32_t>(energyCounter >> 14);
|
||||
|
||||
uint32_t decimalBits = static_cast<uint32_t>((energyCounter & 0x3FFF));
|
||||
double decimalPart = static_cast<double>(decimalBits) / (1 << 14);
|
||||
|
||||
double result = static_cast<double>(integerPart + decimalPart);
|
||||
pEnergy->energy = static_cast<uint64_t>((result * convertJouleToMicroJoule));
|
||||
|
||||
// timestamp calcuation
|
||||
uint64_t timestamp64 = 0;
|
||||
uint32_t frequency = 0;
|
||||
|
||||
status = pPmt->readValue("XTAL_COUNT", timestamp64);
|
||||
if (status != ZE_RESULT_SUCCESS) {
|
||||
return status;
|
||||
}
|
||||
status = pPmt->readValue("XTAL_CLK_FREQUENCY", frequency);
|
||||
if (status != ZE_RESULT_SUCCESS) {
|
||||
return status;
|
||||
}
|
||||
double timestamp = timestamp64 / indexToXtalClockFrequecyMap[frequency & 0x2];
|
||||
pEnergy->timestamp = static_cast<uint64_t>(timestamp);
|
||||
return status;
|
||||
}
|
||||
|
||||
template <>
|
||||
std::map<unsigned long, std::map<std::string, uint32_t>> *SysmanProductHelperHw<gfxProduct>::getGuidToKeyOffsetMap() {
|
||||
return &guidToKeyOffsetMap;
|
||||
|
||||
Reference in New Issue
Block a user