From 273ab71c38b938cea97f2045462f850ff987d8b0 Mon Sep 17 00:00:00 2001 From: Ori Messinger Date: Tue, 10 Nov 2020 19:55:22 -0500 Subject: [PATCH] ROCm SMI Python CLI: GPU showproductname SKU Fix The purpose of this patch is to fix a bug present when using the --showproducname option, resulting in the following error: undefined symbol: rsmi_dev_sku_get This bug fix uses a substring from vbios version instead of using the LIB's rsmi_dev_sku_get to avoid getting the undefined symbol error. Change-Id: I56d72a481d5dde44c56106ae297f4bcff40ac15f Signed-off-by: Ori Messinger [ROCm/amdsmi commit: 015c7d59d026cc25e77b5219d0ca259d3f6cd709] --- projects/amdsmi/python_smi_tools/rocm_smi.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/projects/amdsmi/python_smi_tools/rocm_smi.py b/projects/amdsmi/python_smi_tools/rocm_smi.py index 9e8c77e1c8..e02e295711 100755 --- a/projects/amdsmi/python_smi_tools/rocm_smi.py +++ b/projects/amdsmi/python_smi_tools/rocm_smi.py @@ -1686,6 +1686,7 @@ def showProductName(deviceList): model = create_string_buffer(256) vendor = create_string_buffer(256) vbios = create_string_buffer(256) + # sku = create_string_buffer(256) printLogSpacer(' Product Info ') for device in deviceList: # Retrieve card vendor @@ -1704,14 +1705,15 @@ def showProductName(deviceList): device_model = model.value.decode() printLog(device, 'Card model', '\t\t' + device_model) printLog(device, 'Card vendor', '\t\t' + device_vendor) - # Retrieve the SKU - ret = rocmsmi.rsmi_dev_sku_get(device, device_sku, 256) - if not rsmi_ret_ok(ret, device) or not device_sku.value.decode(): - # Retrieve the device SKU from VBIOS if product_number doesn't exist - 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] + # TODO: Retrieve the SKU using 'rsmi_dev_sku_get' from the LIB + # ret = rocmsmi.rsmi_dev_sku_get(device, sku, 256) + # if rsmi_ret_ok(ret, device) and sku.value.decode(): + # device_sku = sku.value.decode() + # 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] printLog(device, 'Card SKU', '\t\t' + device_sku) else: printLog(device, 'Incompatible device.\n' \