From 6d48418cd474b4231702e75171267e4dfe1c0640 Mon Sep 17 00:00:00 2001 From: Ori Messinger Date: Thu, 5 Jan 2023 11:53:04 -0500 Subject: [PATCH] ROCm SMI CLI: Fix --showproductname bugs This patch fixes a couple of --showproductname bugs, both of which are related to the device's SKU. Previously if a device with a non-standard VBIOS name was used, fetching that device's SKU wasn't working correctly. A standard VBIOS name should follow the following pattern: AAA-BBBBBB-CCC Where the middle section "BBBBBB" between the hypens is the SKU. Now, SKU can be correctly fetched even with a non-standard VBIOS name, and return 'unkown' if SKU does not exist. Signed-off-by: Ori Messinger Change-Id: I5899a859c6131c6048bb31a4305ddacbac3075a9 [ROCm/amdsmi commit: 5c478e9eb90a9ec10942fc6567d506c8e6d6c51b] --- projects/amdsmi/python_smi_tools/rocm_smi.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/projects/amdsmi/python_smi_tools/rocm_smi.py b/projects/amdsmi/python_smi_tools/rocm_smi.py index 2b5e4eb0bb..6c0385a45a 100755 --- a/projects/amdsmi/python_smi_tools/rocm_smi.py +++ b/projects/amdsmi/python_smi_tools/rocm_smi.py @@ -2033,8 +2033,11 @@ def showProductName(deviceList): # Retrieve the device SKU as a substring from VBIOS ret = rocmsmi.rsmi_dev_vbios_version_get(device, vbios, 256) if rsmi_ret_ok(ret, device) and vbios.value.decode(): - # Device SKU is just 6 characters after the first occurance of '-' in vbios_version - device_sku = vbios.value.decode().split('-')[1][:6] + # Device SKU is just the characters in between the two '-' in vbios_version + if vbios.value.decode().count('-') == 2 and len(str(vbios.value.decode().split('-')[1])) > 1: + device_sku = vbios.value.decode().split('-')[1] + else: + device_sku = 'unknown' printLog(device, 'Card SKU', '\t\t' + device_sku) else: printLog(device, 'Incompatible device.\n' \