mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 09:09:04 +08:00
feature: Add Support for 64 bit aggregated read/write counters
Related-To: LOCI-4529 Signed-off-by: Mayank Raghuwanshi <mayank.raghuwanshi@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
b840c169c7
commit
d02885767d
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
* Copyright (C) 2022-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -207,7 +207,15 @@ const std::map<std::string, std::map<std::string, uint64_t>> guidToKeyOffsetMap
|
||||
{"VF1_HBM2_READ", 344},
|
||||
{"VF1_HBM2_WRITE", 348},
|
||||
{"VF1_HBM3_READ", 360},
|
||||
{"VF1_HBM3_WRITE", 364}}},
|
||||
{"VF1_HBM3_WRITE", 364},
|
||||
{"VF0_HBM_READ_L", 384},
|
||||
{"VF0_HBM_READ_H", 388},
|
||||
{"VF0_HBM_WRITE_L", 392},
|
||||
{"VF0_HBM_WRITE_H", 396},
|
||||
{"VF1_HBM_READ_L", 400},
|
||||
{"VF1_HBM_READ_H", 404},
|
||||
{"VF1_HBM_WRITE_L", 408},
|
||||
{"VF1_HBM_WRITE_H", 412}}},
|
||||
{"0xb15a0edd", // For PVC device
|
||||
{{"HBM0MaxDeviceTemperature", 28},
|
||||
{"HBM1MaxDeviceTemperature", 36},
|
||||
@@ -238,7 +246,54 @@ const std::map<std::string, std::map<std::string, uint64_t>> guidToKeyOffsetMap
|
||||
{"VF1_HBM2_READ", 344},
|
||||
{"VF1_HBM2_WRITE", 348},
|
||||
{"VF1_HBM3_READ", 360},
|
||||
{"VF1_HBM3_WRITE", 364}}},
|
||||
{"VF1_HBM3_WRITE", 364},
|
||||
{"VF0_HBM_READ_L", 384},
|
||||
{"VF0_HBM_READ_H", 388},
|
||||
{"VF0_HBM_WRITE_L", 392},
|
||||
{"VF0_HBM_WRITE_H", 396},
|
||||
{"VF1_HBM_READ_L", 400},
|
||||
{"VF1_HBM_READ_H", 404},
|
||||
{"VF1_HBM_WRITE_L", 408},
|
||||
{"VF1_HBM_WRITE_H", 412}}},
|
||||
{"0xb15a0ede", // For PVC device
|
||||
{{"HBM0MaxDeviceTemperature", 28},
|
||||
{"HBM1MaxDeviceTemperature", 36},
|
||||
{"TileMinTemperature", 40},
|
||||
{"TileMaxTemperature", 44},
|
||||
{"GTMinTemperature", 48},
|
||||
{"GTMaxTemperature", 52},
|
||||
{"VF0_VFID", 88},
|
||||
{"VF0_HBM0_READ", 92},
|
||||
{"VF0_HBM0_WRITE", 96},
|
||||
{"VF0_HBM1_READ", 104},
|
||||
{"VF0_HBM1_WRITE", 108},
|
||||
{"VF0_TIMESTAMP_L", 168},
|
||||
{"VF0_TIMESTAMP_H", 172},
|
||||
{"VF1_VFID", 176},
|
||||
{"VF1_HBM0_READ", 180},
|
||||
{"VF1_HBM0_WRITE", 184},
|
||||
{"VF1_HBM1_READ", 192},
|
||||
{"VF1_HBM1_WRITE", 196},
|
||||
{"VF1_TIMESTAMP_L", 256},
|
||||
{"VF1_TIMESTAMP_H", 260},
|
||||
{"HBM2MaxDeviceTemperature", 300},
|
||||
{"HBM3MaxDeviceTemperature", 308},
|
||||
{"VF0_HBM2_READ", 312},
|
||||
{"VF0_HBM2_WRITE", 316},
|
||||
{"VF0_HBM3_READ", 328},
|
||||
{"VF0_HBM3_WRITE", 332},
|
||||
{"VF1_HBM2_READ", 344},
|
||||
{"VF1_HBM2_WRITE", 348},
|
||||
{"VF1_HBM3_READ", 360},
|
||||
{"VF1_HBM3_WRITE", 364},
|
||||
{"VF0_HBM_READ_L", 384},
|
||||
{"VF0_HBM_READ_H", 388},
|
||||
{"VF0_HBM_WRITE_L", 392},
|
||||
{"VF0_HBM_WRITE_H", 396},
|
||||
{"VF1_HBM_READ_L", 400},
|
||||
{"VF1_HBM_READ_H", 404},
|
||||
{"VF1_HBM_WRITE_L", 408},
|
||||
{"VF1_HBM_WRITE_H", 412}}},
|
||||
{"0x41fe79a5", // For PVC root device
|
||||
{{"PPIN", 152},
|
||||
{"BoardNumber", 72}}}};
|
||||
|
||||
@@ -259,6 +259,75 @@ ze_result_t LinuxMemoryImp::getHbmBandwidth(uint32_t numHbmModules, zes_mem_band
|
||||
return result;
|
||||
}
|
||||
|
||||
ze_result_t LinuxMemoryImp::getHbmBandwidthPVC(uint32_t numHbmModules, zes_mem_bandwidth_t *pBandwidth) {
|
||||
pBandwidth->readCounter = 0;
|
||||
pBandwidth->writeCounter = 0;
|
||||
pBandwidth->timestamp = 0;
|
||||
pBandwidth->maxBandwidth = 0;
|
||||
ze_result_t result = ZE_RESULT_ERROR_UNKNOWN;
|
||||
std::string vfId = "";
|
||||
result = getVFIDString(vfId);
|
||||
if (result != ZE_RESULT_SUCCESS) {
|
||||
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():getVFIDString returning error:0x%x while retriving VFID string \n", __FUNCTION__, result);
|
||||
return result;
|
||||
}
|
||||
auto &hwInfo = pDevice->getNEODevice()->getHardwareInfo();
|
||||
auto productFamily = hwInfo.platform.eProductFamily;
|
||||
auto &productHelper = pDevice->getNEODevice()->getProductHelper();
|
||||
auto stepping = productHelper.getSteppingFromHwRevId(hwInfo);
|
||||
|
||||
uint32_t readCounterL = 0;
|
||||
std::string readCounterKey = vfId + "_HBM_READ_L";
|
||||
result = pPmt->readValue(readCounterKey, readCounterL);
|
||||
if (result != ZE_RESULT_SUCCESS) {
|
||||
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for readCounterL returning error:0x%x \n", __FUNCTION__, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
uint32_t readCounterH = 0;
|
||||
readCounterKey = vfId + "_HBM_READ_H";
|
||||
result = pPmt->readValue(readCounterKey, readCounterH);
|
||||
if (result != ZE_RESULT_SUCCESS) {
|
||||
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for readCounterH returning error:0x%x \n", __FUNCTION__, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
constexpr uint64_t transactionSize = 32;
|
||||
pBandwidth->readCounter = readCounterH;
|
||||
pBandwidth->readCounter = (pBandwidth->readCounter << 32) | static_cast<uint64_t>(readCounterL);
|
||||
pBandwidth->readCounter = (pBandwidth->readCounter * transactionSize);
|
||||
|
||||
uint32_t writeCounterL = 0;
|
||||
std::string writeCounterKey = vfId + "_HBM_WRITE_L";
|
||||
result = pPmt->readValue(writeCounterKey, writeCounterL);
|
||||
if (result != ZE_RESULT_SUCCESS) {
|
||||
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for writeCounterL returning error:0x%x \n", __FUNCTION__, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
uint32_t writeCounterH = 0;
|
||||
writeCounterKey = vfId + "_HBM_WRITE_H";
|
||||
result = pPmt->readValue(writeCounterKey, writeCounterH);
|
||||
if (result != ZE_RESULT_SUCCESS) {
|
||||
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():readValue for writeCounterH returning error:0x%x \n", __FUNCTION__, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
pBandwidth->writeCounter = writeCounterH;
|
||||
pBandwidth->writeCounter = (pBandwidth->writeCounter << 32) | static_cast<uint64_t>(writeCounterL);
|
||||
pBandwidth->writeCounter = (pBandwidth->writeCounter * transactionSize);
|
||||
|
||||
uint64_t timeStampVal = 0;
|
||||
memoryGetTimeStamp(timeStampVal);
|
||||
pBandwidth->timestamp = timeStampVal;
|
||||
|
||||
uint64_t hbmFrequency = 0;
|
||||
getHbmFrequency(productFamily, stepping, hbmFrequency);
|
||||
|
||||
pBandwidth->maxBandwidth = memoryBusWidth * hbmFrequency * numHbmModules; // Value in bytes/secs
|
||||
return result;
|
||||
}
|
||||
|
||||
ze_result_t LinuxMemoryImp::getBandwidth(zes_mem_bandwidth_t *pBandwidth) {
|
||||
if (pPmt == nullptr) {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
@@ -277,7 +346,7 @@ ze_result_t LinuxMemoryImp::getBandwidth(zes_mem_bandwidth_t *pBandwidth) {
|
||||
break;
|
||||
case IGFX_PVC:
|
||||
numHbmModules = 4u;
|
||||
result = getHbmBandwidth(numHbmModules, pBandwidth);
|
||||
result = getHbmBandwidthPVC(numHbmModules, pBandwidth);
|
||||
break;
|
||||
default:
|
||||
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
|
||||
@@ -44,6 +44,7 @@ class LinuxMemoryImp : public OsMemory, NEO::NonCopyableOrMovableClass {
|
||||
ze_result_t getVFIDString(std::string &vfID);
|
||||
ze_result_t getBandwidthForDg2(zes_mem_bandwidth_t *pBandwidth);
|
||||
ze_result_t getHbmBandwidth(uint32_t numHbmModules, zes_mem_bandwidth_t *pBandwidth);
|
||||
ze_result_t getHbmBandwidthPVC(uint32_t numHbmModules, zes_mem_bandwidth_t *pBandwidth);
|
||||
ze_result_t getHbmBandwidthEx(uint32_t numHbmModules, uint32_t counterMaxValue, uint64_t *pReadCounters, uint64_t *pWriteCounters, uint64_t *pMaxBandwidth, uint64_t timeout);
|
||||
static const std::string deviceMemoryHealth;
|
||||
bool isSubdevice = false;
|
||||
|
||||
Reference in New Issue
Block a user