[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 <Bindhiya.KanangotBalakrishnan@amd.com>
This commit is contained in:
Kanangot Balakrishnan, Bindhiya
2025-07-09 16:38:09 -05:00
committed by GitHub
parent 514517e536
commit f6b854b4ed
4 changed files with 16 additions and 9 deletions
+4
View File
@@ -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.
+7 -6
View File
@@ -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:
+4 -2
View File
@@ -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)
+1 -1
View File
@@ -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: