From f6b854b4ed9640726710a16f378ee204d098f2fd Mon Sep 17 00:00:00 2001 From: "Kanangot Balakrishnan, Bindhiya" Date: Wed, 9 Jul 2025 16:38:09 -0500 Subject: [PATCH] [SWDEV-541289] Update violation argument in amd-smi (#526) * Disabled violation argument for monitor on guests as it is supported on BM only. * Added `-v` and `--violation` args to metric along with `throttle` due to legacy behavior. * Supressed metric throttle arg and do not show in help text --------- Signed-off-by: Bindhiya Kanangot Balakrishnan --- CHANGELOG.md | 4 ++++ amdsmi_cli/amdsmi_commands.py | 13 +++++++------ amdsmi_cli/amdsmi_parser.py | 6 ++++-- docs/how-to/amdsmi-cli-tool.md | 2 +- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 338c2799ec..de32d5b9e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -87,6 +87,10 @@ Full documentation for amd_smi_lib is available at [https://rocm.docs.amd.com/pr ### Changed +- **Modified `amd-smi` CLI `monitor` and `metric` for violations**. + - Disabled `amd-smi monitor --violation` on guests. + - Modified `amd-smi metric -T/--throttle` to alias to `amd-smi metric -v/--violation`. + - **Updated `amdsmi_get_clock_info` in `amdsmi_interface.py`**. - The `clk_deep_sleep` field now returns the sleep integer value. diff --git a/amdsmi_cli/amdsmi_commands.py b/amdsmi_cli/amdsmi_commands.py index 23e92a677b..de59121fda 100644 --- a/amdsmi_cli/amdsmi_commands.py +++ b/amdsmi_cli/amdsmi_commands.py @@ -1465,7 +1465,7 @@ class AMDSMICommands(): guest_data (bool, optional): Value override for args.guest_data. Defaults to None. fb_usage (bool, optional): Value override for args.fb_usage. Defaults to None. xgmi (bool, optional): Value override for args.xgmi. Defaults to None. - throttle (bool, optional): Value override for args.throttle. Defaults to None. + throttle (bool, optional): Value override for args.violation. Defaults to None. Raises: IndexError: Index error if gpu list is empty @@ -1527,11 +1527,11 @@ class AMDSMICommands(): if energy: args.energy = energy if throttle: - args.throttle = throttle + args.violation = throttle current_platform_args += ["fan", "voltage_curve", "overdrive", "perf_level", "xgmi_err", "energy", "throttle"] current_platform_values += [args.fan, args.voltage_curve, args.overdrive, - args.perf_level, args.xgmi_err, args.energy, args.throttle, + args.perf_level, args.xgmi_err, args.energy, args.violation, ] if self.helpers.is_hypervisor(): @@ -2556,7 +2556,7 @@ class AMDSMICommands(): values_dict['mem_usage'] = memory_usage if "throttle" in current_platform_args: - if args.throttle: + if args.violation: throttle_status = { # Current values - counter/accumulated 'accumulation_counter': "N/A", @@ -5323,8 +5323,9 @@ class AMDSMICommands(): args.pcie = pcie if process: args.process = process - if violation: - args.violation = violation + if not self.helpers.is_virtual_os(): + if violation: + args.violation = violation # Handle No GPU passed if args.gpu == None: diff --git a/amdsmi_cli/amdsmi_parser.py b/amdsmi_cli/amdsmi_parser.py index b2b0e178a0..0cab2074e8 100644 --- a/amdsmi_cli/amdsmi_parser.py +++ b/amdsmi_cli/amdsmi_parser.py @@ -994,7 +994,8 @@ class AMDSMIParser(argparse.ArgumentParser): metric_parser.add_argument('-l', '--perf-level', action='store_true', required=False, help=perf_level_help) metric_parser.add_argument('-x', '--xgmi-err', action='store_true', required=False, help=xgmi_err_help) metric_parser.add_argument('-E', '--energy', action='store_true', required=False, help=energy_help) - metric_parser.add_argument('-T', '--throttle', action='store_true', required=False, help=throttle_help) + metric_parser.add_argument('-v', '--violation', action='store_true', required=False, help=throttle_help) + metric_parser.add_argument('-T', '--throttle', dest='violation', action='store_true', required=False, help=argparse.SUPPRESS) # Options to only display to Hypervisors if self.helpers.is_hypervisor(): @@ -1377,7 +1378,8 @@ class AMDSMIParser(argparse.ArgumentParser): monitor_parser.add_argument('-v', '--vram-usage', action='store_true', required=False, help=mem_usage_help) monitor_parser.add_argument('-r', '--pcie', action='store_true', required=False, help=pcie_bandwidth_help) monitor_parser.add_argument('-q', '--process', action='store_true', required=False, help=process_help) - monitor_parser.add_argument('-V', '--violation', action='store_true', required=False, help=violation_help) + if not self.helpers.is_virtual_os(): + monitor_parser.add_argument('-V', '--violation', action='store_true', required=False, help=violation_help) # Add Universal Arguments & Watch Args self._add_watch_arguments(monitor_parser) diff --git a/docs/how-to/amdsmi-cli-tool.md b/docs/how-to/amdsmi-cli-tool.md index 9631c15dcb..edb975ea5d 100644 --- a/docs/how-to/amdsmi-cli-tool.md +++ b/docs/how-to/amdsmi-cli-tool.md @@ -313,7 +313,7 @@ Metric arguments: -l, --perf-level Current DPM performance level -x, --xgmi-err XGMI error information since last read -E, --energy Amount of energy consumed - -T, --throttle Displays throttle accumulators; + -v, --violation Displays throttle accumulators; Only available for MI300 or newer ASICs Watch Arguments: