Additional fixes for amd-smi static --clock
Signed-off-by: gabrpham <Gabriel.Pham@amd.com>
Этот коммит содержится в:
коммит произвёл
Arif, Maisam
родитель
3226a1d0ea
Коммит
23da950ef0
@@ -848,8 +848,7 @@ class AMDSMICommands():
|
||||
static_dict['cache_info'] = cache_info_list
|
||||
|
||||
# default to printing all clocks, if in current_platform_args; otherwise print specific clocks
|
||||
if ((args.clock == True or isinstance(args.clock, list))
|
||||
and 'clock' in current_platform_args):
|
||||
if 'clock' in current_platform_args and (args.clock == True or isinstance(args.clock, list)):
|
||||
original_clock_args = args.clock #save original args.clock value, so we can reset for multiple devices
|
||||
if isinstance(args.clock, bool):
|
||||
args.clock = ['sys', 'mem', 'df', 'soc', 'dcef', 'vclk0', 'vclk1', 'dclk0', 'dclk1']
|
||||
@@ -860,7 +859,21 @@ class AMDSMICommands():
|
||||
# check that clock is valid option
|
||||
if "all" in args.clock or len(args.clock) == 0:
|
||||
args.clock = ['sys', 'mem', 'df', 'soc', 'dcef', 'vclk0', 'vclk1', 'dclk0', 'dclk1']
|
||||
clk_dict = {}
|
||||
|
||||
clk_dict = {
|
||||
'sys': "N/A",
|
||||
'mem': "N/A",
|
||||
'df': "N/A",
|
||||
'soc': "N/A",
|
||||
'dcef': "N/A",
|
||||
'vclk0': "N/A",
|
||||
'vclk1': "N/A",
|
||||
'dclk0': "N/A",
|
||||
'dclk1': "N/A",
|
||||
}
|
||||
for clk in list(clk_dict.keys()):
|
||||
if clk not in args.clock:
|
||||
del clk_dict[clk]
|
||||
|
||||
for clk in args.clock:
|
||||
clk_type = clk.lower()
|
||||
@@ -904,7 +917,7 @@ class AMDSMICommands():
|
||||
freq_dict = "N/A"
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
freq_dict = "N/A"
|
||||
clk_dict.update({clk:freq_dict})
|
||||
clk_dict[clk] = freq_dict
|
||||
|
||||
static_dict['clock'] = clk_dict
|
||||
else:
|
||||
@@ -1692,7 +1705,10 @@ class AMDSMICommands():
|
||||
"clk_locked" : "N/A",
|
||||
"deep_sleep" : "N/A"}
|
||||
|
||||
kMAX_NUM_VCLKS = 2
|
||||
kMAX_NUM_VCLKS = 0
|
||||
for clk_type in amdsmi_interface.AmdSmiClkType:
|
||||
if 'VCLK' in clk_type.name:
|
||||
kMAX_NUM_VCLKS += 1
|
||||
for clock_index in range(kMAX_NUM_VCLKS):
|
||||
vclk_index = f"vclk_{clock_index}"
|
||||
clocks[vclk_index] = {"clk" : "N/A",
|
||||
@@ -1701,7 +1717,10 @@ class AMDSMICommands():
|
||||
"clk_locked" : "N/A",
|
||||
"deep_sleep" : "N/A"}
|
||||
|
||||
kMAX_NUM_DCLKS = 2
|
||||
kMAX_NUM_DCLKS = 0
|
||||
for clk_type in amdsmi_interface.AmdSmiClkType:
|
||||
if 'DCLK' in clk_type.name:
|
||||
kMAX_NUM_DCLKS += 1
|
||||
for clock_index in range(kMAX_NUM_DCLKS):
|
||||
dclk_index = f"dclk_{clock_index}"
|
||||
clocks[dclk_index] = {"clk" : "N/A",
|
||||
|
||||
@@ -677,7 +677,7 @@ class AMDSMIParser(argparse.ArgumentParser):
|
||||
static_parser.add_argument('-B', '--board', action='store_true', required=False, help=board_help)
|
||||
static_parser.add_argument('-R', '--process-isolation', action='store_true', required=False, help=process_isolation_help)
|
||||
static_parser.add_argument('-r', '--ras', action='store_true', required=False, help=ras_help)
|
||||
static_parser.add_argument('-C', '--clock', default=False, nargs='*', type=str, required=False, help=clock_help)
|
||||
static_parser.add_argument('-C', '--clock', action='store', default=False, nargs='*', type=str, required=False, help=clock_help)
|
||||
|
||||
# Options to display on Hypervisors and Baremetal
|
||||
if self.helpers.is_hypervisor() or self.helpers.is_baremetal():
|
||||
|
||||
@@ -124,7 +124,7 @@ std::string removeString(const std::string origStr,
|
||||
const std::string &removeMe);
|
||||
void system_wait(int milli_seconds);
|
||||
int countDigit(uint64_t n);
|
||||
uint64_t get_multiplier_from_str(char units_char);
|
||||
uint64_t get_multiplier_from_char(char units_char);
|
||||
template <typename T>
|
||||
std::string print_int_as_hex(T i, bool showHexNotation = true,
|
||||
int overloadBitSize = 0) {
|
||||
|
||||
@@ -96,7 +96,7 @@ int present_reg_state(const char* fname, rsmi_reg_type_t reg_type,
|
||||
rsmi_name_value_t **kv, uint32_t *kvnum);
|
||||
}
|
||||
|
||||
static uint64_t get_multiplier_from_str(char units_char) {
|
||||
static uint64_t get_multiplier_from_char(char units_char) {
|
||||
uint32_t multiplier = 0;
|
||||
|
||||
switch (units_char) {
|
||||
@@ -170,7 +170,7 @@ static uint64_t freq_string_to_int(const std::vector<std::string> &freq_lines,
|
||||
*is_curr = false;
|
||||
}
|
||||
}
|
||||
long double multiplier = get_multiplier_from_str(units_str[0]);
|
||||
long double multiplier = get_multiplier_from_char(units_str[0]);
|
||||
|
||||
if (star_str[0] == 'x') {
|
||||
assert(lanes != nullptr && "Lanes are provided but null lanes pointer");
|
||||
@@ -204,11 +204,11 @@ static void od_value_pair_str_to_range(std::string in_line, rsmi_range_t *rg) {
|
||||
fs_rng >> hi;
|
||||
fs_rng >> hi_units_str;
|
||||
|
||||
long double multiplier = get_multiplier_from_str(lo_units_str[0]);
|
||||
long double multiplier = get_multiplier_from_char(lo_units_str[0]);
|
||||
|
||||
rg->lower_bound = static_cast<uint64_t>(lo*multiplier);
|
||||
|
||||
multiplier = get_multiplier_from_str(hi_units_str[0]);
|
||||
multiplier = get_multiplier_from_char(hi_units_str[0]);
|
||||
rg->upper_bound = static_cast<uint64_t>(hi*multiplier);
|
||||
}
|
||||
|
||||
|
||||
@@ -1280,7 +1280,7 @@ int countDigit(uint64_t n) {
|
||||
return static_cast<int>(std::floor(log10(static_cast<double>(n)) + 1));
|
||||
}
|
||||
|
||||
uint64_t get_multiplier_from_str(char units_char) {
|
||||
uint64_t get_multiplier_from_char(char units_char) {
|
||||
uint32_t multiplier = 0;
|
||||
|
||||
switch (units_char) {
|
||||
|
||||
@@ -1891,7 +1891,7 @@ amdsmi_status_t amdsmi_get_clk_freq(amdsmi_processor_handle processor_handle,
|
||||
f->frequency[0] = std::numeric_limits<uint64_t>::max();
|
||||
if (metric_info_p->current_vclk0 != std::numeric_limits<uint16_t>::max()) {
|
||||
f->frequency[0] = static_cast<uint64_t>(metric_info_p->current_vclk0)
|
||||
* amd::smi::get_multiplier_from_str(unit); // match MHz ROCm SMI provides
|
||||
* amd::smi::get_multiplier_from_char(unit); // match MHz ROCm SMI provides
|
||||
f->num_supported = 1;
|
||||
}
|
||||
}
|
||||
@@ -1900,7 +1900,7 @@ amdsmi_status_t amdsmi_get_clk_freq(amdsmi_processor_handle processor_handle,
|
||||
f->frequency[0] = std::numeric_limits<uint64_t>::max();
|
||||
if (metric_info_p->current_vclk1 != std::numeric_limits<uint16_t>::max()) {
|
||||
f->frequency[0] = static_cast<uint64_t>(metric_info_p->current_vclk1)
|
||||
* amd::smi::get_multiplier_from_str(unit); // match MHz ROCm SMI provides
|
||||
* amd::smi::get_multiplier_from_char(unit); // match MHz ROCm SMI provides
|
||||
f->num_supported = 1;
|
||||
}
|
||||
}
|
||||
@@ -1909,7 +1909,7 @@ amdsmi_status_t amdsmi_get_clk_freq(amdsmi_processor_handle processor_handle,
|
||||
f->frequency[0] = std::numeric_limits<uint64_t>::max();
|
||||
if (metric_info_p->current_dclk0 != std::numeric_limits<uint16_t>::max()) {
|
||||
f->frequency[0] = static_cast<uint64_t>(metric_info_p->current_dclk0)
|
||||
* amd::smi::get_multiplier_from_str(unit); // match MHz ROCm SMI provides
|
||||
* amd::smi::get_multiplier_from_char(unit); // match MHz ROCm SMI provides
|
||||
f->num_supported = 1;
|
||||
}
|
||||
}
|
||||
@@ -1918,7 +1918,7 @@ amdsmi_status_t amdsmi_get_clk_freq(amdsmi_processor_handle processor_handle,
|
||||
f->frequency[0] = std::numeric_limits<uint64_t>::max();
|
||||
if (metric_info_p->current_dclk1 != std::numeric_limits<uint16_t>::max()) {
|
||||
f->frequency[0] = static_cast<uint64_t>(metric_info_p->current_dclk1)
|
||||
* amd::smi::get_multiplier_from_str(unit); // match MHz ROCm SMI provides
|
||||
* amd::smi::get_multiplier_from_char(unit); // match MHz ROCm SMI provides
|
||||
f->num_supported = 1;
|
||||
}
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user