Add support for new performance levels
Also added tests for new performance levels and clean up some formatting/style issues.
이 커밋은 다음에 포함됨:
+2
-11
@@ -364,17 +364,8 @@ rsmi_dev_perf_level_get(uint32_t dv_ind, rsmi_dev_perf_level *perf) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (val_str == "auto") {
|
||||
*perf = RSMI_DEV_PERF_LEVEL_AUTO;
|
||||
} else if (val_str == "low") {
|
||||
*perf = RSMI_DEV_PERF_LEVEL_LOW;
|
||||
} else if (val_str == "high") {
|
||||
*perf = RSMI_DEV_PERF_LEVEL_HIGH;
|
||||
} else if (val_str == "manual") {
|
||||
*perf = RSMI_DEV_PERF_LEVEL_MANUAL;
|
||||
} else {
|
||||
*perf = RSMI_DEV_PERF_LEVEL_UNKNOWN;
|
||||
}
|
||||
*perf = amd::smi::Device::perfLvlStrToEnum(val_str);
|
||||
|
||||
return ret;
|
||||
CATCH
|
||||
}
|
||||
|
||||
+22
-1
@@ -69,6 +69,10 @@ static const char *kDevPerfLevelAutoStr = "auto";
|
||||
static const char *kDevPerfLevelLowStr = "low";
|
||||
static const char *kDevPerfLevelHighStr = "high";
|
||||
static const char *kDevPerfLevelManualStr = "manual";
|
||||
static const char *kDevPerfLevelStandardStr = "profile_standard";
|
||||
static const char *kDevPerfLevelMinMClkStr = "profile_min_mclk";
|
||||
static const char *kDevPerfLevelMinSClkStr = "profile_min_sclk";
|
||||
static const char *kDevPerfLevelPeakStr = "profile_peak";
|
||||
static const char *kDevPerfLevelUnknownStr = "unknown";
|
||||
|
||||
static const std::map<DevInfoTypes, const char *> kDevAttribNameMap = {
|
||||
@@ -85,6 +89,11 @@ static const std::map<rsmi_dev_perf_level, const char *> kDevPerfLvlMap = {
|
||||
{RSMI_DEV_PERF_LEVEL_LOW, kDevPerfLevelLowStr},
|
||||
{RSMI_DEV_PERF_LEVEL_HIGH, kDevPerfLevelHighStr},
|
||||
{RSMI_DEV_PERF_LEVEL_MANUAL, kDevPerfLevelManualStr},
|
||||
{RSMI_DEV_PERF_LEVEL_STABLE_STD, kDevPerfLevelStandardStr},
|
||||
{RSMI_DEV_PERF_LEVEL_STABLE_MIN_MCLK, kDevPerfLevelMinMClkStr},
|
||||
{RSMI_DEV_PERF_LEVEL_STABLE_MIN_SCLK, kDevPerfLevelMinSClkStr},
|
||||
{RSMI_DEV_PERF_LEVEL_STABLE_PEAK, kDevPerfLevelPeakStr},
|
||||
|
||||
{RSMI_DEV_PERF_LEVEL_UNKNOWN, kDevPerfLevelUnknownStr},
|
||||
};
|
||||
|
||||
@@ -157,6 +166,18 @@ int Device::writeDevInfoStr(DevInfoTypes type, std::string valStr) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
rsmi_dev_perf_level Device::perfLvlStrToEnum(std::string s) {
|
||||
rsmi_dev_perf_level pl;
|
||||
|
||||
for (pl = RSMI_DEV_PERF_LEVEL_FIRST; pl <= RSMI_DEV_PERF_LEVEL_LAST; ) {
|
||||
if (s == kDevPerfLvlMap.at(pl)) {
|
||||
return pl;
|
||||
}
|
||||
pl = static_cast<rsmi_dev_perf_level>(static_cast<uint32_t>(pl) + 1);
|
||||
}
|
||||
return RSMI_DEV_PERF_LEVEL_UNKNOWN;
|
||||
}
|
||||
|
||||
int Device::writeDevInfo(DevInfoTypes type, uint64_t val) {
|
||||
switch (type) {
|
||||
// The caller is responsible for making sure "val" is within a valid range
|
||||
@@ -165,7 +186,7 @@ int Device::writeDevInfo(DevInfoTypes type, uint64_t val) {
|
||||
return writeDevInfoStr(type, std::to_string(val));
|
||||
break;
|
||||
|
||||
case kDevPerfLevel: // string: "auto", "low", "high", "manual"
|
||||
case kDevPerfLevel: // string: "auto", "low", "high", "manual", ...
|
||||
return writeDevInfoStr(type,
|
||||
kDevPerfLvlMap.at((rsmi_dev_perf_level)val));
|
||||
break;
|
||||
|
||||
새 이슈에서 참조
사용자 차단