[SWDEV-484382] Fix VCLK/DCLK outputs for monitor, static, metric
Units were off and VCLK/DCLK outputs were not coming in
properly through amdsmi_get_clk_freq()
Now we match units sent back through rsmi_dev_gpu_clk_freq_get (MHz).
CLI now shows maximum of 2 VCLK/DCLKs otherwise shows N/A if there
is no current_freq listed.
Change-Id: I8a7b66cbb5263e8d396f8568c104e1ce3512923d
Signed-off-by: Charis Poag <Charis.Poag@amd.com>
[ROCm/amdsmi commit: 3226a1d0ea]
This commit is contained in:
@@ -1868,6 +1868,9 @@ amdsmi_status_t amdsmi_get_clk_freq(amdsmi_processor_handle processor_handle,
|
||||
clk_type == AMDSMI_CLK_TYPE_VCLK1 ||
|
||||
clk_type == AMDSMI_CLK_TYPE_DCLK0 ||
|
||||
clk_type == AMDSMI_CLK_TYPE_DCLK1 ) {
|
||||
// Default unit is MHz
|
||||
char unit = 'M';
|
||||
|
||||
// when f == nullptr -> check if metrics are supported
|
||||
amdsmi_gpu_metrics_t metric_info;
|
||||
amdsmi_gpu_metrics_t * metric_info_p = nullptr;
|
||||
@@ -1882,22 +1885,42 @@ amdsmi_status_t amdsmi_get_clk_freq(amdsmi_processor_handle processor_handle,
|
||||
if (r_status != AMDSMI_STATUS_SUCCESS)
|
||||
return r_status;
|
||||
|
||||
f->num_supported = 1;
|
||||
f->num_supported = 0;
|
||||
if (clk_type == AMDSMI_CLK_TYPE_VCLK0) {
|
||||
f->current = metric_info_p->current_vclk0;
|
||||
f->frequency[0] = metric_info_p->average_vclk0_frequency;
|
||||
f->current = 0;
|
||||
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
|
||||
f->num_supported = 1;
|
||||
}
|
||||
}
|
||||
if (clk_type == AMDSMI_CLK_TYPE_VCLK1) {
|
||||
f->current = metric_info_p->current_vclk1;
|
||||
f->frequency[0] = metric_info_p->average_vclk1_frequency;
|
||||
f->current = 0;
|
||||
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
|
||||
f->num_supported = 1;
|
||||
}
|
||||
}
|
||||
if (clk_type == AMDSMI_CLK_TYPE_DCLK0) {
|
||||
f->current = metric_info_p->current_dclk0;
|
||||
f->frequency[0] = metric_info_p->average_dclk0_frequency;
|
||||
f->current = 0;
|
||||
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
|
||||
f->num_supported = 1;
|
||||
}
|
||||
}
|
||||
if (clk_type == AMDSMI_CLK_TYPE_DCLK1) {
|
||||
f->current = metric_info_p->current_dclk1;
|
||||
f->frequency[0] = metric_info_p->average_dclk1_frequency;
|
||||
f->current = 0;
|
||||
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
|
||||
f->num_supported = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return r_status;
|
||||
|
||||
مرجع در شماره جدید
Block a user