Add support for reading frequency-volt curve data

This commit is contained in:
Chris Freehill
2019-01-07 08:44:23 -06:00
parent 253c82c93a
commit b6ce6d30f4
3 ha cambiato i file con 40 aggiunte e 20 eliminazioni
+17 -3
Vedi File
@@ -147,7 +147,7 @@ static uint64_t freq_string_to_int(const std::vector<std::string> &freq_lines,
std::istringstream fs(freq_lines[i]);
uint32_t ind;
uint64_t freq;
long double freq;
std::string junk;
std::string units_str;
std::string star_str;
@@ -183,8 +183,8 @@ static void freq_volt_string_to_point(std::string in_line,
assert(pt != nullptr);
uint32_t ind;
float freq;
float volts;
long double freq;
long double volts;
std::string junk;
std::string freq_units_str;
std::string volts_units_str;
@@ -633,6 +633,8 @@ static const uint32_t kOD_OD_RANGE_label_array_index =
kOD_VDDC_CURVE_label_array_index + 4;
static const uint32_t kOD_VDDC_CURVE_start_index =
kOD_OD_RANGE_label_array_index + 3;
static const uint32_t kOD_VDDC_CURVE_num_lines =
kOD_VDDC_CURVE_start_index + 4;
static rsmi_status_t get_od_clk_volt_info(uint32_t dv_ind,
rsmi_od_volt_freq_data *p) {
@@ -647,6 +649,12 @@ static rsmi_status_t get_od_clk_volt_info(uint32_t dv_ind,
return ret;
}
// This is a work-around to handle systems where kDevPowerODVoltage is not
// fully supported yet.
if (val_vec.size() < 2) {
return RSMI_STATUS_NOT_YET_IMPLEMENTED;
}
assert(val_vec[kOD_SCLK_label_array_index] == "OD_SCLK:");
p->curr_sclk_range.lower_bound = freq_string_to_int(val_vec, nullptr,
@@ -723,6 +731,12 @@ static rsmi_status_t get_od_clk_volt_curve_regions(uint32_t dv_ind,
return ret;
}
// This is a work-around to handle systems where kDevPowerODVoltage is not
// fully supported yet.
if (val_vec.size() < 2) {
return RSMI_STATUS_NOT_YET_IMPLEMENTED;
}
uint32_t val_vec_size = val_vec.size();
assert((val_vec_size - kOD_VDDC_CURVE_start_index) > 0);
assert((val_vec_size - kOD_VDDC_CURVE_start_index)%2 == 0);
+3
Vedi File
@@ -250,6 +250,9 @@ int Device::readDevInfoMultiLineStr(DevInfoTypes type,
retVec->push_back(line);
}
if (retVec->size() == 0) {
return EPERM;
}
// Remove any *trailing* empty (whitespace) lines
while (retVec->back().find_first_not_of(" \t\n\v\f\r") == std::string::npos) {
retVec->pop_back();
@@ -63,7 +63,8 @@ static uint32_t gVerbosity = 3;
std::cout << "RSMI call returned " << (RET); \
rsmi_status_string((RET), &err_str); \
std::cout << " (" << err_str << ")" << std::endl; \
std::cout << " at " << __FILE__ << ":" << __LINE__ << std::endl; \
std::cout << " at " << __FILE__ << ":" << std::dec << __LINE__ << \
std::endl; \
} \
}
@@ -92,7 +93,8 @@ static uint32_t gVerbosity = 3;
std::cout << "ASSERT failure: Expected " << #A << " == " << #B << \
", but got " << #A << " = " << (A) << ", and " << #B << " = " << \
(B) << std::endl; \
std::cout << " at " << __FILE__ << ":" << __LINE__ << std::endl; \
std::cout << " at " << __FILE__ << ":" << std::dec << \
__LINE__ << std::endl; \
return RSMI_STATUS_UNKNOWN_ERROR; \
} \
}
@@ -648,26 +650,27 @@ void TestSanity::Run(void) {
}
err = rsmi_dev_od_volt_info_get(i, &odv);
CHK_ERR_ASRT(err)
DISPLAY_RSMI_ERR(err)
std::cout << "\t**Frequency-voltage curve data:" << std::endl;
print_rsmi_od_volt_freq_data(&odv);
if (err == RSMI_STATUS_SUCCESS) {
std::cout << "\t**Frequency-voltage curve data:" << std::endl;
print_rsmi_od_volt_freq_data(&odv);
rsmi_freq_volt_region *regions;
uint32_t num_regions;
regions = new rsmi_freq_volt_region[odv.num_regions];
ASSERT_TRUE(regions != nullptr);
rsmi_freq_volt_region *regions;
uint32_t num_regions;
regions = new rsmi_freq_volt_region[odv.num_regions];
ASSERT_TRUE(regions != nullptr);
num_regions = odv.num_regions;
err = rsmi_dev_od_volt_curve_regions_get(i, &num_regions, regions);
CHK_ERR_ASRT(err)
ASSERT_TRUE(num_regions == odv.num_regions);
num_regions = odv.num_regions;
err = rsmi_dev_od_volt_curve_regions_get(i, &num_regions, regions);
CHK_ERR_ASRT(err)
ASSERT_TRUE(num_regions == odv.num_regions);
std::cout << "\t**Frequency-voltage curve regions:" << std::endl;
print_rsmi_od_volt_freq_regions(num_regions, regions);
delete []regions;
std::cout << "\t**Frequency-voltage curve regions:" << std::endl;
print_rsmi_od_volt_freq_regions(num_regions, regions);
delete []regions;
}
err = rsmi_dev_perf_level_get(i, &pfl);
CHK_ERR_ASRT(err)