mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-09 06:23:01 +08:00
Adding more features to Sysman's memory and Temperature APIs
This change - - Add support for memoryGetBandwidth API - Update temperature offsets - Update ULTs accordingly Signed-off-by: Jitendra Sharma <jitendra.sharma@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
aa05b5adb4
commit
249f7e45cc
@@ -5,7 +5,8 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
set(L0_SRCS_TOOLS_SYSMAN_LINUX_PMT
|
set(L0_SRCS_TOOLS_SYSMAN_LINUX_PMT
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/pmt.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/pmt_helper.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/pmt.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/pmt.h
|
${CMAKE_CURRENT_SOURCE_DIR}/pmt.h
|
||||||
)
|
)
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
|
|||||||
@@ -20,12 +20,6 @@ const std::string PlatformMonitoringTech::baseTelemSysFS("/sys/class/intel_pmt")
|
|||||||
const std::string PlatformMonitoringTech::telem("telem");
|
const std::string PlatformMonitoringTech::telem("telem");
|
||||||
uint32_t PlatformMonitoringTech::rootDeviceTelemNodeIndex = 0;
|
uint32_t PlatformMonitoringTech::rootDeviceTelemNodeIndex = 0;
|
||||||
|
|
||||||
const std::map<std::string, uint64_t> deviceKeyOffsetMap = {
|
|
||||||
{"PACKAGE_ENERGY", 0x400},
|
|
||||||
{"COMPUTE_TEMPERATURES", 0x68},
|
|
||||||
{"SOC_TEMPERATURES", 0x60},
|
|
||||||
{"CORE_TEMPERATURES", 0x6c}};
|
|
||||||
|
|
||||||
ze_result_t PlatformMonitoringTech::enumerateRootTelemIndex(FsAccess *pFsAccess, std::string &rootPciPathOfGpuDevice) {
|
ze_result_t PlatformMonitoringTech::enumerateRootTelemIndex(FsAccess *pFsAccess, std::string &rootPciPathOfGpuDevice) {
|
||||||
std::vector<std::string> listOfTelemNodes;
|
std::vector<std::string> listOfTelemNodes;
|
||||||
auto result = pFsAccess->listDirectory(baseTelemSysFS, listOfTelemNodes);
|
auto result = pFsAccess->listDirectory(baseTelemSysFS, listOfTelemNodes);
|
||||||
@@ -96,7 +90,11 @@ void PlatformMonitoringTech::init(FsAccess *pFsAccess) {
|
|||||||
retVal = result;
|
retVal = result;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
keyOffsetMap = deviceKeyOffsetMap;
|
if (getKeyOffsetMap(guid, keyOffsetMap) != ZE_RESULT_SUCCESS) {
|
||||||
|
// We didnt have any entry for this guid in guidToKeyOffsetMap
|
||||||
|
retVal = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
std::string sizePath = baseTelemSysFSNode + std::string("/size");
|
std::string sizePath = baseTelemSysFSNode + std::string("/size");
|
||||||
result = pFsAccess->read(sizePath, size);
|
result = pFsAccess->read(sizePath, size);
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ class PlatformMonitoringTech : NEO::NonCopyableOrMovableClass {
|
|||||||
char *mappedMemory = nullptr;
|
char *mappedMemory = nullptr;
|
||||||
static uint32_t rootDeviceTelemNodeIndex;
|
static uint32_t rootDeviceTelemNodeIndex;
|
||||||
std::map<std::string, uint64_t> keyOffsetMap;
|
std::map<std::string, uint64_t> keyOffsetMap;
|
||||||
|
ze_result_t getKeyOffsetMap(std::string guid, std::map<std::string, uint64_t> &keyOffsetMap);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void init(FsAccess *pFsAccess);
|
void init(FsAccess *pFsAccess);
|
||||||
|
|||||||
23
level_zero/tools/source/sysman/linux/pmt/pmt_helper.cpp
Normal file
23
level_zero/tools/source/sysman/linux/pmt/pmt_helper.cpp
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020-2021 Intel Corporation
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "level_zero/tools/source/sysman/linux/pmt/pmt.h"
|
||||||
|
|
||||||
|
namespace L0 {
|
||||||
|
|
||||||
|
const std::map<std::string, uint64_t> deviceKeyOffsetMap = {
|
||||||
|
{"PACKAGE_ENERGY", 0x400},
|
||||||
|
{"COMPUTE_TEMPERATURES", 0x68},
|
||||||
|
{"SOC_TEMPERATURES", 0x60},
|
||||||
|
{"CORE_TEMPERATURES", 0x6c}};
|
||||||
|
|
||||||
|
ze_result_t PlatformMonitoringTech::getKeyOffsetMap(std::string guid, std::map<std::string, uint64_t> &keyOffsetMap) {
|
||||||
|
keyOffsetMap = deviceKeyOffsetMap;
|
||||||
|
return ZE_RESULT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace L0
|
||||||
@@ -40,4 +40,7 @@ constexpr uint64_t minTimeoutModeHeartbeat = 5000u;
|
|||||||
constexpr uint64_t minTimeoutInMicroSeconds = 1000u;
|
constexpr uint64_t minTimeoutInMicroSeconds = 1000u;
|
||||||
constexpr uint16_t milliSecsToMicroSecs = 1000;
|
constexpr uint16_t milliSecsToMicroSecs = 1000;
|
||||||
constexpr uint32_t milliFactor = 1000u;
|
constexpr uint32_t milliFactor = 1000u;
|
||||||
constexpr uint32_t microFacor = milliFactor * milliFactor;
|
constexpr uint32_t microFacor = milliFactor * milliFactor;
|
||||||
|
|
||||||
|
constexpr int32_t memoryBusWidth = 128; // bus width in bits
|
||||||
|
constexpr int32_t numMemoryChannels = 8;
|
||||||
@@ -16,6 +16,7 @@ namespace L0 {
|
|||||||
|
|
||||||
class SysfsAccess;
|
class SysfsAccess;
|
||||||
class PlatformMonitoringTech;
|
class PlatformMonitoringTech;
|
||||||
|
struct Device;
|
||||||
class LinuxTemperatureImp : public OsTemperature, NEO::NonCopyableOrMovableClass {
|
class LinuxTemperatureImp : public OsTemperature, NEO::NonCopyableOrMovableClass {
|
||||||
public:
|
public:
|
||||||
ze_result_t getProperties(zes_temp_properties_t *pProperties) override;
|
ze_result_t getProperties(zes_temp_properties_t *pProperties) override;
|
||||||
@@ -28,6 +29,7 @@ class LinuxTemperatureImp : public OsTemperature, NEO::NonCopyableOrMovableClass
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
PlatformMonitoringTech *pPmt = nullptr;
|
PlatformMonitoringTech *pPmt = nullptr;
|
||||||
|
Device *pDevice = nullptr;
|
||||||
zes_temp_sensors_t type = ZES_TEMP_SENSORS_GLOBAL;
|
zes_temp_sensors_t type = ZES_TEMP_SENSORS_GLOBAL;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -14,10 +14,16 @@
|
|||||||
namespace L0 {
|
namespace L0 {
|
||||||
namespace ult {
|
namespace ult {
|
||||||
|
|
||||||
constexpr uint8_t tempArrForSubDevices[28] = {0x12, 0, 0, 0, 0, 0, 0, 0, 0x45, 0, 0, 0, 0x6f, 0, 0, 0, 0x34, 0, 0, 0, 0x16, 0, 0, 0, 0x1d, 0, 0, 0};
|
constexpr uint8_t memory0MaxTemperature = 0x12;
|
||||||
|
constexpr uint8_t memory1MaxTemperature = 0x45;
|
||||||
|
constexpr uint8_t memory2MaxTemperature = 0x32;
|
||||||
|
constexpr uint8_t memory3MaxTemperature = 0x36;
|
||||||
|
constexpr uint8_t tempArrForSubDevices[28] = {memory0MaxTemperature, 0, 0, 0, 0, 0, 0, 0, memory1MaxTemperature, 0, 0, 0, 0x6f, 0, 0, 0, 0x34, 0, 0, 0, 0x16, 0, 0, 0, 0x1d, 0, 0, 0};
|
||||||
constexpr uint64_t offsetForSubDevices = 28;
|
constexpr uint64_t offsetForSubDevices = 28;
|
||||||
constexpr uint8_t memory0MaxTempIndex = 0;
|
constexpr uint16_t memory0MaxTempIndex = 0;
|
||||||
constexpr uint8_t memory1MaxTempIndex = 8;
|
constexpr uint16_t memory1MaxTempIndex = 8;
|
||||||
|
constexpr uint16_t memory2MaxTempIndex = 300;
|
||||||
|
constexpr uint16_t memory3MaxTempIndex = 308;
|
||||||
constexpr uint8_t subDeviceMinTempIndex = 12;
|
constexpr uint8_t subDeviceMinTempIndex = 12;
|
||||||
constexpr uint8_t subDeviceMaxTempIndex = 16;
|
constexpr uint8_t subDeviceMaxTempIndex = 16;
|
||||||
constexpr uint8_t gtMinTempIndex = 20;
|
constexpr uint8_t gtMinTempIndex = 20;
|
||||||
@@ -28,8 +34,19 @@ constexpr uint64_t offsetForNoSubDevices = 0x60;
|
|||||||
constexpr uint8_t computeIndexForNoSubDevices = 9;
|
constexpr uint8_t computeIndexForNoSubDevices = 9;
|
||||||
constexpr uint8_t globalIndexForNoSubDevices = 3;
|
constexpr uint8_t globalIndexForNoSubDevices = 3;
|
||||||
|
|
||||||
constexpr uint64_t mappedLength = 256;
|
constexpr uint64_t mappedLength = 400;
|
||||||
const std::string baseTelemSysFS("/sys/class/intel_pmt");
|
const std::string baseTelemSysFS("/sys/class/intel_pmt");
|
||||||
|
std::string rootPciPathOfGpuDeviceInTemperature = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0";
|
||||||
|
const std::string realPathTelem1 = "/sys/devices/pci0000:89/0000:89:02.0/0000:86:00.0/0000:8b:02.0/0000:8e:00.1/pmt_telemetry.1.auto/intel_pmt/telem1";
|
||||||
|
const std::string realPathTelem2 = "/sys/devices/pci0000:89/0000:89:02.0/0000:86:00.0/0000:8b:02.0/0000:8e:00.1/pmt_telemetry.1.auto/intel_pmt/telem2";
|
||||||
|
const std::string realPathTelem3 = "/sys/devices/pci0000:89/0000:89:02.0/0000:86:00.0/0000:8b:02.0/0000:8e:00.1/pmt_telemetry.1.auto/intel_pmt/telem3";
|
||||||
|
const std::string realPathTelem4 = "/sys/devices/pci0000:89/0000:89:02.0/0000:86:00.0/0000:8b:02.0/0000:8e:00.1/pmt_telemetry.1.auto/intel_pmt/telem4";
|
||||||
|
const std::string realPathTelem5 = "/sys/devices/pci0000:89/0000:89:02.0/0000:86:00.0/0000:8b:02.0/0000:8e:00.1/pmt_telemetry.1.auto/intel_pmt/telem5";
|
||||||
|
const std::string sysfsPahTelem1 = "/sys/class/intel_pmt/telem1";
|
||||||
|
const std::string sysfsPahTelem2 = "/sys/class/intel_pmt/telem2";
|
||||||
|
const std::string sysfsPahTelem3 = "/sys/class/intel_pmt/telem3";
|
||||||
|
const std::string sysfsPahTelem4 = "/sys/class/intel_pmt/telem4";
|
||||||
|
const std::string sysfsPahTelem5 = "/sys/class/intel_pmt/telem5";
|
||||||
class TemperaturePmt : public PlatformMonitoringTech {
|
class TemperaturePmt : public PlatformMonitoringTech {
|
||||||
public:
|
public:
|
||||||
TemperaturePmt(FsAccess *pFsAccess, ze_bool_t onSubdevice, uint32_t subdeviceId) : PlatformMonitoringTech(pFsAccess, onSubdevice, subdeviceId) {}
|
TemperaturePmt(FsAccess *pFsAccess, ze_bool_t onSubdevice, uint32_t subdeviceId) : PlatformMonitoringTech(pFsAccess, onSubdevice, subdeviceId) {}
|
||||||
@@ -49,15 +66,16 @@ struct Mock<TemperaturePmt> : public TemperaturePmt {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void mockedInit(FsAccess *pFsAccess) {
|
void mockedInit(FsAccess *pFsAccess) {
|
||||||
mappedMemory = new char[mappedLength];
|
mappedMemory = new char[mappedLength]();
|
||||||
std::string rootPciPathOfGpuDevice = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0";
|
if (ZE_RESULT_SUCCESS != PlatformMonitoringTech::enumerateRootTelemIndex(pFsAccess, rootPciPathOfGpuDeviceInTemperature)) {
|
||||||
if (ZE_RESULT_SUCCESS != PlatformMonitoringTech::enumerateRootTelemIndex(pFsAccess, rootPciPathOfGpuDevice)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Fill mappedMemory to validate cases when there are subdevices
|
// Fill mappedMemory to validate cases when there are subdevices
|
||||||
for (uint64_t i = 0; i < sizeof(tempArrForSubDevices) / sizeof(uint8_t); i++) {
|
for (uint64_t i = 0; i < sizeof(tempArrForSubDevices) / sizeof(uint8_t); i++) {
|
||||||
mappedMemory[offsetForSubDevices + i] = tempArrForSubDevices[i];
|
mappedMemory[offsetForSubDevices + i] = tempArrForSubDevices[i];
|
||||||
}
|
}
|
||||||
|
mappedMemory[memory2MaxTempIndex] = memory2MaxTemperature;
|
||||||
|
mappedMemory[memory3MaxTempIndex] = memory3MaxTemperature;
|
||||||
// Fill mappedMemory to validate cases when there are no subdevices
|
// Fill mappedMemory to validate cases when there are no subdevices
|
||||||
for (uint64_t i = 0; i < sizeof(tempArrForNoSubDevices) / sizeof(uint8_t); i++) {
|
for (uint64_t i = 0; i < sizeof(tempArrForNoSubDevices) / sizeof(uint8_t); i++) {
|
||||||
mappedMemory[offsetForNoSubDevices + i] = tempArrForNoSubDevices[i];
|
mappedMemory[offsetForNoSubDevices + i] = tempArrForNoSubDevices[i];
|
||||||
@@ -65,8 +83,7 @@ struct Mock<TemperaturePmt> : public TemperaturePmt {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void mockedInitWithoutMappedMemory(FsAccess *pFsAccess) {
|
void mockedInitWithoutMappedMemory(FsAccess *pFsAccess) {
|
||||||
std::string rootPciPathOfGpuDevice = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0";
|
if (ZE_RESULT_SUCCESS != PlatformMonitoringTech::enumerateRootTelemIndex(pFsAccess, rootPciPathOfGpuDeviceInTemperature)) {
|
||||||
if (ZE_RESULT_SUCCESS != PlatformMonitoringTech::enumerateRootTelemIndex(pFsAccess, rootPciPathOfGpuDevice)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -92,16 +109,16 @@ struct Mock<TemperatureFsAccess> : public TemperatureFsAccess {
|
|||||||
return ZE_RESULT_ERROR_NOT_AVAILABLE;
|
return ZE_RESULT_ERROR_NOT_AVAILABLE;
|
||||||
}
|
}
|
||||||
ze_result_t getRealPathSuccess(const std::string path, std::string &buf) {
|
ze_result_t getRealPathSuccess(const std::string path, std::string &buf) {
|
||||||
if (path.compare("/sys/class/intel_pmt/telem1") == 0) {
|
if (path.compare(sysfsPahTelem1) == 0) {
|
||||||
buf = "/sys/devices/pci0000:89/0000:89:02.0/0000:86:00.0/0000:8b:02.0/0000:8e:00.1/pmt_telemetry.1.auto/intel_pmt/telem1";
|
buf = realPathTelem1;
|
||||||
} else if (path.compare("/sys/class/intel_pmt/telem2") == 0) {
|
} else if (path.compare(sysfsPahTelem2) == 0) {
|
||||||
buf = "/sys/devices/pci0000:89/0000:89:02.0/0000:86:00.0/0000:8b:02.0/0000:8e:00.1/pmt_telemetry.1.auto/intel_pmt/telem2";
|
buf = realPathTelem2;
|
||||||
} else if (path.compare("/sys/class/intel_pmt/telem3") == 0) {
|
} else if (path.compare(sysfsPahTelem3) == 0) {
|
||||||
buf = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0/0000:8b:02.0/0000:8e:00.1/pmt_telemetry.1.auto/intel_pmt/telem3";
|
buf = realPathTelem3;
|
||||||
} else if (path.compare("/sys/class/intel_pmt/telem4") == 0) {
|
} else if (path.compare(sysfsPahTelem4) == 0) {
|
||||||
buf = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0/0000:8b:02.0/0000:8e:00.1/pmt_telemetry.1.auto/intel_pmt/telem4";
|
buf = realPathTelem4;
|
||||||
} else if (path.compare("/sys/class/intel_pmt/telem5") == 0) {
|
} else if (path.compare(sysfsPahTelem5) == 0) {
|
||||||
buf = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0/0000:8b:02.0/0000:8e:00.1/pmt_telemetry.1.auto/intel_pmt/telem5";
|
buf = realPathTelem5;
|
||||||
} else {
|
} else {
|
||||||
return ZE_RESULT_ERROR_NOT_AVAILABLE;
|
return ZE_RESULT_ERROR_NOT_AVAILABLE;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user