Merge amd-staging into amd-master 20240411
Signed-off-by: guanyu12 <guanyu12@amd.com> Change-Id: I25ed71cca91a0d78110a995861cff93ba748e056
Tento commit je obsažen v:
@@ -175,13 +175,13 @@ Set options:
|
||||
--rasenable BLOCK ERRTYPE Enable RAS for specified block and error type
|
||||
--rasdisable BLOCK ERRTYPE Disable RAS for specified block and error type
|
||||
--rasinject BLOCK Inject RAS poison for specified block (ONLY WORKS ON
|
||||
UNSECURE BOARDS)
|
||||
UNSECURED BOARDS)
|
||||
|
||||
Reset options:
|
||||
-r, --resetclocks Reset clocks and OverDrive to default
|
||||
--resetfans Reset fans to automatic (driver) control
|
||||
--resetprofile Reset Power Profile back to default
|
||||
--resetpoweroverdrive Set the maximum GPU power back to the device deafult
|
||||
--resetpoweroverdrive Set the maximum GPU power back to the device default
|
||||
state
|
||||
--resetxgmierr Reset XGMI error count
|
||||
--resetperfdeterminism Disable performance determinism
|
||||
|
||||
@@ -418,9 +418,45 @@ def getMaxPower(device, silent=False):
|
||||
power_cap = c_uint64()
|
||||
ret = rocmsmi.rsmi_dev_power_cap_get(device, 0, byref(power_cap))
|
||||
if rsmi_ret_ok(ret, device, 'get_power_cap', silent):
|
||||
return power_cap.value / 1000000
|
||||
# take floor of result (round down to nearest integer)
|
||||
return float(power_cap.value / 1000000) // 1
|
||||
return -1
|
||||
|
||||
def getAllocatedMemoryPercent(device):
|
||||
""" Return dictionary of allocated memory (VRAM) of a given device
|
||||
Response of allocated_memory_vram dictionary:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
{
|
||||
'value': float allocated vram memory (floor of %) or 'N/A' (for rsmi_status_t.RSMI_STATUS_NOT_SUPPORTED),
|
||||
'unit': %,
|
||||
'combined': string (eg. '30%') or 'N/A' (for rsmi_status_t.RSMI_STATUS_NOT_SUPPORTED)
|
||||
'ret': rsmi_status_t.RSMI_STATUS_NOT_SUPPORTED or rsmi_status_t.RSMI_STATUS_NOT_SUPPORTED
|
||||
}
|
||||
|
||||
:param device: DRM device identifier
|
||||
"""
|
||||
allocated_memory_vram = {
|
||||
'value': "N/A",
|
||||
'unit': '%',
|
||||
'combined': "N/A",
|
||||
'ret': rsmi_status_t.RSMI_STATUS_NOT_SUPPORTED
|
||||
}
|
||||
vram_used, vram_total = getMemInfo(device, 'vram', silent=True)
|
||||
mem_use_pct = 0
|
||||
if vram_used is None:
|
||||
return allocated_memory_vram
|
||||
if vram_used != None and vram_total != None and float(vram_total) != 0:
|
||||
# take floor of result (round down to nearest integer)
|
||||
mem_use_pct = (100 * (float(vram_used) / float(vram_total))) // 1
|
||||
allocated_memory_vram['value'] = mem_use_pct
|
||||
mem_use_pct = '{:<.0f}%'.format(mem_use_pct) # left aligned
|
||||
# values with no precision
|
||||
allocated_memory_vram['combined'] = mem_use_pct
|
||||
allocated_memory_vram['ret'] = rsmi_status_t.RSMI_STATUS_SUCCESS
|
||||
return allocated_memory_vram
|
||||
|
||||
|
||||
def getMemInfo(device, memType, silent=False):
|
||||
""" Returns a tuple of (memory_used, memory_total) of
|
||||
@@ -1958,14 +1994,7 @@ def showAllConcise(deviceList):
|
||||
gpu_busy = str(getGpuUse(device, silent)) + '%'
|
||||
else:
|
||||
gpu_busy = 'Unsupported'
|
||||
vram_used, vram_total = getMemInfo(device, 'vram', silent)
|
||||
mem_use_pct = 0
|
||||
if vram_used is None:
|
||||
mem_use_pct='Unsupported'
|
||||
if vram_used != None and vram_total != None and float(vram_total) != 0:
|
||||
mem_use_pct = round(float(100 * (float(vram_used) / float(vram_total))))
|
||||
mem_use_pct = '{:<.0f}%'.format(mem_use_pct) # left aligned
|
||||
# values with no precision
|
||||
allocated_mem_percent = getAllocatedMemoryPercent(device)
|
||||
|
||||
# Top Row - per device data
|
||||
values['card%s' % (str(device))] = [device, getNodeId(device),
|
||||
@@ -1975,7 +2004,7 @@ def showAllConcise(deviceList):
|
||||
combined_partition_data,
|
||||
sclk, mclk, fan, str(perf).lower(),
|
||||
str(pwrCap),
|
||||
str(mem_use_pct),
|
||||
allocated_mem_percent['combined'],
|
||||
str(gpu_busy)]
|
||||
|
||||
val_widths = {}
|
||||
@@ -2476,9 +2505,12 @@ def showMemUse(deviceList):
|
||||
avgMemBandwidth = c_uint16()
|
||||
printLogSpacer(' Current Memory Use ')
|
||||
for device in deviceList:
|
||||
allocated_mem_percent = getAllocatedMemoryPercent(device)
|
||||
printLog(device, 'GPU Memory Allocated (VRAM%)',
|
||||
int(allocated_mem_percent['value']))
|
||||
ret = rocmsmi.rsmi_dev_memory_busy_percent_get(device, byref(memoryUse))
|
||||
if rsmi_ret_ok(ret, device, '% memory use'):
|
||||
printLog(device, 'GPU memory use (%)', memoryUse.value)
|
||||
printLog(device, 'GPU Memory Read/Write Activity (%)', memoryUse.value)
|
||||
util_counters = getCoarseGrainUtil(device, "Memory Activity")
|
||||
if util_counters != -1:
|
||||
for ut_counter in util_counters:
|
||||
@@ -2981,7 +3013,7 @@ def showEvents(deviceList, eventTypes):
|
||||
if len(eventTypeList) == 0:
|
||||
eventTypeList = notification_type_names
|
||||
print2DArray([['DEVICE\t', 'TIME\t', 'TYPE\t', 'DESCRIPTION']])
|
||||
# Create a seperate thread for each GPU
|
||||
# Create a separate thread for each GPU
|
||||
for device in deviceList:
|
||||
try:
|
||||
_thread.start_new_thread(printEventList, (device, 1000, eventTypeList))
|
||||
@@ -3682,7 +3714,7 @@ def rsmi_ret_ok(my_ret, device=None, metric=None, silent=False):
|
||||
:param device: DRM device identifier
|
||||
:param my_ret: Return of RSMI call (rocm_smi_lib API)
|
||||
:param metric: Parameter of GPU currently being analyzed
|
||||
:param silent: Echo verbose error reponse.
|
||||
:param silent: Echo verbose error response.
|
||||
True silences err output, False does not silence err output (default).
|
||||
"""
|
||||
global RETCODE
|
||||
@@ -3868,7 +3900,7 @@ if __name__ == '__main__':
|
||||
groupActionReset.add_argument('--resetfans', help='Reset fans to automatic (driver) control', action='store_true')
|
||||
groupActionReset.add_argument('--resetprofile', help='Reset Power Profile back to default', action='store_true')
|
||||
groupActionReset.add_argument('--resetpoweroverdrive',
|
||||
help='Set the maximum GPU power back to the device deafult state',
|
||||
help='Set the maximum GPU power back to the device default state',
|
||||
action='store_true')
|
||||
groupActionReset.add_argument('--resetxgmierr', help='Reset XGMI error count', action='store_true')
|
||||
groupActionReset.add_argument('--resetperfdeterminism', help='Disable performance determinism', action='store_true')
|
||||
@@ -3920,7 +3952,7 @@ if __name__ == '__main__':
|
||||
groupAction.add_argument('--rasdisable', help='Disable RAS for specified block and error type', type=str, nargs=2,
|
||||
metavar=('BLOCK', 'ERRTYPE'))
|
||||
groupAction.add_argument('--rasinject',
|
||||
help='Inject RAS poison for specified block (ONLY WORKS ON UNSECURE BOARDS)', type=str,
|
||||
help='Inject RAS poison for specified block (ONLY WORKS ON UNSECURED BOARDS)', type=str,
|
||||
metavar='BLOCK', nargs=1)
|
||||
groupActionGpuReset.add_argument('--gpureset', help='Reset specified GPU (One GPU must be specified)',
|
||||
action='store_true')
|
||||
|
||||
@@ -67,11 +67,11 @@ rsmi_status_verbose_err_out = {
|
||||
rsmi_status_t.RSMI_STATUS_OUT_OF_RESOURCES: 'Unable to acquire memory or other resource',
|
||||
rsmi_status_t.RSMI_STATUS_INTERNAL_EXCEPTION: 'An internal exception was caught',
|
||||
rsmi_status_t.RSMI_STATUS_INPUT_OUT_OF_BOUNDS: 'Provided input is out of allowable or safe range',
|
||||
rsmi_status_t.RSMI_INITIALIZATION_ERROR: 'Error occured during rsmi initialization',
|
||||
rsmi_status_t.RSMI_INITIALIZATION_ERROR: 'Error occurred during rsmi initialization',
|
||||
rsmi_status_t.RSMI_STATUS_NOT_YET_IMPLEMENTED: 'Requested function is not implemented on this setup',
|
||||
rsmi_status_t.RSMI_STATUS_NOT_FOUND: 'Item searched for but not found',
|
||||
rsmi_status_t.RSMI_STATUS_INSUFFICIENT_SIZE: 'Insufficient resources available',
|
||||
rsmi_status_t.RSMI_STATUS_INTERRUPT: 'Interrupt occured during execution',
|
||||
rsmi_status_t.RSMI_STATUS_INTERRUPT: 'Interrupt occurred during execution',
|
||||
rsmi_status_t.RSMI_STATUS_UNEXPECTED_SIZE: 'Unexpected amount of data read',
|
||||
rsmi_status_t.RSMI_STATUS_NO_DATA: 'No data found for the given input',
|
||||
rsmi_status_t.RSMI_STATUS_UNEXPECTED_DATA: 'Unexpected data received',
|
||||
@@ -639,4 +639,4 @@ rsmi_power_type_dict = {
|
||||
0: 'AVERAGE',
|
||||
1: 'CURRENT SOCKET',
|
||||
0xFFFFFFFF: 'INVALID_POWER_TYPE'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,11 +99,11 @@ rsmi_status_verbose_err_out = {
|
||||
rsmi_status_t.RSMI_STATUS_OUT_OF_RESOURCES: 'Unable to acquire memory or other resource',
|
||||
rsmi_status_t.RSMI_STATUS_INTERNAL_EXCEPTION: 'An internal exception was caught',
|
||||
rsmi_status_t.RSMI_STATUS_INPUT_OUT_OF_BOUNDS: 'Provided input is out of allowable or safe range',
|
||||
rsmi_status_t.RSMI_INITIALIZATION_ERROR: 'Error occured during rsmi initialization',
|
||||
rsmi_status_t.RSMI_INITIALIZATION_ERROR: 'Error occurred during rsmi initialization',
|
||||
rsmi_status_t.RSMI_STATUS_NOT_YET_IMPLEMENTED: 'Requested function is not implemented on this setup',
|
||||
rsmi_status_t.RSMI_STATUS_NOT_FOUND: 'Item searched for but not found',
|
||||
rsmi_status_t.RSMI_STATUS_INSUFFICIENT_SIZE: 'Insufficient resources available',
|
||||
rsmi_status_t.RSMI_STATUS_INTERRUPT: 'Interrupt occured during execution',
|
||||
rsmi_status_t.RSMI_STATUS_INTERRUPT: 'Interrupt occurred during execution',
|
||||
rsmi_status_t.RSMI_STATUS_UNEXPECTED_SIZE: 'Unexpected amount of data read',
|
||||
rsmi_status_t.RSMI_STATUS_NO_DATA: 'No data found for the given input',
|
||||
rsmi_status_t.RSMI_STATUS_UNEXPECTED_DATA: 'Unexpected data received',
|
||||
@@ -671,4 +671,4 @@ rsmi_power_type_dict = {
|
||||
0: 'AVERAGE',
|
||||
1: 'CURRENT SOCKET',
|
||||
0xFFFFFFFF: 'INVALID_POWER_TYPE'
|
||||
}
|
||||
}
|
||||
|
||||
Odkázat v novém úkolu
Zablokovat Uživatele