From 2ea49b6b330b749ff78ac4fef0748c226e0cea62 Mon Sep 17 00:00:00 2001 From: "Arif, Maisam" Date: Tue, 1 Apr 2025 11:21:56 -0500 Subject: [PATCH] [SWDEV-520754] Fixed unboundLocalError for Mulit-VF (#225) Change-Id: Ib1c0826342a5882fde6ddd4f06f058462226b82d Signed-off-by: Maisam Arif [ROCm/amdsmi commit: 307de69149ef2af6372309c51107dd22844aedb0] --- projects/amdsmi/amdsmi_cli/amdsmi_commands.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/projects/amdsmi/amdsmi_cli/amdsmi_commands.py b/projects/amdsmi/amdsmi_cli/amdsmi_commands.py index 1612ed345b..ad5f58f7f9 100644 --- a/projects/amdsmi/amdsmi_cli/amdsmi_commands.py +++ b/projects/amdsmi/amdsmi_cli/amdsmi_commands.py @@ -1516,7 +1516,7 @@ class AMDSMICommands(): gpu_metric_version_str = json.dumps(gpu_metric_version_info, indent=4) logging.debug("GPU Metrics table Version for GPU %s | %s", gpu_id, gpu_metric_version_str) except amdsmi_exception.AmdSmiLibraryException as e: - logging.debug("Unable to load GPU Metrics table version for %s | %s", gpu_id, e.err_info) + logging.debug("Unable to load GPU Metrics table version for GPU %s | %s", gpu_id, e.err_info) try: # Get GPU Metrics table @@ -1844,7 +1844,7 @@ class AMDSMICommands(): clocks[gfx_index]["clk_locked"] = "ENABLED" else: clocks[gfx_index]["clk_locked"] = "DISABLED" - except KeyError as e: + except Exception as e: logging.debug("Failed to get current_gfxclks for gpu %s | %s", gpu_id, e) # Populate MEM clock value @@ -1854,7 +1854,7 @@ class AMDSMICommands(): clocks["mem_0"]["clk"] = self.helpers.unit_format(self.logger, current_mem_clock, clock_unit) - except KeyError as e: + except Exception as e: logging.debug("Failed to get current_uclk for gpu %s | %s", gpu_id, e) # Populate VCLK clock values @@ -1869,7 +1869,7 @@ class AMDSMICommands(): clocks[vclk_index]["clk"] = self.helpers.unit_format(self.logger, current_vclk_clock, clock_unit) - except KeyError as e: + except Exception as e: logging.debug("Failed to get current_vclk0s for gpu %s | %s", gpu_id, e) # Populate DCLK clock values @@ -1884,7 +1884,7 @@ class AMDSMICommands(): clocks[dclk_index]["clk"] = self.helpers.unit_format(self.logger, current_dclk_clock, clock_unit) - except KeyError as e: + except Exception as e: logging.debug("Failed to get current_dclk0s for gpu %s | %s", gpu_id, e) # Populate FCLK clock value; fclk not present in gpu_metrics so use amdsmi_get_clk_freq @@ -1904,7 +1904,7 @@ class AMDSMICommands(): clocks["socclk_0"]["clk"] = self.helpers.unit_format(self.logger, current_socclk_clock, clock_unit) - except KeyError as e: + except Exception as e: logging.debug("Failed to get current_socclk for gpu %s | %s", gpu_id, e) # Populate the max and min clock values from sysfs @@ -5063,7 +5063,7 @@ class AMDSMICommands(): gpu_metric_version_str = json.dumps(gpu_metric_version_info, indent=4) logging.debug("GPU Metrics table Version for GPU %s | %s", gpu_id, gpu_metric_version_str) except amdsmi_exception.AmdSmiLibraryException as e: - logging.debug("Unable to load GPU Metrics table version for %s | %s", gpu_id, e.err_info) + logging.debug("Unable to load GPU Metrics table version for GPU %s | %s", gpu_id, e.err_info) try: # Get GPU Metrics table