From 5dbca01d2df95681053e531bc940db83227cf952 Mon Sep 17 00:00:00 2001 From: gabrpham Date: Tue, 9 Sep 2025 14:32:35 -0500 Subject: [PATCH] [SWDEV-551309] Adjusted rocmsmitst and --resetprofile command (#769) --- .../rocm-smi-lib/python_smi_tools/rocm_smi.py | 5 ----- projects/rocm-smi-lib/src/rocm_smi.cc | 4 ---- .../functional/power_read_write.cc | 21 +++++++------------ 3 files changed, 7 insertions(+), 23 deletions(-) diff --git a/projects/rocm-smi-lib/python_smi_tools/rocm_smi.py b/projects/rocm-smi-lib/python_smi_tools/rocm_smi.py index 698d1c6d5a..3d1741aab1 100755 --- a/projects/rocm-smi-lib/python_smi_tools/rocm_smi.py +++ b/projects/rocm-smi-lib/python_smi_tools/rocm_smi.py @@ -1143,11 +1143,6 @@ def resetProfile(deviceList): printLog(device, 'Successfully reset Power Profile', None) else: printErrLog(device, 'Unable to reset Power Profile') - ret = rocmsmi.rsmi_dev_perf_level_set(device, rsmi_dev_perf_level_t(0)) - if rsmi_ret_ok(ret, device, 'set_perf_level'): - printLog(device, 'Successfully reset Performance Level', None) - else: - printErrLog(device, 'Unable to reset Performance Level') printLogSpacer() diff --git a/projects/rocm-smi-lib/src/rocm_smi.cc b/projects/rocm-smi-lib/src/rocm_smi.cc index 20b6bb72a0..561798ade0 100755 --- a/projects/rocm-smi-lib/src/rocm_smi.cc +++ b/projects/rocm-smi-lib/src/rocm_smi.cc @@ -1301,10 +1301,6 @@ static rsmi_status_t get_power_profiles(uint32_t dv_ind, } assert(val_vec.size() <= RSMI_MAX_NUM_POWER_PROFILES); if (val_vec.size() > RSMI_MAX_NUM_POWER_PROFILES + 1 || val_vec.empty()) { - // Guest may not have power related information. - if (amd::smi::is_vm_guest()) { - return RSMI_STATUS_NOT_SUPPORTED; - } return RSMI_STATUS_UNEXPECTED_SIZE; } // -1 for the header line, below diff --git a/projects/rocm-smi-lib/tests/rocm_smi_test/functional/power_read_write.cc b/projects/rocm-smi-lib/tests/rocm_smi_test/functional/power_read_write.cc index f61a48aeaf..ac4dc2ff40 100755 --- a/projects/rocm-smi-lib/tests/rocm_smi_test/functional/power_read_write.cc +++ b/projects/rocm-smi-lib/tests/rocm_smi_test/functional/power_read_write.cc @@ -132,7 +132,7 @@ void TestPowerReadWrite::Run(void) { ASSERT_EQ(ret, RSMI_STATUS_NOT_SUPPORTED); continue; } - CHK_ERR_ASRT(ret) + CHK_ERR_ASRT(ret); // Verify api support checking functionality is working ret = rsmi_dev_power_profile_presets_get(dv_ind, 0, nullptr); @@ -181,24 +181,17 @@ void TestPowerReadWrite::Run(void) { rsmi_dev_perf_level_t pfl; ret = rsmi_dev_perf_level_get(dv_ind, &pfl); - CHK_ERR_ASRT(ret) + CHK_ERR_ASRT(ret); ASSERT_EQ(pfl, RSMI_DEV_PERF_LEVEL_MANUAL); ret = rsmi_dev_power_profile_presets_get(dv_ind, 0, &status); - CHK_ERR_ASRT(ret) + CHK_ERR_ASRT(ret); ASSERT_EQ(status.current, new_prof); - ret = rsmi_dev_perf_level_set(dv_ind, RSMI_DEV_PERF_LEVEL_AUTO); - CHK_ERR_ASRT(ret) - - ret = rsmi_dev_perf_level_get(dv_ind, &pfl); - CHK_ERR_ASRT(ret) - ASSERT_EQ(pfl, RSMI_DEV_PERF_LEVEL_AUTO); - - ret = rsmi_dev_power_profile_presets_get(dv_ind, 0, &status); - CHK_ERR_ASRT(ret) - - ASSERT_EQ(status.current, orig_profile); + // Restore original power profile and performance level + // assertion check not necessary because we are restoring the original state + rsmi_dev_perf_level_set(dv_ind, RSMI_DEV_PERF_LEVEL_AUTO); + rsmi_dev_power_profile_set(dv_ind, 0, orig_profile); } }