rocm_smi_lib: Fix [linux BM] [AMDSMI] Memory Bandwidth

Implements APIs for 'gpu_metrics_v1_3' utilization averages

Code changes related to the following:
  * rsmi_dev_activity_metric_get()
  * rsmi_dev_activity_avg_mm_get()
  * CLI shows "Avg.Memory Bandwidth" under "--showmemuse"

Change-Id: I8e4600f350a7c18499abf022534db2b875f09d5f
Signed-off-by: Oliveira, Daniel <daniel.oliveira@amd.com>


[ROCm/amdsmi commit: e0483f2ee2]
This commit is contained in:
Oliveira, Daniel
2023-09-19 13:44:20 -05:00
committed by Daniel Oliveira
parent fcef65621d
commit 4fd608200c
5 changed files with 202 additions and 7 deletions
@@ -2160,6 +2160,7 @@ def showMemUse(deviceList):
@param deviceList: List of DRM devices (can be a single-item list)
"""
memoryUse = c_uint64()
avgMemBandwidth = c_uint16()
printLogSpacer(' Current Memory Use ')
for device in deviceList:
ret = rocmsmi.rsmi_dev_memory_busy_percent_get(device, byref(memoryUse))
@@ -2171,6 +2172,12 @@ def showMemUse(deviceList):
printLog(device, utilization_counter_name[ut_counter.type], ut_counter.val)
else:
printLog(device, 'Memory Activity', 'N/A')
ret = rocmsmi.rsmi_dev_activity_avg_mm_get(device, byref(avgMemBandwidth))
if rsmi_ret_ok(ret, device, silent=True):
printLog(device, 'Avg. Memory Bandwidth', avgMemBandwidth.value)
else:
printLog(device, 'Not supported on the given system', None)
printLogSpacer()