From f9ad5fe706c4eb6d3d68705e2ae160c62a897259 Mon Sep 17 00:00:00 2001 From: Ori Messinger Date: Thu, 2 Feb 2023 14:27:02 -0500 Subject: [PATCH] ROCm SMI CLI: Fix --showproductname bug This patch fixes a --showproductname bug, which is related to the device's SKU. If a device with a VBIOS value that cannot be decoded is used, that device's SKU cannot be parsed out of the VBIOS string. Now, when the VBIOS value cannot be decoded, an error will be printed instead of crashing with an 'UnboundLocalError' message. Signed-off-by: Ori Messinger Change-Id: I680a182e94107e782235b8a2477ab165988f7703 [ROCm/amdsmi commit: 56f9d6bfc0ea04020084b5dffa2d80bfe9b62c4b] --- projects/amdsmi/python_smi_tools/rocm_smi.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/amdsmi/python_smi_tools/rocm_smi.py b/projects/amdsmi/python_smi_tools/rocm_smi.py index 8a5c664bb6..5e6d2f2cdf 100755 --- a/projects/amdsmi/python_smi_tools/rocm_smi.py +++ b/projects/amdsmi/python_smi_tools/rocm_smi.py @@ -2069,7 +2069,9 @@ def showProductName(deviceList): device_sku = vbios.value.decode().split('-')[1] else: device_sku = 'unknown' - printLog(device, 'Card SKU', '\t\t' + device_sku) + printLog(device, 'Card SKU', '\t\t' + device_sku) + else: + printErrLog(device, "Unable to decode VBIOS value for device SKU") else: printLog(device, 'Incompatible device.\n' \ 'GPU[%s]\t\t: Expected vendor name: Advanced Micro Devices, Inc. [AMD/ATI]\n' \