From 933fdc3c7e3e8478e71c8d996f9b92fc5a7268ac Mon Sep 17 00:00:00 2001 From: Charis Poag Jones <149186100+charis-poag-amd@users.noreply.github.com> Date: Thu, 23 Oct 2025 08:56:41 -0500 Subject: [PATCH] [SWDEV-558141] Fix rocm-smi --setsclk [0...n] & other clocks in partitioned configurations (#1493) Changes: - Fix `rocm-smi --setsclk [0 .. n]` for multiple devices to continue on fail when in a partitioned configuration (ex. in DPX/QPX/CPX/etc). - Partitioned configurations or devices which do not support changing sclk/mclk/pcie clks will now continue on failure. Will report a "not supported" or other (rocm-smi) error codes for these devices. - Updates impact other clock settings such as `--setmclk` and `--setpcie`. Signed-off-by: Charis Poag --- projects/rocm-smi-lib/python_smi_tools/rocm_smi.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/projects/rocm-smi-lib/python_smi_tools/rocm_smi.py b/projects/rocm-smi-lib/python_smi_tools/rocm_smi.py index 6eb22a2dc4..408a69ae31 100755 --- a/projects/rocm-smi-lib/python_smi_tools/rocm_smi.py +++ b/projects/rocm-smi-lib/python_smi_tools/rocm_smi.py @@ -1414,20 +1414,20 @@ def setClocks(deviceList, clktype, clk): printLog(device, 'Performance level was set to manual', None) else: RETCODE = 1 - return + continue if clktype != 'pcie': # Validate frequency bitmask freq = rsmi_frequencies_t() ret = rocmsmi.rsmi_dev_gpu_clk_freq_get(device, rsmi_clk_names_dict[clktype], byref(freq)) if not rsmi_ret_ok(ret, device, 'get_gpu_clk_freq_' + str(clktype)): RETCODE = 1 - return + continue # The freq_bitmask should be less than 2^(freqs.num_supported) # For example, num_supported == 3, the max bitmask is 0111 if freq_bitmask >= (1 << freq.num_supported): printErrLog(device, 'Invalid clock frequency %s' % hex(freq_bitmask)) RETCODE = 1 - return + continue ret = rocmsmi.rsmi_dev_gpu_clk_freq_set(device, rsmi_clk_names_dict[clktype], freq_bitmask) if rsmi_ret_ok(ret, device, 'set_gpu_clk_freq_' + str(clktype)): @@ -1440,19 +1440,20 @@ def setClocks(deviceList, clktype, clk): ret = rocmsmi.rsmi_dev_pci_bandwidth_get(device, byref(bw)) if not rsmi_ret_ok(ret, device, 'get_PCIe_bandwidth'): RETCODE = 1 - return + continue # The freq_bitmask should be less than 2^(bw.transfer_rate.num_supported) # For example, num_supported == 3, the max bitmask is 0111 if freq_bitmask >= (1 << bw.transfer_rate.num_supported): printErrLog(device, 'Invalid PCIe frequency %s' % hex(freq_bitmask)) RETCODE = 1 - return + continue ret = rocmsmi.rsmi_dev_pci_bandwidth_set(device, freq_bitmask) if rsmi_ret_ok(ret, device, 'set_PCIe_bandwidth'): printLog(device, 'Successfully set %s to level bitmask' % (clktype), hex(freq_bitmask)) else: RETCODE = 1 + continue printLogSpacer()