From 79ce271d1fa1e89f747e73a7c49ef9ffc2e5def9 Mon Sep 17 00:00:00 2001 From: Charis Poag Date: Thu, 7 Aug 2025 10:39:55 -0500 Subject: [PATCH] Fix amd-smi sets attribute error & memory partition sets * Changes: - Fix for any set without CPU loaded (ex.): sudo /opt/rocm/bin/amd-smi set -o 250 AttributeError: 'Namespace' object has no attribute 'core_boost_limit' - Fix for recent changes to memory partition sets Needed to account for permission denied -> to display not supported. EACCESS == *_STATUS_PERMISSION, but in this case need to show NOT_SUPPORTED Change-Id: Ie00bbb34d01adfe38300f1ac4c1620d78885b9b7 Signed-off-by: Charis Poag [ROCm/amdsmi commit: e7964cda49794d4310a6ae77c0c1217b0c681a03] --- projects/amdsmi/amdsmi_cli/amdsmi_commands.py | 18 +++++++++++------- projects/amdsmi/rocm_smi/src/rocm_smi.cc | 2 +- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/projects/amdsmi/amdsmi_cli/amdsmi_commands.py b/projects/amdsmi/amdsmi_cli/amdsmi_commands.py index f0ead15102..305b305f5d 100644 --- a/projects/amdsmi/amdsmi_cli/amdsmi_commands.py +++ b/projects/amdsmi/amdsmi_cli/amdsmi_commands.py @@ -5001,6 +5001,9 @@ class AMDSMICommands(): # Error if no subcommand args are passed if self.helpers.is_baremetal(): + is_gpu_set = False + is_cpu_set = False + is_core_set = False try: is_gpu_set = any([ args.gpu is not None, @@ -5019,7 +5022,7 @@ class AMDSMICommands(): ]) except AttributeError: # If attribute error for gpu, then we could be another subcommand - is_gpu_set = False + pass try: is_cpu_set = any([ @@ -5037,12 +5040,13 @@ class AMDSMICommands(): ]) except AttributeError: # If attribute error for cpu, then we could be another subcommand - is_cpu_set = False - - if args.core_boost_limit: - is_core_set = True - else: - is_core_set = False + pass + try: + if args.core_boost_limit: + is_core_set = True + except AttributeError: + # If attribute error for core, then we could be another subcommand + pass if not (is_gpu_set or is_cpu_set or is_core_set): # if neither GPU / CPU / or Core args are provided, then raise error message diff --git a/projects/amdsmi/rocm_smi/src/rocm_smi.cc b/projects/amdsmi/rocm_smi/src/rocm_smi.cc index db95372899..e735f4c204 100644 --- a/projects/amdsmi/rocm_smi/src/rocm_smi.cc +++ b/projects/amdsmi/rocm_smi/src/rocm_smi.cc @@ -6661,7 +6661,7 @@ rsmi_dev_memory_partition_set(uint32_t dv_ind, rsmi_status_t status = amd::smi::ErrnoToRsmiStatus(ret); if (status != RSMI_STATUS_SUCCESS) { - if (status == EACCES) { + if (status == RSMI_STATUS_PERMISSION) { status = RSMI_STATUS_NOT_SUPPORTED; // already verified permissions } ss << __PRETTY_FUNCTION__