Merge amd-dev into amd-master 20240208
Signed-off-by: guanyu12 <guanyu12@amd.com> Change-Id: I94f867792b9ee29054ff893e34957433c1055c25
Esse commit está contido em:
+17
-17
@@ -656,25 +656,25 @@ VRAM:
|
||||
VRAM_VENDOR: HYNIX
|
||||
VRAM_SIZE_MB: 96432 MB
|
||||
CACHE:
|
||||
CACHE 0:
|
||||
CACHE_0:
|
||||
CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE
|
||||
CACHE_SIZE: 32 KB
|
||||
CACHE_LEVEL: 1
|
||||
MAX_NUM_CU_SHARED: 2
|
||||
NUM_CACHE_INSTANCE: 464
|
||||
CACHE 1:
|
||||
CACHE_1:
|
||||
CACHE_PROPERTIES: INST_CACHE, SIMD_CACHE
|
||||
CACHE_SIZE: 64 KB
|
||||
CACHE_LEVEL: 1
|
||||
MAX_NUM_CU_SHARED: 2
|
||||
NUM_CACHE_INSTANCE: 160
|
||||
CACHE 2:
|
||||
CACHE_2:
|
||||
CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE
|
||||
CACHE_SIZE: 32768 KB
|
||||
CACHE_LEVEL: 2
|
||||
MAX_NUM_CU_SHARED: 304
|
||||
NUM_CACHE_INSTANCE: 1
|
||||
CACHE 3:
|
||||
CACHE_3:
|
||||
CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE
|
||||
CACHE_SIZE: 262144 KB
|
||||
CACHE_LEVEL: 3
|
||||
@@ -768,25 +768,25 @@ VRAM:
|
||||
VRAM_SIZE_MB: 96432 MB
|
||||
CACHE:
|
||||
CACHE:
|
||||
CACHE 0:
|
||||
CACHE_0:
|
||||
CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE
|
||||
CACHE_SIZE: 32 KB
|
||||
CACHE_LEVEL: 1
|
||||
MAX_NUM_CU_SHARED: 2
|
||||
NUM_CACHE_INSTANCE: 464
|
||||
CACHE 1:
|
||||
CACHE_1:
|
||||
CACHE_PROPERTIES: INST_CACHE, SIMD_CACHE
|
||||
CACHE_SIZE: 64 KB
|
||||
CACHE_LEVEL: 1
|
||||
MAX_NUM_CU_SHARED: 2
|
||||
NUM_CACHE_INSTANCE: 160
|
||||
CACHE 2:
|
||||
CACHE_2:
|
||||
CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE
|
||||
CACHE_SIZE: 32768 KB
|
||||
CACHE_LEVEL: 2
|
||||
MAX_NUM_CU_SHARED: 304
|
||||
NUM_CACHE_INSTANCE: 1
|
||||
CACHE 3:
|
||||
CACHE_3:
|
||||
CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE
|
||||
CACHE_SIZE: 262144 KB
|
||||
CACHE_LEVEL: 3
|
||||
@@ -879,25 +879,25 @@ VRAM:
|
||||
VRAM_SIZE_MB: 96432 MB
|
||||
CACHE:
|
||||
CACHE:
|
||||
CACHE 0:
|
||||
CACHE_0:
|
||||
CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE
|
||||
CACHE_SIZE: 32 KB
|
||||
CACHE_LEVEL: 1
|
||||
MAX_NUM_CU_SHARED: 2
|
||||
NUM_CACHE_INSTANCE: 464
|
||||
CACHE 1:
|
||||
CACHE_1:
|
||||
CACHE_PROPERTIES: INST_CACHE, SIMD_CACHE
|
||||
CACHE_SIZE: 64 KB
|
||||
CACHE_LEVEL: 1
|
||||
MAX_NUM_CU_SHARED: 2
|
||||
NUM_CACHE_INSTANCE: 160
|
||||
CACHE 2:
|
||||
CACHE_2:
|
||||
CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE
|
||||
CACHE_SIZE: 32768 KB
|
||||
CACHE_LEVEL: 2
|
||||
MAX_NUM_CU_SHARED: 304
|
||||
NUM_CACHE_INSTANCE: 1
|
||||
CACHE 3:
|
||||
CACHE_3:
|
||||
CACHE_PROPERTIES: INST_CACHE, SIMD_CACHE
|
||||
CACHE_SIZE: 262144 KB
|
||||
CACHE_LEVEL: 3
|
||||
@@ -989,27 +989,27 @@ VRAM:
|
||||
VRAM_VENDOR: HYNIX
|
||||
VRAM_SIZE_MB: 96432 MB
|
||||
CACHE:
|
||||
CACHE 0:
|
||||
CACHE_0:
|
||||
CACHE:
|
||||
CACHE 0:
|
||||
CACHE_0:
|
||||
CACHE_PROPERTIES: INST_CACHE, SIMD_CACHE
|
||||
CACHE_SIZE: 32 KB
|
||||
CACHE_LEVEL: 1
|
||||
MAX_NUM_CU_SHARED: 2
|
||||
NUM_CACHE_INSTANCE: 464
|
||||
CACHE 1:
|
||||
CACHE_1:
|
||||
CACHE_PROPERTIES: INST_CACHE, SIMD_CACHE
|
||||
CACHE_SIZE: 64 KB
|
||||
CACHE_LEVEL: 1
|
||||
MAX_NUM_CU_SHARED: 2
|
||||
NUM_CACHE_INSTANCE: 160
|
||||
CACHE 2:
|
||||
CACHE_2:
|
||||
CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE
|
||||
CACHE_SIZE: 32768 KB
|
||||
CACHE_LEVEL: 2
|
||||
MAX_NUM_CU_SHARED: 304
|
||||
NUM_CACHE_INSTANCE: 1
|
||||
CACHE 3:
|
||||
CACHE_3:
|
||||
CACHE_PROPERTIES: DATA_CACHE, SIMD_CACHE
|
||||
CACHE_SIZE: 262144 KB
|
||||
CACHE_LEVEL: 3
|
||||
|
||||
@@ -1969,6 +1969,18 @@ class AMDSMICommands():
|
||||
|
||||
if (args.cpu_metrics_table):
|
||||
static_dict["metrics_table"] = {}
|
||||
try:
|
||||
cpu_fam = amdsmi_interface.amdsmi_get_cpu_family()
|
||||
static_dict["metrics_table"]["cpu_family"] = cpu_fam
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict["metrics_table"]["cpu_family"] = "N/A"
|
||||
logging.debug("Failed to get cpu family | %s", e.get_error_info())
|
||||
try:
|
||||
cpu_mod = amdsmi_interface.amdsmi_get_cpu_model()
|
||||
static_dict["metrics_table"]["cpu_model"] = cpu_mod
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict["metrics_table"]["cpu_model"] = "N/A"
|
||||
logging.debug("Failed to get cpu model | %s", e.get_error_info())
|
||||
try:
|
||||
metrics_table = amdsmi_interface.amdsmi_get_metrics_table(args.cpu)
|
||||
static_dict["metrics_table"]["response"] = metrics_table
|
||||
|
||||
@@ -2681,4 +2681,4 @@ GENERATE_LEGEND = YES
|
||||
|
||||
DOT_CLEANUP = YES
|
||||
|
||||
ALIASES += usecase{1}="\xrefitem usecase \"Use cases\" \"Use cases\" \1"
|
||||
ALIASES += platform{1}="\xrefitem platform \"Platform\" \"Platforms\" \1"
|
||||
|
||||
@@ -314,8 +314,8 @@ int main() {
|
||||
for (unsigned int i = 0 ; i < cache_info.num_cache_types; i++) {
|
||||
printf("\tCache Level: %d, Cache Size: %d KB, Cache type: 0x%x\n",
|
||||
cache_info.cache[i].cache_level,
|
||||
cache_info.cache[i].cache_size_kb,
|
||||
cache_info.cache[i].flags);
|
||||
cache_info.cache[i].cache_size,
|
||||
cache_info.cache[i].properties);
|
||||
printf("\tMax number CU shared: %d, Number of instances: %d\n",
|
||||
cache_info.cache[i].max_num_cu_shared,
|
||||
cache_info.cache[i].num_cache_instance);
|
||||
|
||||
+336
-9
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
@@ -75,6 +75,9 @@ class AMDSmiSystem {
|
||||
amdsmi_status_t gpu_index_to_handle(uint32_t gpu_index,
|
||||
amdsmi_processor_handle* processor_handle);
|
||||
|
||||
amdsmi_status_t get_cpu_family(uint32_t *cpu_family);
|
||||
|
||||
amdsmi_status_t get_cpu_model(uint32_t *cpu_model);
|
||||
private:
|
||||
AMDSmiSystem() : init_flag_(AMDSMI_INIT_AMD_GPUS) {}
|
||||
|
||||
|
||||
@@ -472,11 +472,26 @@ Input parameters:
|
||||
* `processor_handle` device which to query
|
||||
|
||||
Output: Dictionary of Dictionaries containing cache information
|
||||
Schema: { cache_index:
|
||||
{
|
||||
cache_properties:
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
cache_size: {"type" : "number"},
|
||||
cache_level: {"type" : "number"},
|
||||
max_num_cu_shared: {"type" : "number"},
|
||||
num_cache_instance: {"type" : "number"}
|
||||
}
|
||||
}
|
||||
|
||||
Field | Description
|
||||
---|---
|
||||
`cache_index` | cache index - up to 10 caches will be available
|
||||
`cache_flags` | list of up to 4 cache property type strings. Ex. data ("DATA_CACHE"), instruction ("INST_CACHE"), CPU ("CPU_CACHE"), or SIMD ("SIMD_CACHE").
|
||||
`cache_index` | cache index is a string of format "cache_#" up to 10 caches will be available
|
||||
`cache_properties` | list of up to 4 cache property type strings. Ex. data ("DATA_CACHE"), instruction ("INST_CACHE"), CPU ("CPU_CACHE"), or SIMD ("SIMD_CACHE").
|
||||
`cache_size` | size of cache in KB
|
||||
`cache_level` | level of cache
|
||||
`max_num_cu_shared` | max number of compute units shared
|
||||
@@ -2091,7 +2106,7 @@ Output: Dictionary with fields
|
||||
`average_umc_activity` | Average umc (Universal Memory Controller) activity | %
|
||||
`average_mm_activity` | Average mm (multimedia) engine activity | %
|
||||
`average_socket_power` | Average socket power | W
|
||||
`energy_accumulator` | Energy accumulated with a 15.3 uJ resolution over 1ns | uJ
|
||||
`energy_accumulator` | Energy accumulated with a 15.3 uJ resolution over 1ns | uJ
|
||||
`system_clock_counter` | System clock counter | ns
|
||||
`average_gfxclk_frequency` | Average gfx clock frequency | MHz
|
||||
`average_socclk_frequency` | Average soc clock frequency | MHz
|
||||
@@ -2119,7 +2134,7 @@ Output: Dictionary with fields
|
||||
`voltage_soc` | soc voltage | mV
|
||||
`voltage_gfx` | gfx voltage | mV
|
||||
`voltage_mem` | mem voltage | mV
|
||||
`indep_throttle_status` | ASIC independent throttle status (see drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h for bit flags) |
|
||||
`indep_throttle_status` | ASIC independent throttle status (see drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h for bit flags) |
|
||||
`current_socket_power` | Current socket power (also known as instant socket power) | W
|
||||
`vcn_activity` | List of VCN encode/decode engine utilization per AID | %
|
||||
`gfxclk_lock_status` | Clock lock status. Each bit corresponds to clock instance. |
|
||||
@@ -6023,3 +6038,43 @@ try:
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
### amdsmi_get_cpu_family
|
||||
|
||||
Description: Get cpu family.
|
||||
|
||||
Output: cpu family
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_get_cpu_family` function:
|
||||
|
||||
* `AmdSmiLibraryException`
|
||||
|
||||
Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
cpu_family = amdsmi_get_cpu_family()
|
||||
print(cpu_family)
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
### amdsmi_get_cpu_model
|
||||
|
||||
Description: Get cpu model.
|
||||
|
||||
Output: cpu model
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_get_cpu_model` function:
|
||||
|
||||
* `AmdSmiLibraryException`
|
||||
|
||||
Example:
|
||||
|
||||
```python
|
||||
try:
|
||||
cpu_model = amdsmi_get_cpu_model()
|
||||
print(cpu_model)
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
@@ -72,6 +72,8 @@ try:
|
||||
from .amdsmi_interface import amdsmi_get_metrics_table_version
|
||||
from .amdsmi_interface import amdsmi_get_metrics_table
|
||||
from .amdsmi_interface import amdsmi_first_online_core_on_cpu_socket
|
||||
from .amdsmi_interface import amdsmi_get_cpu_family
|
||||
from .amdsmi_interface import amdsmi_get_cpu_model
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ from . import amdsmi_wrapper
|
||||
from .amdsmi_exception import *
|
||||
import sys
|
||||
import math
|
||||
from time import localtime, asctime, time
|
||||
|
||||
MAX_NUM_PROCESSES = 1024
|
||||
|
||||
@@ -1413,6 +1414,10 @@ def amdsmi_get_metrics_table(
|
||||
)
|
||||
)
|
||||
|
||||
rawtime = int(mtbl.timestamp)
|
||||
rawtime = time()
|
||||
timeinfo = localtime(rawtime)
|
||||
|
||||
return {
|
||||
"mtbl_accumulation_counter": mtbl.accumulation_counter,
|
||||
"mtbl_max_socket_temperature": f"{round(check_msb_32(mtbl.max_socket_temperature) * fraction_q10 ,3)} °C",
|
||||
@@ -1425,6 +1430,7 @@ def amdsmi_get_metrics_table(
|
||||
"mtbl_max_socket_power_limit": f"{round(mtbl.max_socket_power_limit * fraction_uq10 ,3)} W",
|
||||
"mtbl_socket_power": f"{round(mtbl.socket_power * fraction_uq10 ,3)} W",
|
||||
"mtbl_timestamp_raw": mtbl.timestamp,
|
||||
"mtbl_timestamp_readable": f"{asctime(timeinfo)}",
|
||||
"mtbl_socket_energy_acc": f"{round((mtbl.socket_energy_acc * fraction_uq16)/KILO ,3)} kJ",
|
||||
"mtbl_ccd_energy_acc": f"{round((mtbl.ccd_energy_acc * fraction_uq16)/KILO ,3)} kJ",
|
||||
"mtbl_xcd_energy_acc": f"{round((mtbl.xcd_energy_acc * fraction_uq16)/KILO ,3)} kJ",
|
||||
@@ -1459,11 +1465,11 @@ def amdsmi_get_metrics_table(
|
||||
"mtbl_xgmi_write_bandwidth_acc": f"{[round(x*fraction_uq10 ,3) for x in list(mtbl.xgmi_write_bandwidth_acc)]} Gbps",
|
||||
"mtbl_socket_c0_residency": f"{round(mtbl.socket_c0_residency * fraction_uq10 ,3)} %",
|
||||
"mtbl_socket_gfx_busy": f"{round(mtbl.socket_gfx_busy * fraction_uq10 ,3)} %",
|
||||
"mtbl_dram_bandwidth_utilization": f"{round(mtbl.dram_bandwidth_utilization * fraction_uq10 ,3)} %",
|
||||
"mtbl_hbm_bandwidth_utilization": f"{round(mtbl.dram_bandwidth_utilization * fraction_uq10 ,3)} %",
|
||||
"mtbl_socket_c0_residency_acc": round(mtbl.socket_c0_residency_acc * fraction_uq10 ,3),
|
||||
"mtbl_socket_gfx_busy_acc": round(mtbl.socket_gfx_busy_acc * fraction_uq10 ,3),
|
||||
"mtbl_dram_bandwidth_acc": f"{round(mtbl.dram_bandwidth_acc * fraction_uq10 ,3)} Gbps",
|
||||
"mtbl_max_dram_bandwidth": f"{round(mtbl.max_dram_bandwidth * fraction_uq10 ,3)} Gbps",
|
||||
"mtbl_hbm_bandwidth_acc": f"{round(mtbl.dram_bandwidth_acc * fraction_uq10 ,3)} Gbps",
|
||||
"mtbl_max_hbm_bandwidth": f"{round(mtbl.max_dram_bandwidth * fraction_uq10 ,3)} Gbps",
|
||||
"mtbl_dram_bandwidth_utilization_acc": round(mtbl.dram_bandwidth_utilization_acc * fraction_uq10 ,3),
|
||||
"mtbl_pcie_bandwidth_acc": f"{[round(x*fraction_uq10 ,3) for x in list(mtbl.pcie_bandwidth_acc)]} Gbps",
|
||||
"mtbl_prochot_residency_acc": mtbl.prochot_residency_acc,
|
||||
@@ -1490,6 +1496,20 @@ def amdsmi_first_online_core_on_cpu_socket(
|
||||
|
||||
return pcore_ind.value
|
||||
|
||||
def amdsmi_get_cpu_family():
|
||||
family = ctypes.c_uint32()
|
||||
_check_res(
|
||||
amdsmi_wrapper.amdsmi_get_cpu_family(ctypes.byref(family))
|
||||
)
|
||||
return family.value
|
||||
|
||||
def amdsmi_get_cpu_model():
|
||||
model = ctypes.c_uint32()
|
||||
_check_res(
|
||||
amdsmi_wrapper.amdsmi_get_cpu_model(ctypes.byref(model))
|
||||
)
|
||||
return model.value
|
||||
|
||||
def amdsmi_init(flag=AmdSmiInitFlags.INIT_AMD_GPUS):
|
||||
if not isinstance(flag, AmdSmiInitFlags):
|
||||
raise AmdSmiParameterException(flag, AmdSmiInitFlags)
|
||||
@@ -1619,30 +1639,32 @@ def amdsmi_get_gpu_cache_info(
|
||||
|
||||
cache_info_dict = {}
|
||||
for cache_index in range(cache_info.num_cache_types):
|
||||
# Put cache_properties at the start of the dictionary for readability
|
||||
cache_dict = {
|
||||
"cache_properties": [],
|
||||
"cache_size": cache_info.cache[cache_index].cache_size_kb,
|
||||
"cache_size": cache_info.cache[cache_index].cache_size,
|
||||
"cache_level": cache_info.cache[cache_index].cache_level,
|
||||
"max_num_cu_shared": cache_info.cache[cache_index].max_num_cu_shared,
|
||||
"num_cache_instance": cache_info.cache[cache_index].num_cache_instance
|
||||
}
|
||||
|
||||
cache_flags = cache_info.cache[cache_index].flags
|
||||
data_cache = cache_flags & amdsmi_wrapper.CACHE_FLAGS_DATA_CACHE
|
||||
inst_cache = cache_flags & amdsmi_wrapper.CACHE_FLAGS_INST_CACHE
|
||||
cpu_cache = cache_flags & amdsmi_wrapper.CACHE_FLAGS_CPU_CACHE
|
||||
simd_cache = cache_flags & amdsmi_wrapper.CACHE_FLAGS_SIMD_CACHE
|
||||
# Check against cache properties bitmask
|
||||
cache_properties = cache_info.cache[cache_index].properties
|
||||
data_cache = cache_properties & amdsmi_wrapper.CACHE_PROPERTIES_DATA_CACHE
|
||||
inst_cache = cache_properties & amdsmi_wrapper.CACHE_PROPERTIES_INST_CACHE
|
||||
cpu_cache = cache_properties & amdsmi_wrapper.CACHE_PROPERTIES_CPU_CACHE
|
||||
simd_cache = cache_properties & amdsmi_wrapper.CACHE_PROPERTIES_SIMD_CACHE
|
||||
|
||||
cache_flags_status = [data_cache, inst_cache, cpu_cache, simd_cache]
|
||||
cache_flag_list = []
|
||||
for cache_flag in cache_flags_status:
|
||||
if cache_flag:
|
||||
flag_name = amdsmi_wrapper.amdsmi_cache_flags_type_t__enumvalues[cache_flag]
|
||||
flag_name = flag_name.replace("CACHE_FLAGS_", "")
|
||||
cache_flag_list.append(flag_name)
|
||||
cache_properties_status = [data_cache, inst_cache, cpu_cache, simd_cache]
|
||||
cache_property_list = []
|
||||
for cache_property in cache_properties_status:
|
||||
if cache_property:
|
||||
property_name = amdsmi_wrapper.amdsmi_cache_properties_type_t__enumvalues[cache_property]
|
||||
property_name = property_name.replace("CACHE_PROPERTIES_", "")
|
||||
cache_property_list.append(property_name)
|
||||
|
||||
cache_dict["cache_properties"] = cache_flag_list
|
||||
cache_info_dict[f"cache {cache_index}"] = cache_dict
|
||||
cache_dict["cache_properties"] = cache_property_list
|
||||
cache_info_dict[f"cache_{cache_index}"] = cache_dict
|
||||
|
||||
if not cache_info_dict:
|
||||
raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NO_DATA)
|
||||
|
||||
@@ -813,20 +813,20 @@ struct_amdsmi_vbios_info_t._fields_ = [
|
||||
|
||||
amdsmi_vbios_info_t = struct_amdsmi_vbios_info_t
|
||||
|
||||
# values for enumeration 'amdsmi_cache_flags_type_t'
|
||||
amdsmi_cache_flags_type_t__enumvalues = {
|
||||
1: 'CACHE_FLAGS_ENABLED',
|
||||
2: 'CACHE_FLAGS_DATA_CACHE',
|
||||
4: 'CACHE_FLAGS_INST_CACHE',
|
||||
8: 'CACHE_FLAGS_CPU_CACHE',
|
||||
16: 'CACHE_FLAGS_SIMD_CACHE',
|
||||
# values for enumeration 'amdsmi_cache_properties_type_t'
|
||||
amdsmi_cache_properties_type_t__enumvalues = {
|
||||
1: 'CACHE_PROPERTIES_ENABLED',
|
||||
2: 'CACHE_PROPERTIES_DATA_CACHE',
|
||||
4: 'CACHE_PROPERTIES_INST_CACHE',
|
||||
8: 'CACHE_PROPERTIES_CPU_CACHE',
|
||||
16: 'CACHE_PROPERTIES_SIMD_CACHE',
|
||||
}
|
||||
CACHE_FLAGS_ENABLED = 1
|
||||
CACHE_FLAGS_DATA_CACHE = 2
|
||||
CACHE_FLAGS_INST_CACHE = 4
|
||||
CACHE_FLAGS_CPU_CACHE = 8
|
||||
CACHE_FLAGS_SIMD_CACHE = 16
|
||||
amdsmi_cache_flags_type_t = ctypes.c_uint32 # enum
|
||||
CACHE_PROPERTIES_ENABLED = 1
|
||||
CACHE_PROPERTIES_DATA_CACHE = 2
|
||||
CACHE_PROPERTIES_INST_CACHE = 4
|
||||
CACHE_PROPERTIES_CPU_CACHE = 8
|
||||
CACHE_PROPERTIES_SIMD_CACHE = 16
|
||||
amdsmi_cache_properties_type_t = ctypes.c_uint32 # enum
|
||||
class struct_amdsmi_gpu_cache_info_t(Structure):
|
||||
pass
|
||||
|
||||
@@ -835,9 +835,9 @@ class struct_cache_(Structure):
|
||||
|
||||
struct_cache_._pack_ = 1 # source:False
|
||||
struct_cache_._fields_ = [
|
||||
('cache_size_kb', ctypes.c_uint32),
|
||||
('cache_size', ctypes.c_uint32),
|
||||
('cache_level', ctypes.c_uint32),
|
||||
('flags', ctypes.c_uint32),
|
||||
('properties', ctypes.c_uint32),
|
||||
('max_num_cu_shared', ctypes.c_uint32),
|
||||
('num_cache_instance', ctypes.c_uint32),
|
||||
('reserved', ctypes.c_uint32 * 3),
|
||||
@@ -2294,6 +2294,12 @@ amdsmi_get_metrics_table.argtypes = [amdsmi_processor_handle, ctypes.POINTER(str
|
||||
amdsmi_first_online_core_on_cpu_socket = _libraries['libamd_smi.so'].amdsmi_first_online_core_on_cpu_socket
|
||||
amdsmi_first_online_core_on_cpu_socket.restype = amdsmi_status_t
|
||||
amdsmi_first_online_core_on_cpu_socket.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32)]
|
||||
amdsmi_get_cpu_family = _libraries['libamd_smi.so'].amdsmi_get_cpu_family
|
||||
amdsmi_get_cpu_family.restype = amdsmi_status_t
|
||||
amdsmi_get_cpu_family.argtypes = [ctypes.POINTER(ctypes.c_uint32)]
|
||||
amdsmi_get_cpu_model = _libraries['libamd_smi.so'].amdsmi_get_cpu_model
|
||||
amdsmi_get_cpu_model.restype = amdsmi_status_t
|
||||
amdsmi_get_cpu_model.argtypes = [ctypes.POINTER(ctypes.c_uint32)]
|
||||
amdsmi_get_esmi_err_msg = _libraries['libamd_smi.so'].amdsmi_get_esmi_err_msg
|
||||
amdsmi_get_esmi_err_msg.restype = amdsmi_status_t
|
||||
amdsmi_get_esmi_err_msg.argtypes = [amdsmi_status_t, ctypes.POINTER(ctypes.POINTER(ctypes.c_char))]
|
||||
@@ -2415,9 +2421,9 @@ __all__ = \
|
||||
'AMDSMI_VRAM_VENDOR__WINBOND', 'AMDSMI_XGMI_STATUS_ERROR',
|
||||
'AMDSMI_XGMI_STATUS_MULTIPLE_ERRORS',
|
||||
'AMDSMI_XGMI_STATUS_NO_ERRORS', 'AMD_APU', 'AMD_CPU',
|
||||
'AMD_CPU_CORE', 'AMD_GPU', 'CACHE_FLAGS_CPU_CACHE',
|
||||
'CACHE_FLAGS_DATA_CACHE', 'CACHE_FLAGS_ENABLED',
|
||||
'CACHE_FLAGS_INST_CACHE', 'CACHE_FLAGS_SIMD_CACHE',
|
||||
'AMD_CPU_CORE', 'AMD_GPU', 'CACHE_PROPERTIES_CPU_CACHE',
|
||||
'CACHE_PROPERTIES_DATA_CACHE', 'CACHE_PROPERTIES_ENABLED',
|
||||
'CACHE_PROPERTIES_INST_CACHE', 'CACHE_PROPERTIES_SIMD_CACHE',
|
||||
'CLK_TYPE_DCEF', 'CLK_TYPE_DCLK0', 'CLK_TYPE_DCLK1',
|
||||
'CLK_TYPE_DF', 'CLK_TYPE_FIRST', 'CLK_TYPE_GFX', 'CLK_TYPE_MEM',
|
||||
'CLK_TYPE_PCIE', 'CLK_TYPE_SOC', 'CLK_TYPE_SYS', 'CLK_TYPE_VCLK0',
|
||||
@@ -2465,7 +2471,7 @@ __all__ = \
|
||||
'VRAM_TYPE_GDDR6', 'VRAM_TYPE_HBM', 'VRAM_TYPE_UNKNOWN',
|
||||
'VRAM_TYPE__MAX', 'WR_BW0', 'amd_metrics_table_header_t',
|
||||
'amdsmi_asic_info_t', 'amdsmi_bdf_t', 'amdsmi_bit_field_t',
|
||||
'amdsmi_board_info_t', 'amdsmi_cache_flags_type_t',
|
||||
'amdsmi_board_info_t', 'amdsmi_cache_properties_type_t',
|
||||
'amdsmi_card_form_factor_t', 'amdsmi_clk_info_t',
|
||||
'amdsmi_clk_type_t', 'amdsmi_compute_partition_type_t',
|
||||
'amdsmi_container_types_t', 'amdsmi_counter_command_t',
|
||||
@@ -2490,8 +2496,9 @@ __all__ = \
|
||||
'amdsmi_get_cpu_current_xgmi_bw', 'amdsmi_get_cpu_ddr_bw',
|
||||
'amdsmi_get_cpu_dimm_power_consumption',
|
||||
'amdsmi_get_cpu_dimm_temp_range_and_refresh_rate',
|
||||
'amdsmi_get_cpu_dimm_thermal_sensor', 'amdsmi_get_cpu_fclk_mclk',
|
||||
'amdsmi_get_cpu_hsmp_proto_ver', 'amdsmi_get_cpu_prochot_status',
|
||||
'amdsmi_get_cpu_dimm_thermal_sensor', 'amdsmi_get_cpu_family',
|
||||
'amdsmi_get_cpu_fclk_mclk', 'amdsmi_get_cpu_hsmp_proto_ver',
|
||||
'amdsmi_get_cpu_model', 'amdsmi_get_cpu_prochot_status',
|
||||
'amdsmi_get_cpu_pwr_svi_telemetry_all_rails',
|
||||
'amdsmi_get_cpu_smu_fw_version',
|
||||
'amdsmi_get_cpu_socket_c0_residency',
|
||||
|
||||
@@ -738,7 +738,7 @@ rsmi_dev_ecc_count_get(uint32_t dv_ind, rsmi_gpu_block_t block,
|
||||
ret = GetDevValueVec(type, dv_ind, &val_vec);
|
||||
if (val_vec.size() < 2 ) ret = RSMI_STATUS_FILE_ERROR;
|
||||
|
||||
if (ret == RSMI_STATUS_FILE_ERROR || val_vec.size() != 2) {
|
||||
if (ret == RSMI_STATUS_FILE_ERROR) {
|
||||
ss << __PRETTY_FUNCTION__ << " | ======= end ======="
|
||||
<< ", GetDevValueVec() ret was RSMI_STATUS_FILE_ERROR "
|
||||
<< "-> reporting RSMI_STATUS_NOT_SUPPORTED";
|
||||
|
||||
@@ -445,23 +445,22 @@ amdsmi_status_t amdsmi_get_gpu_cache_info(
|
||||
|
||||
info->num_cache_types = rsmi_info.num_cache_types;
|
||||
for (unsigned int i =0; i < rsmi_info.num_cache_types; i++) {
|
||||
info->cache[i].cache_size_kb = rsmi_info.cache[i].cache_size_kb;
|
||||
info->cache[i].cache_size = rsmi_info.cache[i].cache_size_kb;
|
||||
info->cache[i].cache_level = rsmi_info.cache[i].cache_level;
|
||||
info->cache[i].max_num_cu_shared = rsmi_info.cache[i].max_num_cu_shared;
|
||||
info->cache[i].num_cache_instance = rsmi_info.cache[i].num_cache_instance;
|
||||
// convert from sysfs type to CRAT type(HSA Cache Affinity type)
|
||||
info->cache[i].flags = 0;
|
||||
info->cache[i].properties = 0;
|
||||
if (rsmi_info.cache[i].flags & HSA_CACHE_TYPE_DATA)
|
||||
info->cache[i].flags |= CACHE_FLAGS_DATA_CACHE;
|
||||
info->cache[i].properties |= CACHE_PROPERTIES_DATA_CACHE;
|
||||
if (rsmi_info.cache[i].flags & HSA_CACHE_TYPE_INSTRUCTION)
|
||||
info->cache[i].flags |= CACHE_FLAGS_INST_CACHE;
|
||||
info->cache[i].properties |= CACHE_PROPERTIES_INST_CACHE;
|
||||
if (rsmi_info.cache[i].flags & HSA_CACHE_TYPE_CPU)
|
||||
info->cache[i].flags |= CACHE_FLAGS_CPU_CACHE;
|
||||
info->cache[i].properties |= CACHE_PROPERTIES_CPU_CACHE;
|
||||
if (rsmi_info.cache[i].flags & HSA_CACHE_TYPE_HSACU)
|
||||
info->cache[i].flags |= CACHE_FLAGS_SIMD_CACHE;
|
||||
info->cache[i].properties |= CACHE_PROPERTIES_SIMD_CACHE;
|
||||
}
|
||||
|
||||
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -3082,6 +3081,38 @@ amdsmi_status_t amdsmi_first_online_core_on_cpu_socket(amdsmi_processor_handle p
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_get_cpu_family(uint32_t *cpu_family)
|
||||
{
|
||||
amdsmi_status_t status;
|
||||
uint32_t family;
|
||||
|
||||
AMDSMI_CHECK_INIT();
|
||||
|
||||
status = amd::smi::AMDSmiSystem::getInstance().get_cpu_family(&family);
|
||||
if (status != AMDSMI_STATUS_SUCCESS)
|
||||
return amdsmi_errno_to_esmi_status(status);
|
||||
|
||||
*cpu_family = family;
|
||||
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_get_cpu_model(uint32_t *cpu_model)
|
||||
{
|
||||
amdsmi_status_t status;
|
||||
uint32_t model;
|
||||
|
||||
AMDSMI_CHECK_INIT();
|
||||
|
||||
status = amd::smi::AMDSmiSystem::getInstance().get_cpu_model(&model);
|
||||
if (status != AMDSMI_STATUS_SUCCESS)
|
||||
return amdsmi_errno_to_esmi_status(status);
|
||||
|
||||
*cpu_model = model;
|
||||
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_get_esmi_err_msg(amdsmi_status_t status, const char **status_string)
|
||||
{
|
||||
for (auto& iter : amd::smi::esmi_status_map) {
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace smi {
|
||||
|
||||
#define AMD_SMI_INIT_FLAG_RESRV_TEST1 0x800000000000000 //!< Reserved for test
|
||||
|
||||
static amdsmi_status_t get_cpu_family(uint32_t *cpu_family) {
|
||||
amdsmi_status_t AMDSmiSystem::get_cpu_family(uint32_t *cpu_family) {
|
||||
amdsmi_status_t ret;
|
||||
ret = static_cast<amdsmi_status_t>(esmi_cpu_family_get(cpu_family));
|
||||
|
||||
@@ -68,7 +68,7 @@ static amdsmi_status_t get_cpu_family(uint32_t *cpu_family) {
|
||||
}
|
||||
|
||||
|
||||
static amdsmi_status_t get_cpu_model(uint32_t *cpu_model) {
|
||||
amdsmi_status_t AMDSmiSystem::get_cpu_model(uint32_t *cpu_model) {
|
||||
amdsmi_status_t ret;
|
||||
ret = static_cast<amdsmi_status_t>(esmi_cpu_model_get(cpu_model));
|
||||
|
||||
|
||||
@@ -522,6 +522,7 @@ amdsmi_status_t smi_amdgpu_get_market_name_from_dev_id(uint32_t device_id, char
|
||||
break;
|
||||
case 0x73a1:
|
||||
case 0x73ae:
|
||||
case 0x73bf:
|
||||
strcpy(market_name, "NAVI21");
|
||||
break;
|
||||
case 0x74b4:
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
import re
|
||||
import argparse
|
||||
|
||||
def get_platforms(file_name):
|
||||
# removing the new line characters
|
||||
with open(file_name) as f:
|
||||
lines = [line.rstrip() for line in f]
|
||||
|
||||
platform_map = {}
|
||||
platform_lines = ""
|
||||
function_line = ""
|
||||
for line in lines:
|
||||
if "@platform" in line:
|
||||
platform_lines += line.replace("*","").lstrip()
|
||||
if platform_lines =="":
|
||||
continue
|
||||
l = line.lstrip()
|
||||
if len(l) == 0:
|
||||
continue
|
||||
if l[0] == '*' or l[0]== '#' or (len(l)>1 and l[0] == '/' and l[1] == '*'):
|
||||
if function_line != "":
|
||||
func = ' '.join(function_line.split())
|
||||
platforms = re.findall(r"\{(.*?)\}", platform_lines)
|
||||
for p in platforms:
|
||||
if p not in platform_map:
|
||||
platform_map[p]=[func]
|
||||
else:
|
||||
platform_map[p].append(func)
|
||||
platform_lines = ""
|
||||
function_line = ""
|
||||
continue
|
||||
function_line += line + " "
|
||||
return platform_map
|
||||
|
||||
# string in list1 but not in list2
|
||||
def diff(list1, list2):
|
||||
result = []
|
||||
for l1 in list1:
|
||||
if l1 not in list2:
|
||||
result.append(l1)
|
||||
return result
|
||||
|
||||
def common(list1, list2):
|
||||
result = []
|
||||
for l1 in list1:
|
||||
if l1 in list2:
|
||||
result.append(l1)
|
||||
return result
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser(description='amdsmi platform classifier')
|
||||
parser.add_argument('--platforms', default=False, action='store_true', help='list supported platforms')
|
||||
parser.add_argument('--list', default="", metavar="platform" , help='List function in a platform')
|
||||
parser.add_argument('--diff' , default=None, metavar="platform", nargs=2, help='Find the APIs in platform1 but not in platform2')
|
||||
parser.add_argument('--common' , default=None, metavar="platform", nargs=2, help='Find the common APIs of two platforms')
|
||||
|
||||
file_name="../include/amd_smi/amdsmi.h"
|
||||
args = parser.parse_args()
|
||||
platform_map=get_platforms(file_name)
|
||||
if args.platforms:
|
||||
for p in platform_map:
|
||||
print (p)
|
||||
exit(0)
|
||||
|
||||
if args.list:
|
||||
if args.list not in platform_map:
|
||||
print("Unknown platform ", args.list)
|
||||
exit(1)
|
||||
for f in platform_map[args.list]:
|
||||
print (f)
|
||||
exit(0)
|
||||
|
||||
if args.diff != None:
|
||||
if args.diff[0] not in platform_map or args.diff[1] not in platform_map:
|
||||
print("Unknown platforms ", args.diff)
|
||||
exit(1)
|
||||
platforms0 = platform_map[args.diff[0]]
|
||||
platforms1 = platform_map[args.diff[1]]
|
||||
result = diff(platforms0, platforms1)
|
||||
print("APIs in", args.diff[0], "but not in", args.diff[1])
|
||||
for f in result:
|
||||
print(f)
|
||||
exit(0)
|
||||
|
||||
|
||||
if args.common != None:
|
||||
if args.common[0] not in platform_map or args.common[1] not in platform_map:
|
||||
print("Unknown platforms ", args.common)
|
||||
exit(1)
|
||||
platforms0 = platform_map[args.common[0]]
|
||||
platforms1 = platform_map[args.common[1]]
|
||||
result = common(platforms0, platforms1)
|
||||
print("APIs in both ", args.common[0], "and", args.common[1])
|
||||
for f in result:
|
||||
print(f)
|
||||
exit(0)
|
||||
|
||||
parser.print_help()
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário