From 33320d6e1a4ac833b9cb746621005509ecddadd3 Mon Sep 17 00:00:00 2001 From: Elena Sakhnovitch Date: Fri, 29 Apr 2022 16:41:06 -0400 Subject: [PATCH 1/3] [rocm_smi.py] Hide unsupported clocks under debug Signed-off-by: Elena Sakhnovitch Change-Id: I1f2c7b93d9a81f2735c76e8d441f9e298288f5c0 [ROCm/rocm_smi_lib commit: 9d7fd34d2b721aca28a0fdb568bc97f120d827c4] --- projects/rocm-smi-lib/python_smi_tools/rocm_smi.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 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 0271e40ea0..48821adc29 100755 --- a/projects/rocm-smi-lib/python_smi_tools/rocm_smi.py +++ b/projects/rocm-smi-lib/python_smi_tools/rocm_smi.py @@ -1417,7 +1417,7 @@ def showClocks(deviceList): printLog(device, str(x), str(fr)) printLog(device, '', None) else: - printErrLog(device, '%s frequency is unsupported' % (clk_type)) + logging.debug('{} frequency is unsupported on device[{}]'.format(clk_type, device)) printLog(device, '', None) if rocmsmi.rsmi_dev_pci_bandwidth_get(device, None) == 1: ret = rocmsmi.rsmi_dev_pci_bandwidth_get(device, byref(bw)) @@ -1432,7 +1432,7 @@ def showClocks(deviceList): printLog(device, str(x), str(fr)) printLog(device, '', None) else: - printErrLog(device, 'PCIe frequency is unsupported') + logging.debug('PCIe frequency is unsupported on device [{}]'.format(device)) printLog(device, '', None) printLogSpacer(None, '-') # divider between devices for better visibility printLogSpacer() @@ -1481,7 +1481,7 @@ def showCurrentClocks(deviceList, clk_defined=None, concise=False): else: printLog(device, '%s clock level: %s' % (clk_type, levl), '(%sMhz)' % (str(fr)[:-2])) else: - printErrLog(device, '%s clock is unsupported' % (clk_type)) + logging.debug('{} clock is unsupported on device[{}]'.format(clk_type, device)) # pcie clocks if rocmsmi.rsmi_dev_pci_bandwidth_get(device, None) == 1: ret = rocmsmi.rsmi_dev_pci_bandwidth_get(device, byref(bw)) @@ -1491,7 +1491,7 @@ def showCurrentClocks(deviceList, clk_defined=None, concise=False): bw.lanes[current_f]) printLog(device, 'pcie clock level', '{} ({})'.format(current_f, fr)) else: - printErrLog(device, 'PCIe clock is unsupported') + logging.debug('PCIe clock is unsupported on device[{}]'.format(device)) printLogSpacer() From 2a06a86b090549ad367bee625273d2fe5f941e62 Mon Sep 17 00:00:00 2001 From: Elena Sakhnovitch Date: Fri, 29 Apr 2022 16:52:13 -0400 Subject: [PATCH 2/3] Revert "rocm_smi.py: Don't try to print absent clock files" This reverts commit 2ba625e569279f299e5494c93809c09e4e33ab79. DRM device id does not always match GPU ID in the rocm_smi.py. This leads to cases where wrong device is checked by os.path.isfile(). Change-Id: Ib6f2b9be123b7eb64334d3feec57f63d7eb37d6f [ROCm/rocm_smi_lib commit: be66d67ef2ba7061e0fc083e009e7ae8d3e6a381] --- projects/rocm-smi-lib/python_smi_tools/rocm_smi.py | 8 -------- 1 file changed, 8 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 48821adc29..5070994789 100755 --- a/projects/rocm-smi-lib/python_smi_tools/rocm_smi.py +++ b/projects/rocm-smi-lib/python_smi_tools/rocm_smi.py @@ -1401,10 +1401,6 @@ def showClocks(deviceList): for device in deviceList: for clk_type in sorted(rsmi_clk_names_dict): freq_list = [] - if not os.path.isfile( - os.path.join('/sys/class/drm', 'card%d' % (device), 'device', 'pp_dpm_%s' % clk_type)): - logging.debug('No clock file for %s on card%d' % (clk_type, device)) - continue if rocmsmi.rsmi_dev_gpu_clk_freq_get(device, rsmi_clk_names_dict[clk_type], None) == 1: ret = rocmsmi.rsmi_dev_gpu_clk_freq_get(device, rsmi_clk_names_dict[clk_type], byref(freq)) if rsmi_ret_ok(ret, device, clk_type, True): @@ -1466,10 +1462,6 @@ def showCurrentClocks(deviceList, clk_defined=None, concise=False): else: # if clk is not defined, will display all current clk for clk_type in sorted(rsmi_clk_names_dict): - if not os.path.isfile( - os.path.join('/sys/class/drm', 'card%d' % (device), 'device', 'pp_dpm_%s' % clk_type)): - logging.debug('No clock file for %s on card%d' % (clk_type, device)) - continue if rocmsmi.rsmi_dev_gpu_clk_freq_get(device, rsmi_clk_names_dict[clk_type], None) == 1: ret = rocmsmi.rsmi_dev_gpu_clk_freq_get(device, rsmi_clk_names_dict[clk_type], byref(freq)) if rsmi_ret_ok(ret, device, clk_type, True): From c5ac3ea7bde75a6ea9f2c5169d1492215ef75792 Mon Sep 17 00:00:00 2001 From: Ori Messinger Date: Tue, 3 May 2022 05:33:04 -0400 Subject: [PATCH 3/3] ROCm SMI LIB: Add Missing GPU Blocks This patch adds the following 4 missing GPU blocks to the SMI LIB: -RSMI_GPU_BLOCK_MMHUB -RSMI_GPU_BLOCK_PCIE_BIF -RSMI_GPU_BLOCK_HDP -RSMI_GPU_BLOCK_XGMI_WAFL Signed-off-by: Ori Messinger Change-Id: Ia1ec6f53e195f4bf7b8f073d6bed4fdb6572e546 [ROCm/rocm_smi_lib commit: 9d6403bb17647e89e0bb6f39257058db660f5016] --- .../include/rocm_smi/rocm_smi_device.h | 4 ++++ projects/rocm-smi-lib/oam/src/amd_oam.cc | 16 +++++++++++++++ projects/rocm-smi-lib/src/rocm_smi.cc | 16 +++++++++++++++ projects/rocm-smi-lib/src/rocm_smi_device.cc | 20 +++++++++++++++++++ 4 files changed, 56 insertions(+) diff --git a/projects/rocm-smi-lib/include/rocm_smi/rocm_smi_device.h b/projects/rocm-smi-lib/include/rocm_smi/rocm_smi_device.h index ad837bec8e..a21a64a9ce 100755 --- a/projects/rocm-smi-lib/include/rocm_smi/rocm_smi_device.h +++ b/projects/rocm-smi-lib/include/rocm_smi/rocm_smi_device.h @@ -118,6 +118,10 @@ enum DevInfoTypes { kDevErrCntSDMA, kDevErrCntUMC, kDevErrCntGFX, + kDevErrCntMMHUB, + kDevErrCntPCIEBIF, + kDevErrCntHDP, + kDevErrCntXGMIWAFL, kDevErrCntFeatures, kDevMemTotGTT, kDevMemTotVisVRAM, diff --git a/projects/rocm-smi-lib/oam/src/amd_oam.cc b/projects/rocm-smi-lib/oam/src/amd_oam.cc index 23023eebc8..1262fcc9e8 100755 --- a/projects/rocm-smi-lib/oam/src/amd_oam.cc +++ b/projects/rocm-smi-lib/oam/src/amd_oam.cc @@ -341,6 +341,22 @@ get_device_error_count(oam_dev_handle_t *handle, type = amd::smi::kDevErrCntGFX; break; + case RSMI_GPU_BLOCK_MMHUB: + type = amd::smi::kDevErrCntMMHUB; + break; + + case RSMI_GPU_BLOCK_PCIE_BIF: + type = amd::smi::kDevErrCntPCIEBIF; + break; + + case RSMI_GPU_BLOCK_HDP: + type = amd::smi::kDevErrCntHDP; + break; + + case RSMI_GPU_BLOCK_XGMI_WAFL: + type = amd::smi::kDevErrCntXGMIWAFL; + break; + default: return RSMI_STATUS_NOT_SUPPORTED; } diff --git a/projects/rocm-smi-lib/src/rocm_smi.cc b/projects/rocm-smi-lib/src/rocm_smi.cc index 4a8f550aa6..c8e521aac0 100755 --- a/projects/rocm-smi-lib/src/rocm_smi.cc +++ b/projects/rocm-smi-lib/src/rocm_smi.cc @@ -604,6 +604,22 @@ rsmi_dev_ecc_count_get(uint32_t dv_ind, rsmi_gpu_block_t block, type = amd::smi::kDevErrCntGFX; break; + case RSMI_GPU_BLOCK_MMHUB: + type = amd::smi::kDevErrCntMMHUB; + break; + + case RSMI_GPU_BLOCK_PCIE_BIF: + type = amd::smi::kDevErrCntPCIEBIF; + break; + + case RSMI_GPU_BLOCK_HDP: + type = amd::smi::kDevErrCntHDP; + break; + + case RSMI_GPU_BLOCK_XGMI_WAFL: + type = amd::smi::kDevErrCntXGMIWAFL; + break; + default: return RSMI_STATUS_NOT_SUPPORTED; } diff --git a/projects/rocm-smi-lib/src/rocm_smi_device.cc b/projects/rocm-smi-lib/src/rocm_smi_device.cc index 69dff42111..dc65816513 100755 --- a/projects/rocm-smi-lib/src/rocm_smi_device.cc +++ b/projects/rocm-smi-lib/src/rocm_smi_device.cc @@ -99,6 +99,10 @@ static const char *kDevPCIEThruPutFName = "pcie_bw"; static const char *kDevErrCntSDMAFName = "ras/sdma_err_count"; static const char *kDevErrCntUMCFName = "ras/umc_err_count"; static const char *kDevErrCntGFXFName = "ras/gfx_err_count"; +static const char *kDevErrCntMMHUBFName = "ras/mmhub_err_count"; +static const char *kDevErrCntPCIEBIFFName = "ras/pcie_bif_err_count"; +static const char *kDevErrCntHDPFName = "ras/hdp_err_count"; +static const char *kDevErrCntXGMIWAFLFName = "ras/xgmi_wafl_err_count"; static const char *kDevErrCntFeaturesFName = "ras/features"; static const char *kDevMemPageBadFName = "ras/gpu_vram_bad_pages"; static const char *kDevMemTotGTTFName = "mem_info_gtt_total"; @@ -241,6 +245,10 @@ static const std::map kDevAttribNameMap = { {kDevErrCntSDMA, kDevErrCntSDMAFName}, {kDevErrCntUMC, kDevErrCntUMCFName}, {kDevErrCntGFX, kDevErrCntGFXFName}, + {kDevErrCntMMHUB, kDevErrCntMMHUBFName}, + {kDevErrCntPCIEBIF, kDevErrCntPCIEBIFFName}, + {kDevErrCntHDP, kDevErrCntHDPFName}, + {kDevErrCntXGMIWAFL, kDevErrCntXGMIWAFLFName}, {kDevErrCntFeatures, kDevErrCntFeaturesFName}, {kDevMemTotGTT, kDevMemTotGTTFName}, {kDevMemTotVisVRAM, kDevMemTotVisVRAMFName}, @@ -339,6 +347,10 @@ static std::map kDevInfoVarTypeToRSMIVariant = { {kDevErrCntUMC, RSMI_GPU_BLOCK_UMC}, {kDevErrCntSDMA, RSMI_GPU_BLOCK_SDMA}, {kDevErrCntGFX, RSMI_GPU_BLOCK_GFX}, + {kDevErrCntMMHUB, RSMI_GPU_BLOCK_MMHUB}, + {kDevErrCntPCIEBIF, RSMI_GPU_BLOCK_PCIE_BIF}, + {kDevErrCntHDP, RSMI_GPU_BLOCK_HDP}, + {kDevErrCntXGMIWAFL, RSMI_GPU_BLOCK_XGMI_WAFL}, // rsmi_event_group_t {kDevDFCountersAvailable, RSMI_EVNT_GRP_XGMI} @@ -467,6 +479,10 @@ static const std::map kDevFuncDependsMap = { kDevErrCntUMC, kDevErrCntSDMA, kDevErrCntGFX, + kDevErrCntMMHUB, + kDevErrCntPCIEBIF, + kDevErrCntHDP, + kDevErrCntXGMIWAFL, } } }, @@ -852,6 +868,10 @@ int Device::readDevInfo(DevInfoTypes type, std::vector *val) { case kDevErrCntSDMA: case kDevErrCntUMC: case kDevErrCntGFX: + case kDevErrCntMMHUB: + case kDevErrCntPCIEBIF: + case kDevErrCntHDP: + case kDevErrCntXGMIWAFL: case kDevMemPageBad: return readDevInfoMultiLineStr(type, val); break;