[SWDEV-498649] Fix reset cli AttributeError (#2203)

* Fix SWDEV-498649: Handle missing attributes safely in set_gpu

---------

Co-authored-by: gabrpham <Gabriel.Pham@amd.com>
Co-authored-by: Maisam Arif <Maisam.Arif@amd.com>
This commit is contained in:
koushikbillakanti-amd
2026-01-28 22:39:50 -06:00
zatwierdzone przez GitHub
rodzic 19725abbf4
commit e9b143323a
2 zmienionych plików z 20 dodań i 18 usunięć
+3 -1
Wyświetl plik
@@ -90,7 +90,9 @@ Full documentation for amd_smi_lib is available at [https://rocm.docs.amd.com/pr
### Resolved Issues
- N/A
- **Fixed `amd-smi set` commands showing an AttributeError when partition attributes are not present**.
- Resolved `AttributeError: 'Namespace' object has no attribute 'compute_partition'` error
- Now using safe `getattr()` access pattern for optional arguments in set_gpu function
## amd_smi_lib for ROCm 7.2.0
@@ -4727,26 +4727,26 @@ class AMDSMICommands():
# Error if no subcommand args are passed
if self.helpers.is_baremetal():
if not any([args.fan is not None,
args.perf_level,
args.profile,
args.compute_partition,
args.memory_partition,
args.perf_determinism is not None,
args.power_cap is not None,
args.soc_pstate is not None,
args.xgmi_plpd is not None,
args.clk_level is not None,
args.clk_limit is not None,
args.ptl_status is not None,
args.ptl_format is not None,
args.process_isolation is not None]):
if not any([getattr(args, 'fan', None) is not None,
getattr(args, 'perf_level', None) is not None,
getattr(args, 'profile', None) is not None,
getattr(args, 'compute_partition', None) is not None,
getattr(args, 'memory_partition', None) is not None,
getattr(args, 'perf_determinism', None) is not None,
getattr(args, 'power_cap', None) is not None,
getattr(args, 'soc_pstate', None) is not None,
getattr(args, 'xgmi_plpd', None) is not None,
getattr(args, 'clk_level', None) is not None,
getattr(args, 'clk_limit', None) is not None,
getattr(args, 'ptl_status', None) is not None,
getattr(args, 'ptl_format', None) is not None,
getattr(args, 'process_isolation', None) is not None]):
command = " ".join(sys.argv[1:])
raise AmdSmiRequiredCommandException(command, self.logger.format)
else:
if not any([args.power_cap is not None,
args.clk_limit is not None,
args.process_isolation is not None]):
if not any([getattr(args, 'power_cap', None) is not None,
getattr(args, 'clk_limit', None) is not None,
getattr(args, 'process_isolation', None) is not None]):
command = " ".join(sys.argv[1:])
raise AmdSmiRequiredCommandException(command, self.logger.format)