SWDEV-424983 - Fix supported metrics api checks
Change-Id: I5c95bb3057dd7546036cbd87bbf7025469d2b3d5
Signed-off-by: Galantsev, Dmitrii <dmitrii.galantsev@amd.com>
[ROCm/amdsmi commit: 88d5e011e6]
Этот коммит содержится в:
коммит произвёл
Dmitrii Galantsev
родитель
1fd44d67f4
Коммит
21fa9c0950
@@ -446,7 +446,7 @@ amdsmi_status_t amdsmi_get_gpu_board_info(amdsmi_processor_handle processor_hand
|
||||
|
||||
AMDSMI_CHECK_INIT();
|
||||
|
||||
if (board_info == NULL) {
|
||||
if (board_info == nullptr) {
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
}
|
||||
|
||||
@@ -532,7 +532,7 @@ amdsmi_status_t amdsmi_get_gpu_vram_usage(amdsmi_processor_handle processor_hand
|
||||
|
||||
AMDSMI_CHECK_INIT();
|
||||
|
||||
if (vram_info == NULL) {
|
||||
if (vram_info == nullptr) {
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
}
|
||||
|
||||
@@ -1086,9 +1086,8 @@ amdsmi_get_gpu_compute_process_gpus(uint32_t pid, uint32_t *dv_indices,
|
||||
amdsmi_status_t amdsmi_get_gpu_ecc_count(amdsmi_processor_handle processor_handle,
|
||||
amdsmi_gpu_block_t block, amdsmi_error_count_t *ec) {
|
||||
AMDSMI_CHECK_INIT();
|
||||
// nullptr api supported
|
||||
|
||||
if (ec == nullptr)
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
return rsmi_wrapper(rsmi_dev_ecc_count_get, processor_handle,
|
||||
static_cast<rsmi_gpu_block_t>(block),
|
||||
reinterpret_cast<rsmi_error_count_t*>(ec));
|
||||
@@ -1096,9 +1095,8 @@ amdsmi_status_t amdsmi_get_gpu_ecc_count(amdsmi_processor_handle processor_hand
|
||||
amdsmi_status_t amdsmi_get_gpu_ecc_enabled(amdsmi_processor_handle processor_handle,
|
||||
uint64_t *enabled_blocks) {
|
||||
AMDSMI_CHECK_INIT();
|
||||
// nullptr api supported
|
||||
|
||||
if (enabled_blocks == nullptr)
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
return rsmi_wrapper(rsmi_dev_ecc_enabled_get, processor_handle,
|
||||
enabled_blocks);
|
||||
}
|
||||
@@ -1106,9 +1104,8 @@ amdsmi_status_t amdsmi_get_gpu_ecc_status(amdsmi_processor_handle processor_han
|
||||
amdsmi_gpu_block_t block,
|
||||
amdsmi_ras_err_state_t *state) {
|
||||
AMDSMI_CHECK_INIT();
|
||||
// nullptr api supported
|
||||
|
||||
if (state == nullptr)
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
return rsmi_wrapper(rsmi_dev_ecc_status_get, processor_handle,
|
||||
static_cast<rsmi_gpu_block_t>(block),
|
||||
reinterpret_cast<rsmi_ras_err_state_t*>(state));
|
||||
@@ -1118,9 +1115,8 @@ amdsmi_status_t amdsmi_get_gpu_metrics_info(
|
||||
amdsmi_processor_handle processor_handle,
|
||||
amdsmi_gpu_metrics_t *pgpu_metrics) {
|
||||
AMDSMI_CHECK_INIT();
|
||||
// nullptr api supported
|
||||
|
||||
if (pgpu_metrics == nullptr)
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
return rsmi_wrapper(rsmi_dev_gpu_metrics_info_get, processor_handle,
|
||||
reinterpret_cast<rsmi_gpu_metrics_t*>(pgpu_metrics));
|
||||
}
|
||||
@@ -1207,9 +1203,8 @@ amdsmi_status_t
|
||||
uint32_t sensor_ind,
|
||||
amdsmi_power_profile_status_t *status) {
|
||||
AMDSMI_CHECK_INIT();
|
||||
// nullptr api supported
|
||||
|
||||
if (status == nullptr)
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
return rsmi_wrapper(rsmi_dev_power_profile_presets_get, processor_handle,
|
||||
sensor_ind,
|
||||
reinterpret_cast<rsmi_power_profile_status_t*>(status));
|
||||
@@ -1228,15 +1223,16 @@ amdsmi_status_t
|
||||
reserved,
|
||||
static_cast<rsmi_power_profile_preset_masks_t>(profile));
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_get_gpu_perf_level(amdsmi_processor_handle processor_handle,
|
||||
amdsmi_dev_perf_level_t *perf) {
|
||||
AMDSMI_CHECK_INIT();
|
||||
// nullptr api supported
|
||||
|
||||
if (perf == nullptr)
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
return rsmi_wrapper(rsmi_dev_perf_level_get, processor_handle,
|
||||
reinterpret_cast<rsmi_dev_perf_level_t*>(perf));
|
||||
}
|
||||
|
||||
amdsmi_status_t
|
||||
amdsmi_set_gpu_perf_level(amdsmi_processor_handle processor_handle,
|
||||
amdsmi_dev_perf_level_t perf_lvl) {
|
||||
@@ -1260,37 +1256,44 @@ amdsmi_status_t amdsmi_get_gpu_pci_bandwidth(amdsmi_processor_handle processor_h
|
||||
amdsmi_status_t amdsmi_get_clk_freq(amdsmi_processor_handle processor_handle,
|
||||
amdsmi_clk_type_t clk_type, amdsmi_frequencies_t *f) {
|
||||
AMDSMI_CHECK_INIT();
|
||||
|
||||
if (f == nullptr)
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
// nullptr api supported
|
||||
|
||||
// Get from gpu_metrics
|
||||
if (clk_type == CLK_TYPE_VCLK0 ||
|
||||
clk_type == CLK_TYPE_VCLK1 ||
|
||||
clk_type == CLK_TYPE_DCLK0 ||
|
||||
clk_type == CLK_TYPE_DCLK1 ) {
|
||||
|
||||
// when f == nullptr -> check if metrics are supported
|
||||
amdsmi_gpu_metrics_t metric_info;
|
||||
amdsmi_gpu_metrics_t * metric_info_p = nullptr;
|
||||
|
||||
if (f != nullptr) {
|
||||
metric_info_p = &metric_info;
|
||||
}
|
||||
|
||||
// when metric_info_p == nullptr - this will not return AMDSMI_STATUS_SUCCESS
|
||||
auto r_status = amdsmi_get_gpu_metrics_info(
|
||||
processor_handle, &metric_info);
|
||||
processor_handle, metric_info_p);
|
||||
if (r_status != AMDSMI_STATUS_SUCCESS)
|
||||
return r_status;
|
||||
|
||||
f->num_supported = 1;
|
||||
if (clk_type == CLK_TYPE_VCLK0) {
|
||||
f->current = metric_info.current_vclk0;
|
||||
f->frequency[0] = metric_info.average_vclk0_frequency;
|
||||
f->current = metric_info_p->current_vclk0;
|
||||
f->frequency[0] = metric_info_p->average_vclk0_frequency;
|
||||
}
|
||||
if (clk_type == CLK_TYPE_VCLK1) {
|
||||
f->current = metric_info.current_vclk1;
|
||||
f->frequency[0] = metric_info.average_vclk1_frequency;
|
||||
f->current = metric_info_p->current_vclk1;
|
||||
f->frequency[0] = metric_info_p->average_vclk1_frequency;
|
||||
}
|
||||
if (clk_type == CLK_TYPE_DCLK0) {
|
||||
f->current = metric_info.current_dclk0;
|
||||
f->frequency[0] = metric_info.average_dclk0_frequency;
|
||||
f->current = metric_info_p->current_dclk0;
|
||||
f->frequency[0] = metric_info_p->average_dclk0_frequency;
|
||||
}
|
||||
if (clk_type == CLK_TYPE_DCLK1) {
|
||||
f->current = metric_info.current_dclk1;
|
||||
f->frequency[0] = metric_info.average_dclk1_frequency;
|
||||
f->current = metric_info_p->current_dclk1;
|
||||
f->frequency[0] = metric_info_p->average_dclk1_frequency;
|
||||
}
|
||||
|
||||
return r_status;
|
||||
@@ -1305,7 +1308,7 @@ amdsmi_status_t amdsmi_set_clk_freq(amdsmi_processor_handle processor_handle,
|
||||
amdsmi_clk_type_t clk_type, uint64_t freq_bitmask) {
|
||||
AMDSMI_CHECK_INIT();
|
||||
|
||||
// Not support the clock type read from gpu_metrics
|
||||
// Not support the clock type write into gpu_metrics
|
||||
if (clk_type == CLK_TYPE_VCLK0 ||
|
||||
clk_type == CLK_TYPE_VCLK1 ||
|
||||
clk_type == CLK_TYPE_DCLK0 ||
|
||||
|
||||
@@ -109,7 +109,7 @@ void TestErrCntRead::Run(void) {
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_get_gpu_ecc_enabled(processor_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
|
||||
|
||||
continue;
|
||||
} else {
|
||||
@@ -150,7 +150,7 @@ void TestErrCntRead::Run(void) {
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_get_gpu_ecc_count(processor_handles_[i], static_cast<amdsmi_gpu_block_t>(b),
|
||||
nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
|
||||
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
|
||||
@@ -107,6 +107,9 @@ void TestFanRead::Run(void) {
|
||||
std::cout << "\t**" << ": " <<
|
||||
"Not supported on this machine" << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_get_gpu_fan_speed(processor_handles_[i], 0, nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
|
||||
return;
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
|
||||
@@ -128,7 +128,7 @@ void TestFrequenciesRead::Run(void) {
|
||||
": Not supported on this machine" << std::endl;
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_get_clk_freq(processor_handles_[i], t, nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user