From e9ee0bccf2c8271fe262bb389cc3c4710e1510fd Mon Sep 17 00:00:00 2001 From: "Pham, Gabriel" Date: Tue, 9 Sep 2025 16:11:07 -0500 Subject: [PATCH] [SWDEV-551309] Adjusted amdsmitst and reset command (#654) * Adjusted amdsmitst and reset command to account for separation of power profile and perf level behavior * Updated test to reset power profile to previous user setting * Removed performance level from reset_profile_results in reset --profile command * Updated Changelog with change to reset profile behavior --------- Signed-off-by: gabrpham_amdeng [ROCm/amdsmi commit: 954d4860c1085689e6cc792e6ec75c7ae2cb16dc] --- projects/amdsmi/CHANGELOG.md | 3 +++ projects/amdsmi/amdsmi_cli/amdsmi_commands.py | 13 +------------ .../amd_smi_test/functional/power_read_write.cc | 13 ++++--------- 3 files changed, 8 insertions(+), 21 deletions(-) diff --git a/projects/amdsmi/CHANGELOG.md b/projects/amdsmi/CHANGELOG.md index ef1a02542b..2e48898768 100644 --- a/projects/amdsmi/CHANGELOG.md +++ b/projects/amdsmi/CHANGELOG.md @@ -139,6 +139,9 @@ GPU: 0 ### Changed +- **Changed `amd-smi reset --profile` behavior so that it would not also reset the performance level**. + - These settings are completely independent now so there is no longer any need to reset them together. Therefore the reset behavior for performance level has been removed from resetting the profile. Users can still reset the performance level as they normally would using `amd-smi reset --perf-determinism`. + ### Removed ### Optimized diff --git a/projects/amdsmi/amdsmi_cli/amdsmi_commands.py b/projects/amdsmi/amdsmi_cli/amdsmi_commands.py index 046878f619..8f9af79095 100644 --- a/projects/amdsmi/amdsmi_cli/amdsmi_commands.py +++ b/projects/amdsmi/amdsmi_cli/amdsmi_commands.py @@ -5401,8 +5401,7 @@ class AMDSMICommands(): self.logger.clear_multiple_devices_output() return if args.profile: - reset_profile_results = {'power_profile' : 'N/A', - 'performance_level': 'N/A'} + reset_profile_results = {'power_profile' : 'N/A'} try: power_profile_mask = amdsmi_interface.AmdSmiPowerProfilePresetMasks.BOOTUP_DEFAULT amdsmi_interface.amdsmi_set_gpu_power_profile(args.gpu, 0, power_profile_mask) @@ -5412,16 +5411,6 @@ class AMDSMICommands(): raise PermissionError('Command requires elevation') from e reset_profile_results['power_profile'] = f"[{e.get_error_info(detailed=False)}] Unable to reset Power Profile to default (bootup default)" logging.debug("Failed to reset power profile on gpu %s | %s", gpu_id, e.get_error_info()) - # Attempt to reset performance level even if power profile fails - try: - level_auto = amdsmi_interface.AmdSmiDevPerfLevel.AUTO - amdsmi_interface.amdsmi_set_gpu_perf_level(args.gpu, level_auto) - reset_profile_results['performance_level'] = 'Successfully reset Performance Level to default (auto)' - except amdsmi_exception.AmdSmiLibraryException as e: - if e.get_error_code() == amdsmi_interface.amdsmi_wrapper.AMDSMI_STATUS_NO_PERM: - raise PermissionError('Command requires elevation') from e - reset_profile_results['performance_level'] = f"[{e.get_error_info(detailed=False)}] Unable to reset Performance Level to default (auto)" - logging.debug("Failed to reset perf level on gpu %s | %s", gpu_id, e.get_error_info()) self.logger.store_output(args.gpu, 'reset_profile', reset_profile_results) self.logger.print_output() diff --git a/projects/amdsmi/tests/amd_smi_test/functional/power_read_write.cc b/projects/amdsmi/tests/amd_smi_test/functional/power_read_write.cc index aa746b9278..b15d51c80a 100644 --- a/projects/amdsmi/tests/amd_smi_test/functional/power_read_write.cc +++ b/projects/amdsmi/tests/amd_smi_test/functional/power_read_write.cc @@ -162,16 +162,11 @@ void TestPowerReadWrite::Run(void) { ASSERT_EQ(status.current, new_prof); + // Reset the state of perf level and power profile after testing ret = amdsmi_set_gpu_perf_level(processor_handles_[dv_ind], AMDSMI_DEV_PERF_LEVEL_AUTO); - CHK_ERR_ASRT(ret) + CHK_ERR_ASRT(ret); - ret = amdsmi_get_gpu_perf_level(processor_handles_[dv_ind], &pfl); - CHK_ERR_ASRT(ret) - ASSERT_EQ(pfl, AMDSMI_DEV_PERF_LEVEL_AUTO); - - ret = amdsmi_get_gpu_power_profile_presets(processor_handles_[dv_ind], 0, &status); - CHK_ERR_ASRT(ret) - - ASSERT_EQ(status.current, orig_profile); + ret = amdsmi_set_gpu_power_profile(processor_handles_[dv_ind], 0, orig_profile); + CHK_ERR_ASRT(ret); } }