Merge amd-dev into amd-master 20240424

Signed-off-by: Maisam Arif <maisarif@amd.com>
Change-Id: Ic78df64607f1541f34305b4955a9696c9933a1c1


[ROCm/amdsmi commit: 881920c864]
Bu işleme şunda yer alıyor:
Maisam Arif
2024-04-24 05:10:55 -05:00
işleme 53523ad2fc
15 değiştirilmiş dosya ile 197 ekleme ve 208 silme
+41 -1
Dosyayı Görüntüle
@@ -12,7 +12,47 @@ Full documentation for amd_smi_lib is available at [https://rocm.docs.amd.com/](
### Changed
- **Updated metrics --clocks**
- **Updated `amd-smi metric --ecc-blocks` output**
The ecc blocks arguement was outputing blocks without counters available, updated the filtering show blocks that counters are available for:
``` shell
$ amd-smi metric --ecc-block
GPU: 0
ECC_BLOCKS:
UMC:
CORRECTABLE_COUNT: 0
UNCORRECTABLE_COUNT: 0
DEFERRED_COUNT: 0
SDMA:
CORRECTABLE_COUNT: 0
UNCORRECTABLE_COUNT: 0
DEFERRED_COUNT: 0
GFX:
CORRECTABLE_COUNT: 0
UNCORRECTABLE_COUNT: 0
DEFERRED_COUNT: 0
MMHUB:
CORRECTABLE_COUNT: 0
UNCORRECTABLE_COUNT: 0
DEFERRED_COUNT: 0
PCIE_BIF:
CORRECTABLE_COUNT: 0
UNCORRECTABLE_COUNT: 0
DEFERRED_COUNT: 0
HDP:
CORRECTABLE_COUNT: 0
UNCORRECTABLE_COUNT: 0
DEFERRED_COUNT: 0
XGMI_WAFL:
CORRECTABLE_COUNT: 0
UNCORRECTABLE_COUNT: 0
DEFERRED_COUNT: 0
```
- **Removed `amdsmi_get_gpu_process_info` from python library**
amdsmi_get_gpu_process_info was removed from the C library in an earlier build, but the API was still in the python interface
- **Updated metrics --clocks**
Output for `amd-smi metric --clock` is updated to reflect each engine and bug fixes for the clock lock status and deep sleep status.
``` shell
+25 -14
Dosyayı Görüntüle
@@ -1692,14 +1692,15 @@ class AMDSMICommands():
if "ecc_blocks" in current_platform_args:
if args.ecc_blocks:
ecc_dict = {}
uncountable_blocks = ["ATHUB", "DF", "SMN", "SEM", "FUSE"]
sysfs_blocks = ["UMC", "SDMA", "GFX", "MMHUB", "PCIE_BIF", "HDP", "XGMI_WAFL"]
try:
ras_states = amdsmi_interface.amdsmi_get_gpu_ras_block_features_enabled(args.gpu)
for state in ras_states:
# Only add enabled blocks that are also in sysfs
if state['status'] == amdsmi_interface.AmdSmiRasErrState.ENABLED.name:
gpu_block = amdsmi_interface.AmdSmiGpuBlock[state['block']]
# if the blocks are uncountable do not add them at all.
if gpu_block.name not in uncountable_blocks:
if gpu_block.name in sysfs_blocks:
try:
ecc_count = amdsmi_interface.amdsmi_get_gpu_ecc_count(args.gpu, gpu_block)
ecc_dict[state['block']] = {'correctable_count' : ecc_count['correctable_count'],
@@ -2576,28 +2577,38 @@ class AMDSMICommands():
raise e
filtered_process_values = []
for process in process_list:
try:
process_info = amdsmi_interface.amdsmi_get_gpu_process_info(args.gpu, process)
except amdsmi_exception.AmdSmiLibraryException as e:
process_info = "N/A"
logging.debug("Failed to get process info for process %s on gpu %s | %s", process, gpu_id, e.get_error_info())
filtered_process_values.append({'process_info': process_info})
continue
for process_info in process_list:
process_info['mem_usage'] = process_info.pop('mem')
process_info['usage'] = process_info.pop('engine_usage')
engine_usage_unit = "ns"
memory_usage_unit = "B"
if self.logger.is_human_readable_format():
process_info['mem_usage'] = self.helpers.convert_bytes_to_readable(process_info['mem_usage'])
engine_usage_unit = "ns"
for usage_metric in process_info['usage']:
process_info['usage'][usage_metric] = f"{process_info['usage'][usage_metric]} {engine_usage_unit}"
for usage_metric in process_info['memory_usage']:
process_info['memory_usage'][usage_metric] = self.helpers.convert_bytes_to_readable(process_info['memory_usage'][usage_metric])
elif self.logger.is_json_format():
process_info['mem_usage'] = {"value" : process_info['mem_usage'],
"unit" : memory_usage_unit}
for usage_metric in process_info['usage']:
process_info['usage'][usage_metric] = {"value" : process_info['usage'][usage_metric],
"unit" : engine_usage_unit}
for usage_metric in process_info['memory_usage']:
process_info['memory_usage'][usage_metric] = {"value" : process_info['memory_usage'][usage_metric],
"unit" : memory_usage_unit}
filtered_process_values.append({'process_info': process_info})
if not filtered_process_values:
process_info = "N/A"
logging.debug("Failed to detect any process on gpu %s", gpu_id)
filtered_process_values.append({'process_info': process_info})
# Arguments will filter the populated processes
@@ -2641,7 +2652,7 @@ class AMDSMICommands():
# Convert and store output by pid for csv format
if self.logger.is_csv_format():
# Check for empty list first
if filtered_process_values == []:
if not filtered_process_values:
self.logger.store_output(args.gpu, 'process_info', 'No running processes detected')
else:
for process_info in filtered_process_values:
@@ -2660,7 +2671,7 @@ class AMDSMICommands():
self.logger.store_output(args.gpu, 'timestamp', int(time.time()))
# Store values in logger.output
if filtered_process_values == []:
if not filtered_process_values:
self.logger.store_output(args.gpu, 'process_info', 'No running processes detected')
else:
for process_info in filtered_process_values:
+2
Dosyayı Görüntüle
@@ -0,0 +1,2 @@
```{include} ../CHANGELOG.md
```
-13
Dosyayı Görüntüle
@@ -6,21 +6,8 @@
import subprocess
import urllib
from rocm_docs import ROCmDocs
esmi_readme_link = "https://raw.githubusercontent.com/amd/esmi_ib_library/master/docs/README.md"
try:
# Try to override esmi_lib_readme_link.md with the github esmi readme contents
with urllib.request.urlopen(esmi_readme_link) as f:
esmi_readme = f.read().decode('utf-8')
with open("./esmi_lib_readme_link.md", "w", encoding='utf-8') as f:
f.write(esmi_readme)
except urllib.error.URLError:
# don't care about the error because there is backup link in the file already
pass
get_version_year = r'sed -n -e "s/^#define\ AMDSMI_LIB_VERSION_YEAR\ //p" ../include/amd_smi/amdsmi.h'
get_version_major = r'sed -n -e "s/^#define\ AMDSMI_LIB_VERSION_MAJOR\ //p" ../include/amd_smi/amdsmi.h'
get_version_minor = r'sed -n -e "s/^#define\ AMDSMI_LIB_VERSION_MINOR\ //p" ../include/amd_smi/amdsmi.h'
-3
Dosyayı Görüntüle
@@ -1,3 +0,0 @@
# ESMI Library README
For more information, see the [ESMI Library README](https://raw.githubusercontent.com/amd/esmi_ib_library/master/docs/README.md)
+3 -3
Dosyayı Görüntüle
@@ -17,10 +17,10 @@ subtrees:
title: Python CLI Tool
- file: amdsmi_release_notes_link
title: Python CLI Release Notes
- caption: Libraries
- caption: Changelog
entries:
- file: esmi_lib_readme_link
title: ESMI Library
- file: amdsmi_changelog_link
title: AMD-SMI Changelog
- caption: About
entries:
- file: license
+9 -4
Dosyayı Görüntüle
@@ -964,10 +964,10 @@ typedef enum {
*/
typedef enum {
AMDSMI_GPU_BLOCK_INVALID = 0x0000000000000000, //!< Used to indicate an
//!< invalid block
//!< invalid block
AMDSMI_GPU_BLOCK_FIRST = 0x0000000000000001,
AMDSMI_GPU_BLOCK_UMC = AMDSMI_GPU_BLOCK_FIRST, //!< UMC block
AMDSMI_GPU_BLOCK_UMC = AMDSMI_GPU_BLOCK_FIRST, //!< UMC block
AMDSMI_GPU_BLOCK_SDMA = 0x0000000000000002, //!< SDMA block
AMDSMI_GPU_BLOCK_GFX = 0x0000000000000004, //!< GFX block
AMDSMI_GPU_BLOCK_MMHUB = 0x0000000000000008, //!< MMHUB block
@@ -981,9 +981,14 @@ typedef enum {
AMDSMI_GPU_BLOCK_MP0 = 0x0000000000000800, //!< MP0 block
AMDSMI_GPU_BLOCK_MP1 = 0x0000000000001000, //!< MP1 block
AMDSMI_GPU_BLOCK_FUSE = 0x0000000000002000, //!< Fuse block
AMDSMI_GPU_BLOCK_MCA = 0x0000000000004000, //!< MCA block
AMDSMI_GPU_BLOCK_VCN = 0x0000000000008000, //!< VCN block
AMDSMI_GPU_BLOCK_JPEG = 0x0000000000010000, //!< JPEG block
AMDSMI_GPU_BLOCK_IH = 0x0000000000020000, //!< IH block
AMDSMI_GPU_BLOCK_MPIO = 0x0000000000040000, //!< MPIO block
AMDSMI_GPU_BLOCK_LAST = AMDSMI_GPU_BLOCK_FUSE, //!< The highest bit position
//!< for supported blocks
AMDSMI_GPU_BLOCK_LAST = AMDSMI_GPU_BLOCK_MPIO, //!< The highest bit position
//!< for supported blocks
AMDSMI_GPU_BLOCK_RESERVED = 0x8000000000000000
} amdsmi_gpu_block_t;
+14 -49
Dosyayı Görüntüle
@@ -88,7 +88,7 @@ Initialize GPUs only example:
```python
try:
# by default we initalize with AmdSmiInitFlags.INIT_AMD_GPUS
init_flag = amdsmi_init()
ret = amdsmi_init()
# continue with amdsmi
except AmdSmiException as e:
print("Init GPUs failed")
@@ -99,7 +99,7 @@ Initialize CPUs only example:
```python
try:
init_flag = amdsmi_init(AmdSmiInitFlags.INIT_AMD_CPUS)
ret = amdsmi_init(AmdSmiInitFlags.INIT_AMD_CPUS)
# continue with amdsmi
except AmdSmiException as e:
print("Init CPUs failed")
@@ -110,7 +110,7 @@ Initialize both GPUs and CPUs example:
```python
try:
init_flag = amdsmi_init(AmdSmiInitFlags.INIT_AMD_APUS)
ret = amdsmi_init(AmdSmiInitFlags.INIT_AMD_APUS)
# continue with amdsmi
except AmdSmiException as e:
print("Init both GPUs & CPUs failed")
@@ -882,13 +882,21 @@ except AmdSmiException as e:
### amdsmi_get_gpu_process_list
Description: Returns the list of processes running on the target GPU.
Description: Returns the list of processes running on the target GPU; May require root level access
Input parameters:
* `processor_handle` device which to query
Output: List of `amdsmi_proc_info_t` process objects running on the target GPU; can be empty
Output: List of Dictionaries with the corresponding fields; empty list if no running process are detected
Field | Description
---|---
`name` | Name of process
`pid` | Process ID
`mem` | Process memory usage
`engine_usage` | <table><thead><tr> <th> Subfield </th> <th> Description</th> </tr></thead><tbody><tr><td>`gfx`</td><td>GFX engine usage in ns</td></tr><tr><td>`enc`</td><td>Encode engine usage in ns</td></tr></tbody></table>
`memory_usage` | <table><thead><tr> <th> Subfield </th> <th> Description</th> </tr></thead><tbody><tr><td>`gtt_mem`</td><td>GTT memory usage</td></tr><tr><td>`cpu_mem`</td><td>CPU memory usage</td></tr><tr><td>`vram_mem`</td><td>VRAM memory usage</td></tr> </tbody></table>
Exceptions that can be thrown by `amdsmi_get_gpu_process_list` function:
@@ -910,50 +918,7 @@ try:
print("No processes running on this GPU")
else:
for process in processes:
print(amdsmi_get_gpu_process_info(device, process))
except AmdSmiException as e:
print(e)
```
### amdsmi_get_gpu_process_info
Description: Returns info about process given the target GPU and the corresponding `amdsmi_proc_info_t` object
Input parameters:
* `processor_handle` device which to query
Output: Dictionary with fields
Field | Description
---|---
`name` | Name of process
`pid` | Process ID
`mem` | Process memory usage
`engine_usage` | <table><thead><tr> <th> Subfield </th> <th> Description</th> </tr></thead><tbody><tr><td>`gfx`</td><td>GFX engine usage in ns</td></tr><tr><td>`enc`</td><td>Encode engine usage in ns</td></tr></tbody></table>
`memory_usage` | <table><thead><tr> <th> Subfield </th> <th> Description</th> </tr></thead><tbody><tr><td>`gtt_mem`</td><td>GTT memory usage</td></tr><tr><td>`cpu_mem`</td><td>CPU memory usage</td></tr><tr><td>`vram_mem`</td><td>VRAM memory usage</td></tr> </tbody></table
Exceptions that can be thrown by `amdsmi_get_gpu_process_info` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
```python
try:
devices = amdsmi_get_processor_handles()
if len(devices) == 0:
print("No GPUs on machine")
else:
for device in devices:
processes = amdsmi_get_gpu_process_list(device)
if len(processes) == 0:
print("No processes running on this GPU")
else:
for process in processes:
print(amdsmi_get_gpu_process_info(device, process))
print(process)
except AmdSmiException as e:
print(e)
```
-1
Dosyayı Görüntüle
@@ -108,7 +108,6 @@ from .amdsmi_interface import amdsmi_get_gpu_bad_page_info
# # Process Information
from .amdsmi_interface import amdsmi_get_gpu_process_list
from .amdsmi_interface import amdsmi_get_gpu_process_info
# # ECC Error Information
from .amdsmi_interface import amdsmi_get_gpu_total_ecc_count
+24 -31
Dosyayı Görüntüle
@@ -300,6 +300,11 @@ class AmdSmiGpuBlock(IntEnum):
MP0 = amdsmi_wrapper.AMDSMI_GPU_BLOCK_MP0
MP1 = amdsmi_wrapper.AMDSMI_GPU_BLOCK_MP1
FUSE = amdsmi_wrapper.AMDSMI_GPU_BLOCK_FUSE
MCA = amdsmi_wrapper.AMDSMI_GPU_BLOCK_MCA
VCN = amdsmi_wrapper.AMDSMI_GPU_BLOCK_VCN
JPEG = amdsmi_wrapper.AMDSMI_GPU_BLOCK_JPEG
IH = amdsmi_wrapper.AMDSMI_GPU_BLOCK_IH
MPIO = amdsmi_wrapper.AMDSMI_GPU_BLOCK_MPIO
RESERVED = amdsmi_wrapper.AMDSMI_GPU_BLOCK_RESERVED
@@ -1799,12 +1804,15 @@ def amdsmi_get_gpu_bad_page_info(
num_pages = ctypes.c_uint32()
retired_page_record = ctypes.POINTER(
amdsmi_wrapper.amdsmi_retired_page_record_t)()
_check_res(
amdsmi_wrapper.amdsmi_get_gpu_bad_page_info(
processor_handle, ctypes.byref(num_pages), retired_page_record
)
)
table_records = _format_bad_page_info(retired_page_record, num_pages)
if num_pages.value == 0:
return "No bad pages found."
else:
@@ -1903,7 +1911,7 @@ def amdsmi_get_gpu_ras_block_features_enabled(
if gpu_block.name == "RESERVED" or gpu_block.name == "INVALID":
continue
if gpu_block.name == "LAST":
gpu_block.name = "FUSE"
gpu_block.name = "MPIO"
_check_res(
amdsmi_wrapper.amdsmi_get_gpu_ras_block_features_enabled(
processor_handle,
@@ -1942,39 +1950,24 @@ def amdsmi_get_gpu_process_list(
result = []
for index in range(max_processes.value):
result.append(process_list[index])
result.append({
"name": process_list[index].name.decode("utf-8"),
"pid": process_list[index].pid,
"mem": process_list[index].mem,
"engine_usage": {
"gfx": process_list[index].engine_usage.gfx,
"enc": process_list[index].engine_usage.enc
},
"memory_usage": {
"gtt_mem": process_list[index].memory_usage.gtt_mem,
"cpu_mem": process_list[index].memory_usage.cpu_mem,
"vram_mem": process_list[index].memory_usage.vram_mem,
},
})
return result
def amdsmi_get_gpu_process_info(
processor_handle: amdsmi_wrapper.amdsmi_processor_handle,
process: amdsmi_wrapper.amdsmi_proc_info_t,
) -> Dict[str, Any]:
if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle):
raise AmdSmiParameterException(
processor_handle, amdsmi_wrapper.amdsmi_processor_handle
)
if not isinstance(process, amdsmi_wrapper.amdsmi_proc_info_t):
raise AmdSmiParameterException(
process, amdsmi_wrapper.amdsmi_proc_info_t)
return {
"name": process.name.decode("utf-8"),
"pid": process.pid,
"mem": process.mem,
"engine_usage": {
"gfx": process.engine_usage.gfx,
"enc": process.engine_usage.enc
},
"memory_usage": {
"gtt_mem": process.memory_usage.gtt_mem,
"cpu_mem": process.memory_usage.cpu_mem,
"vram_mem": process.memory_usage.vram_mem,
},
}
def amdsmi_get_gpu_device_uuid(processor_handle: amdsmi_wrapper.amdsmi_processor_handle) -> str:
if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle):
raise AmdSmiParameterException(
+36 -24
Dosyayı Görüntüle
@@ -748,6 +748,19 @@ amdsmi_card_form_factor_t = ctypes.c_uint32 # enum
class struct_amdsmi_pcie_info_t(Structure):
pass
class struct_pcie_static_(Structure):
pass
struct_pcie_static_._pack_ = 1 # source:False
struct_pcie_static_._fields_ = [
('max_pcie_width', ctypes.c_uint16),
('PADDING_0', ctypes.c_ubyte * 2),
('max_pcie_speed', ctypes.c_uint32),
('pcie_interface_version', ctypes.c_uint32),
('slot_type', amdsmi_card_form_factor_t),
('reserved', ctypes.c_uint64 * 10),
]
class struct_pcie_metric_(Structure):
pass
@@ -766,19 +779,6 @@ struct_pcie_metric_._fields_ = [
('reserved', ctypes.c_uint64 * 13),
]
class struct_pcie_static_(Structure):
pass
struct_pcie_static_._pack_ = 1 # source:False
struct_pcie_static_._fields_ = [
('max_pcie_width', ctypes.c_uint16),
('PADDING_0', ctypes.c_ubyte * 2),
('max_pcie_speed', ctypes.c_uint32),
('pcie_interface_version', ctypes.c_uint32),
('slot_type', amdsmi_card_form_factor_t),
('reserved', ctypes.c_uint64 * 10),
]
struct_amdsmi_pcie_info_t._pack_ = 1 # source:False
struct_amdsmi_pcie_info_t._fields_ = [
('pcie_static', struct_pcie_static_),
@@ -1300,7 +1300,12 @@ amdsmi_gpu_block_t__enumvalues = {
2048: 'AMDSMI_GPU_BLOCK_MP0',
4096: 'AMDSMI_GPU_BLOCK_MP1',
8192: 'AMDSMI_GPU_BLOCK_FUSE',
8192: 'AMDSMI_GPU_BLOCK_LAST',
16384: 'AMDSMI_GPU_BLOCK_MCA',
32768: 'AMDSMI_GPU_BLOCK_VCN',
65536: 'AMDSMI_GPU_BLOCK_JPEG',
131072: 'AMDSMI_GPU_BLOCK_IH',
262144: 'AMDSMI_GPU_BLOCK_MPIO',
262144: 'AMDSMI_GPU_BLOCK_LAST',
9223372036854775808: 'AMDSMI_GPU_BLOCK_RESERVED',
}
AMDSMI_GPU_BLOCK_INVALID = 0
@@ -1319,7 +1324,12 @@ AMDSMI_GPU_BLOCK_SEM = 1024
AMDSMI_GPU_BLOCK_MP0 = 2048
AMDSMI_GPU_BLOCK_MP1 = 4096
AMDSMI_GPU_BLOCK_FUSE = 8192
AMDSMI_GPU_BLOCK_LAST = 8192
AMDSMI_GPU_BLOCK_MCA = 16384
AMDSMI_GPU_BLOCK_VCN = 32768
AMDSMI_GPU_BLOCK_JPEG = 65536
AMDSMI_GPU_BLOCK_IH = 131072
AMDSMI_GPU_BLOCK_MPIO = 262144
AMDSMI_GPU_BLOCK_LAST = 262144
AMDSMI_GPU_BLOCK_RESERVED = 9223372036854775808
amdsmi_gpu_block_t = ctypes.c_uint64 # enum
@@ -2380,17 +2390,19 @@ __all__ = \
'AMDSMI_GPU_BLOCK_ATHUB', 'AMDSMI_GPU_BLOCK_DF',
'AMDSMI_GPU_BLOCK_FIRST', 'AMDSMI_GPU_BLOCK_FUSE',
'AMDSMI_GPU_BLOCK_GFX', 'AMDSMI_GPU_BLOCK_HDP',
'AMDSMI_GPU_BLOCK_INVALID', 'AMDSMI_GPU_BLOCK_LAST',
'AMDSMI_GPU_BLOCK_MMHUB', 'AMDSMI_GPU_BLOCK_MP0',
'AMDSMI_GPU_BLOCK_MP1', 'AMDSMI_GPU_BLOCK_PCIE_BIF',
'AMDSMI_GPU_BLOCK_IH', 'AMDSMI_GPU_BLOCK_INVALID',
'AMDSMI_GPU_BLOCK_JPEG', 'AMDSMI_GPU_BLOCK_LAST',
'AMDSMI_GPU_BLOCK_MCA', 'AMDSMI_GPU_BLOCK_MMHUB',
'AMDSMI_GPU_BLOCK_MP0', 'AMDSMI_GPU_BLOCK_MP1',
'AMDSMI_GPU_BLOCK_MPIO', 'AMDSMI_GPU_BLOCK_PCIE_BIF',
'AMDSMI_GPU_BLOCK_RESERVED', 'AMDSMI_GPU_BLOCK_SDMA',
'AMDSMI_GPU_BLOCK_SEM', 'AMDSMI_GPU_BLOCK_SMN',
'AMDSMI_GPU_BLOCK_UMC', 'AMDSMI_GPU_BLOCK_XGMI_WAFL',
'AMDSMI_HSMP_TIMEOUT', 'AMDSMI_INIT_ALL_PROCESSORS',
'AMDSMI_INIT_AMD_APUS', 'AMDSMI_INIT_AMD_CPUS',
'AMDSMI_INIT_AMD_GPUS', 'AMDSMI_INIT_NON_AMD_CPUS',
'AMDSMI_INIT_NON_AMD_GPUS', 'AMDSMI_INVALID_POWER',
'AMDSMI_IOLINK_TYPE_NUMIOLINKTYPES',
'AMDSMI_GPU_BLOCK_UMC', 'AMDSMI_GPU_BLOCK_VCN',
'AMDSMI_GPU_BLOCK_XGMI_WAFL', 'AMDSMI_HSMP_TIMEOUT',
'AMDSMI_INIT_ALL_PROCESSORS', 'AMDSMI_INIT_AMD_APUS',
'AMDSMI_INIT_AMD_CPUS', 'AMDSMI_INIT_AMD_GPUS',
'AMDSMI_INIT_NON_AMD_CPUS', 'AMDSMI_INIT_NON_AMD_GPUS',
'AMDSMI_INVALID_POWER', 'AMDSMI_IOLINK_TYPE_NUMIOLINKTYPES',
'AMDSMI_IOLINK_TYPE_PCIEXPRESS', 'AMDSMI_IOLINK_TYPE_SIZE',
'AMDSMI_IOLINK_TYPE_UNDEFINED', 'AMDSMI_IOLINK_TYPE_XGMI',
'AMDSMI_LINK_TYPE_NOT_APPLICABLE', 'AMDSMI_LINK_TYPE_PCIE',
+6 -1
Dosyayı Görüntüle
@@ -608,8 +608,13 @@ typedef enum {
RSMI_GPU_BLOCK_MP0 = 0x0000000000000800, //!< MP0 block
RSMI_GPU_BLOCK_MP1 = 0x0000000000001000, //!< MP1 block
RSMI_GPU_BLOCK_FUSE = 0x0000000000002000, //!< Fuse block
RSMI_GPU_BLOCK_MCA = 0x0000000000004000, //!< MCA block
RSMI_GPU_BLOCK_VCN = 0x0000000000008000, //!< VCN block
RSMI_GPU_BLOCK_JPEG = 0x0000000000010000, //!< JPEG block
RSMI_GPU_BLOCK_IH = 0x0000000000020000, //!< IH block
RSMI_GPU_BLOCK_MPIO = 0x0000000000040000, //!< MPIO block
RSMI_GPU_BLOCK_LAST = RSMI_GPU_BLOCK_FUSE, //!< The highest bit position
RSMI_GPU_BLOCK_LAST = RSMI_GPU_BLOCK_MPIO, //!< The highest bit position
//!< for supported blocks
RSMI_GPU_BLOCK_RESERVED = 0x8000000000000000
} rsmi_gpu_block_t;
+26 -15
Dosyayı Görüntüle
@@ -331,7 +331,13 @@ class rsmi_gpu_block_t(c_int):
RSMI_GPU_BLOCK_MP0 = 0x0000000000000800
RSMI_GPU_BLOCK_MP1 = 0x0000000000001000
RSMI_GPU_BLOCK_FUSE = 0x0000000000002000
RSMI_GPU_BLOCK_LAST = RSMI_GPU_BLOCK_FUSE
RSMI_GPU_BLOCK_MCA = 0x0000000000004000
RSMI_GPU_BLOCK_VCN = 0x0000000000008000
RSMI_GPU_BLOCK_JPEG = 0x0000000000010000
RSMI_GPU_BLOCK_IH = 0x0000000000020000
RSMI_GPU_BLOCK_MPIO = 0x0000000000040000
RSMI_GPU_BLOCK_LAST = RSMI_GPU_BLOCK_MPIO
RSMI_GPU_BLOCK_RESERVED = 0x8000000000000000
@@ -340,20 +346,25 @@ rsmi_gpu_block = rsmi_gpu_block_t
# The following dictionary correlates with rsmi_gpu_block_t enum
rsmi_gpu_block_d = {
'UMC' : 0x0000000000000001,
'SDMA' : 0x0000000000000002,
'GFX' : 0x0000000000000004,
'MMHUB': 0x0000000000000008,
'ATHUB': 0x0000000000000010,
'PCIE_BIF': 0x0000000000000020,
'HDP': 0x0000000000000040,
'XGMI_WAFL': 0x0000000000000080,
'DF': 0x0000000000000100,
'SMN': 0x0000000000000200,
'SEM': 0x0000000000000400,
'MP0': 0x0000000000000800,
'MP1': 0x0000000000001000,
'FUSE': 0x0000000000002000
'UMC' : 0x0000000000000001,
'SDMA' : 0x0000000000000002,
'GFX' : 0x0000000000000004,
'MMHUB' : 0x0000000000000008,
'ATHUB' : 0x0000000000000010,
'PCIE_BIF' : 0x0000000000000020,
'HDP' : 0x0000000000000040,
'XGMI_WAFL' : 0x0000000000000080,
'DF' : 0x0000000000000100,
'SMN' : 0x0000000000000200,
'SEM' : 0x0000000000000400,
'MP0' : 0x0000000000000800,
'MP1' : 0x0000000000001000,
'FUSE' : 0x0000000000002000,
'MCA' : 0x0000000000004000,
'VCN' : 0x0000000000008000,
'JPEG' : 0x0000000000010000,
'IH' : 0x0000000000020000,
'MPIO' : 0x0000000000040000,
}
+5 -48
Dosyayı Görüntüle
@@ -1425,6 +1425,7 @@ constexpr uint32_t kOD_VDDC_CURVE_start_index =
kOD_OD_RANGE_label_array_index + 3;
// constexpr uint32_t kOD_VDDC_CURVE_num_lines =
// kOD_VDDC_CURVE_start_index + 4;
constexpr uint32_t kMIN_VALID_LINES = 2;
static rsmi_status_t get_od_clk_volt_info(uint32_t dv_ind,
rsmi_od_volt_freq_data_t *p) {
@@ -1444,7 +1445,7 @@ static rsmi_status_t get_od_clk_volt_info(uint32_t dv_ind,
// This is a work-around to handle systems where kDevPowerODVoltage is not
// fully supported yet.
if (val_vec.size() < 2) {
if (val_vec.size() < kMIN_VALID_LINES) {
return RSMI_STATUS_NOT_YET_IMPLEMENTED;
}
@@ -1455,6 +1456,7 @@ static rsmi_status_t get_od_clk_volt_info(uint32_t dv_ind,
return RSMI_STATUS_UNEXPECTED_DATA;
}
// find last_item but skip empty lines
int last_item = val_vec.size()-1;
while (val_vec[last_item].empty() || val_vec[last_item][0] == 0)
@@ -1500,39 +1502,9 @@ static rsmi_status_t get_od_clk_volt_info(uint32_t dv_ind,
if (val_vec.size() < kOD_VDDC_CURVE_label_array_index) {
return RSMI_STATUS_UNEXPECTED_SIZE;
}
assert(val_vec[kOD_VDDC_CURVE_label_array_index] == "OD_VDDC_CURVE:");
if (val_vec[kOD_VDDC_CURVE_label_array_index] != "OD_VDDC_CURVE:") {
return RSMI_STATUS_UNEXPECTED_DATA;
}
uint32_t tmp = kOD_VDDC_CURVE_label_array_index + 1;
if (val_vec.size() < (tmp + RSMI_NUM_VOLTAGE_CURVE_POINTS)) {
return RSMI_STATUS_UNEXPECTED_SIZE;
}
for (uint32_t i = 0; i < RSMI_NUM_VOLTAGE_CURVE_POINTS; ++i) {
freq_volt_string_to_point(val_vec[tmp + i], &(p->curve.vc_points[i]));
}
if (val_vec.size() < (kOD_OD_RANGE_label_array_index + 2)) {
return RSMI_STATUS_UNEXPECTED_SIZE;
}
assert(val_vec[kOD_OD_RANGE_label_array_index] == "OD_RANGE:");
if (val_vec[kOD_OD_RANGE_label_array_index] != "OD_RANGE:") {
return RSMI_STATUS_UNEXPECTED_DATA;
}
od_value_pair_str_to_range(val_vec[kOD_OD_RANGE_label_array_index + 1],
&(p->sclk_freq_limits));
od_value_pair_str_to_range(val_vec[kOD_OD_RANGE_label_array_index + 2],
&(p->mclk_freq_limits));
assert((val_vec.size() - kOD_VDDC_CURVE_start_index)%2 == 0);
if ((val_vec.size() - kOD_VDDC_CURVE_start_index)%2 != 0) {
return RSMI_STATUS_UNEXPECTED_SIZE;
}
p->num_regions =
static_cast<uint32_t>((val_vec.size() - kOD_VDDC_CURVE_start_index) / 2);
static_cast<uint32_t>((val_vec.size()) / 2);
return RSMI_STATUS_SUCCESS;
CATCH
@@ -1766,28 +1738,13 @@ static rsmi_status_t get_od_clk_volt_curve_regions(uint32_t dv_ind,
uint32_t val_vec_size = static_cast<uint32_t>(val_vec.size());
assert((val_vec_size - kOD_VDDC_CURVE_start_index) > 0);
assert((val_vec_size - kOD_VDDC_CURVE_start_index)%2 == 0);
ss << __PRETTY_FUNCTION__
<< " | val_vec_size = " << std::dec
<< val_vec_size
<< " | kOD_VDDC_CURVE_start_index = " << kOD_VDDC_CURVE_start_index;
LOG_DEBUG(ss);
if (((val_vec_size - kOD_VDDC_CURVE_start_index) <= 0) ||
(((val_vec_size - kOD_VDDC_CURVE_start_index)%2 != 0))) {
ss << __PRETTY_FUNCTION__ << " | Issue: od vdd curve returned unexpected "
<< "data" << "; returning "
<< getRSMIStatusString(RSMI_STATUS_UNEXPECTED_SIZE);
LOG_ERROR(ss);
throw amd::smi::rsmi_exception(RSMI_STATUS_UNEXPECTED_SIZE, __FUNCTION__);
}
*num_regions = std::min((val_vec_size - kOD_VDDC_CURVE_start_index) / 2,
*num_regions);
for (uint32_t i=0; i < *num_regions; ++i) {
get_vc_region(kOD_VDDC_CURVE_start_index + i*2, &val_vec, p + i);
}
*num_regions = std::min((val_vec_size) / 2, *num_regions);
return RSMI_STATUS_SUCCESS;
CATCH
+6 -1
Dosyayı Görüntüle
@@ -91,8 +91,13 @@ static const std::map<amdsmi_gpu_block_t, const char *> kBlockNameMap = {
{AMDSMI_GPU_BLOCK_MP0, "MP0"},
{AMDSMI_GPU_BLOCK_MP1, "MP1"},
{AMDSMI_GPU_BLOCK_FUSE, "FUSE"},
{AMDSMI_GPU_BLOCK_MCA, "MCA"},
{AMDSMI_GPU_BLOCK_VCN, "VCN"},
{AMDSMI_GPU_BLOCK_JPEG, "JPEG"},
{AMDSMI_GPU_BLOCK_IH, "IH"},
{AMDSMI_GPU_BLOCK_MPIO, "MPIO"},
};
static_assert(AMDSMI_GPU_BLOCK_LAST == AMDSMI_GPU_BLOCK_FUSE,
static_assert(AMDSMI_GPU_BLOCK_LAST == AMDSMI_GPU_BLOCK_MPIO,
"kBlockNameMap needs to be updated");
static const char * kRasErrStateStrings[] = {