From 4ac1c7e45318458b67d183ccf38e972713d30dbd Mon Sep 17 00:00:00 2001 From: "Pryor, Adam" Date: Thu, 21 Aug 2025 16:45:37 -0500 Subject: [PATCH] [SWDEV-540665] Fix power_caps in help text (#642) Signed-off-by: adapryor --- amdsmi_cli/amdsmi_helpers.py | 8 +++++++- amdsmi_cli/amdsmi_parser.py | 4 +++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/amdsmi_cli/amdsmi_helpers.py b/amdsmi_cli/amdsmi_helpers.py index ac7bdafd5f..b199bb775f 100755 --- a/amdsmi_cli/amdsmi_helpers.py +++ b/amdsmi_cli/amdsmi_helpers.py @@ -821,8 +821,14 @@ class AMDSMIHelpers(): power_cap_min = power_cap_info['min_power_cap'] except amdsmi_interface.AmdSmiLibraryException as e: logging.debug(f"AMDSMIHelpers.get_power_caps - Unable to get power cap info for device {dev}: {str(e)}") - power_cap_min, power_cap_max = "N/A", "N/A" continue + + # If we never found a real min or max, set them to N/A + if power_cap_min == amdsmi_interface.MaxUIntegerTypes.UINT64_T: + power_cap_min = "N/A" + if power_cap_max == 0: + power_cap_max = "N/A" + return (power_cap_min, power_cap_max) diff --git a/amdsmi_cli/amdsmi_parser.py b/amdsmi_cli/amdsmi_parser.py index 634b69cd2d..9ff81e05d5 100644 --- a/amdsmi_cli/amdsmi_parser.py +++ b/amdsmi_cli/amdsmi_parser.py @@ -1228,9 +1228,11 @@ class AMDSMIParser(argparse.ArgumentParser): power_cap_min, power_cap_max = self.helpers.get_power_caps() if power_cap_max != "N/A": power_cap_max = self.helpers.convert_SI_unit(power_cap_max, AMDSMIHelpers.SI_Unit.MICRO) + power_cap_max = str(power_cap_max) + ' W' if power_cap_min != "N/A": power_cap_min = self.helpers.convert_SI_unit(power_cap_min, AMDSMIHelpers.SI_Unit.MICRO) - set_power_cap_help = f"Set power capacity limit:\n\tmin cap: {power_cap_min} W, max cap: {power_cap_max} W" + power_cap_min = str(power_cap_min) + ' W' + set_power_cap_help = f"Set power capacity limit:\n\tmin cap: {power_cap_min}, max cap: {power_cap_max}" set_clk_limit_help = "Sets the sclk (aka gfxclk) or mclk minimum and maximum frequencies. \n\tex: amd-smi set -L (sclk | mclk) (min | max) value" set_process_isolation_help = "Enable or disable the GPU process isolation on a per partition basis: 0 for disable and 1 for enable.\n"