[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 <Gabriel.Pham@amd.com>

[ROCm/amdsmi commit: 954d4860c1]
This commit is contained in:
Pham, Gabriel
2025-09-09 16:11:07 -05:00
committed by GitHub
parent 1a36f2ad0b
commit e9ee0bccf2
3 changed files with 8 additions and 21 deletions
+3
View File
@@ -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
+1 -12
View File
@@ -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()
@@ -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);
}
}