Unified API
amdsmi_get_link_metrics() and amdsmi_get_pcie_info()
Change-Id: Iea060e449813b842236243b772e8809497ce98fe
[ROCm/amdsmi commit: 0b67c2ccc4]
Этот коммит содержится в:
коммит произвёл
Maisam Arif
родитель
a8b48ff1e5
Коммит
25ffbb0304
@@ -347,7 +347,7 @@ class AMDSMICommands():
|
||||
logging.debug("Failed to get bdf for gpu %s | %s", gpu_id, e.get_error_info())
|
||||
|
||||
try:
|
||||
link_caps = amdsmi_interface.amdsmi_get_pcie_link_caps(args.gpu)
|
||||
link_caps = amdsmi_interface.amdsmi_get_pcie_info(args.gpu)
|
||||
bus_info.update(link_caps)
|
||||
if bus_info['max_pcie_speed'] % 1000 != 0:
|
||||
pcie_speed_GTs_value = round(bus_info['max_pcie_speed'] / 1000, 1)
|
||||
@@ -358,9 +358,9 @@ class AMDSMICommands():
|
||||
|
||||
slot_type = bus_info.pop('pcie_slot_type')
|
||||
if isinstance(slot_type, int):
|
||||
slot_types = amdsmi_interface.amdsmi_wrapper.amdsmi_pcie_slot_type_t__enumvalues
|
||||
slot_types = amdsmi_interface.amdsmi_wrapper.amdsmi_card_form_factor_t__enumvalues
|
||||
if slot_type in slot_types:
|
||||
bus_info['slot_type'] = slot_types[slot_type].replace("AMDSMI_SLOT_TYPE__", "")
|
||||
bus_info['slot_type'] = slot_types[slot_type].replace("AMDSMI_CARD_FORM_FACTOR_", "")
|
||||
else:
|
||||
bus_info['slot_type'] = "Unknown"
|
||||
else:
|
||||
@@ -1381,7 +1381,7 @@ class AMDSMICommands():
|
||||
"max_packet_size": "N/A"}
|
||||
|
||||
try:
|
||||
pcie_link_status = amdsmi_interface.amdsmi_get_pcie_link_status(args.gpu)
|
||||
pcie_link_status = amdsmi_interface.amdsmi_get_pcie_info(args.gpu)
|
||||
|
||||
if pcie_link_status['pcie_speed'] % 1000 != 0:
|
||||
pcie_speed_GTs_value = round(pcie_link_status['pcie_speed'] / 1000, 1)
|
||||
|
||||
@@ -392,22 +392,16 @@ int main() {
|
||||
|
||||
// Get PCIe status
|
||||
amdsmi_pcie_info_t pcie_info = {};
|
||||
ret = amdsmi_get_pcie_link_status(processor_handles[j], &pcie_info);
|
||||
ret = amdsmi_get_pcie_info(processor_handles[j], &pcie_info);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf(" Output of amdsmi_get_pcie_link_status:\n");
|
||||
printf("\tCurrent PCIe lanes: %d\n", pcie_info.pcie_lanes);
|
||||
printf("\tCurrent PCIe speed: %d\n", pcie_info.pcie_speed);
|
||||
printf("\tCurrent PCIe Interface Version: %d\n", pcie_info.pcie_interface_version);
|
||||
printf("\tPCIe slot type: %d\n\n", pcie_info.pcie_slot_type);
|
||||
|
||||
// Get PCIe caps
|
||||
amdsmi_pcie_info_t pcie_caps_info = {};
|
||||
ret = amdsmi_get_pcie_link_caps(processor_handles[j], &pcie_caps_info);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf(" Output of amdsmi_get_pcie_link_caps:\n");
|
||||
printf("\tPCIe max lanes: %d\n", pcie_caps_info.pcie_lanes);
|
||||
printf("\tPCIe max speed: %d\n", pcie_caps_info.pcie_speed);
|
||||
printf("\tPCIe Interface Version: %d\n\n", pcie_caps_info.pcie_interface_version);
|
||||
printf(" Output of amdsmi_get_pcie_info:\n");
|
||||
printf("\tCurrent PCIe lanes: %d\n", pcie_info.pcie_metric.pcie_lanes);
|
||||
printf("\tCurrent PCIe speed: %d\n", pcie_info.pcie_metric.pcie_speed);
|
||||
printf("\tCurrent PCIe Interface Version: %d\n",
|
||||
pcie_info.pcie_static.pcie_interface_version);
|
||||
printf("\tPCIe slot type: %d\n", pcie_info.pcie_static.slot_type);
|
||||
printf("\tPCIe max lanes: %d\n", pcie_info.pcie_static.max_pcie_lanes);
|
||||
printf("\tPCIe max speed: %d\n", pcie_info.pcie_static.max_pcie_speed);
|
||||
|
||||
// Get VRAM temperature limit
|
||||
int64_t temperature = 0;
|
||||
|
||||
@@ -76,16 +76,17 @@ typedef enum {
|
||||
} amdsmi_init_flags_t;
|
||||
|
||||
/* Maximum size definitions AMDSMI */
|
||||
#define AMDSMI_MAX_MM_IP_COUNT 8
|
||||
#define AMDSMI_MAX_DATE_LENGTH 32 /**< YYYY-MM-DD:HH:MM:SS.MSC */
|
||||
#define AMDSMI_MAX_STRING_LENGTH 64
|
||||
#define AMDSMI_NORMAL_STRING_LENGTH 32
|
||||
#define AMDSMI_MAX_DEVICES 32
|
||||
#define AMDSMI_MAX_NAME 32
|
||||
#define AMDSMI_MAX_MM_IP_COUNT 8
|
||||
#define AMDSMI_MAX_DATE_LENGTH 32 /**< YYYY-MM-DD:HH:MM:SS.MSC */
|
||||
#define AMDSMI_MAX_STRING_LENGTH 64
|
||||
#define AMDSMI_NORMAL_STRING_LENGTH 32
|
||||
#define AMDSMI_MAX_DEVICES 32
|
||||
#define AMDSMI_MAX_NAME 32
|
||||
#define AMDSMI_MAX_DRIVER_VERSION_LENGTH 80
|
||||
#define AMDSMI_PRODUCT_NAME_LENGTH 128
|
||||
#define AMDSMI_MAX_CONTAINER_TYPE 2
|
||||
#define AMDSMI_MAX_CACHE_TYPES 10
|
||||
#define AMDSMI_MAX_NUM_XGMI_PHYSICAL_LINK 64
|
||||
|
||||
#define AMDSMI_GPU_UUID_SIZE 38
|
||||
|
||||
@@ -170,8 +171,8 @@ typedef enum {
|
||||
} amdsmi_mm_ip_t;
|
||||
|
||||
typedef enum {
|
||||
CONTAINER_LXC,
|
||||
CONTAINER_DOCKER,
|
||||
CONTAINER_LXC,
|
||||
CONTAINER_DOCKER,
|
||||
} amdsmi_container_types_t;
|
||||
|
||||
//! opaque handler point to underlying implementation
|
||||
@@ -476,9 +477,9 @@ typedef struct {
|
||||
} amdsmi_vram_usage_t;
|
||||
|
||||
typedef struct {
|
||||
amdsmi_range_t supported_freq_range;
|
||||
amdsmi_range_t current_freq_range;
|
||||
uint32_t reserved[8];
|
||||
amdsmi_range_t supported_freq_range;
|
||||
amdsmi_range_t current_freq_range;
|
||||
uint32_t reserved[8];
|
||||
} amdsmi_frequency_range_t;
|
||||
|
||||
typedef union {
|
||||
@@ -491,6 +492,34 @@ typedef union {
|
||||
uint64_t as_uint;
|
||||
} amdsmi_bdf_t;
|
||||
|
||||
typedef enum {
|
||||
AMDSMI_CARD_FORM_FACTOR_PCIE,
|
||||
AMDSMI_CARD_FORM_FACTOR_OAM,
|
||||
AMDSMI_CARD_FORM_FACTOR_UNKNOWN
|
||||
} amdsmi_card_form_factor_t;
|
||||
|
||||
typedef struct {
|
||||
struct pcie_static_ {
|
||||
uint16_t max_pcie_lanes; //!< maximum number of PCIe lanes
|
||||
uint32_t max_pcie_speed; //!< maximum PCIe speed
|
||||
uint32_t pcie_interface_version; //!< PCIe interface version
|
||||
amdsmi_card_form_factor_t slot_type; //!< card form factor
|
||||
uint64_t reserved[10];
|
||||
} pcie_static;
|
||||
struct pcie_metric_ {
|
||||
uint32_t pcie_speed; //!< current PCIe speed in MT/s
|
||||
uint16_t pcie_lanes; //!< current PCIe width
|
||||
uint32_t pcie_bandwidth; //!< current PCIe bandwidth Mb/s
|
||||
uint64_t pcie_replay_count; //!< total number of the replays issued on the PCIe link
|
||||
uint64_t pcie_l0_to_recovery_count; //!< total number of times the PCIe link transitioned from L0 to the recovery state
|
||||
uint64_t pcie_replay_roll_over_count; //!< total number of replay rollovers issued on the PCIe link
|
||||
uint64_t pcie_nak_sent_count; //!< total number of NAKs issued on the PCIe link by the device
|
||||
uint64_t pcie_nak_received_count; //!< total number of NAKs issued on the PCIe link by the receiver
|
||||
uint64_t reserved[13];
|
||||
} pcie_metric;
|
||||
uint64_t reserved[32];
|
||||
} amdsmi_pcie_info_t;
|
||||
|
||||
typedef struct {
|
||||
uint64_t power_cap;
|
||||
uint64_t default_power_cap;
|
||||
@@ -554,7 +583,28 @@ typedef struct {
|
||||
uint16_t reserved[37];
|
||||
} amdsmi_asic_info_t;
|
||||
|
||||
typedef struct{
|
||||
typedef enum {
|
||||
AMDSMI_LINK_TYPE_PCIE,
|
||||
AMDSMI_LINK_TYPE_XGMI,
|
||||
AMDSMI_LINK_TYPE_NOT_APPLICABLE,
|
||||
AMDSMI_LINK_TYPE_UNKNOWN
|
||||
} amdsmi_link_type_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t num_links; //!< number of links
|
||||
struct _links {
|
||||
amdsmi_bdf_t bdf;
|
||||
uint32_t bit_rate; //!< current link speed in Gb/s
|
||||
uint32_t max_bandwidth; //!< max bandwidth of the link
|
||||
amdsmi_link_type_t link_type; //!< type of the link
|
||||
uint64_t read; //!< total data received for each link in KB
|
||||
uint64_t write; //!< total data transfered for each link in KB
|
||||
uint64_t reserved[2];
|
||||
} links[AMDSMI_MAX_NUM_XGMI_PHYSICAL_LINK];
|
||||
uint64_t reserved[7];
|
||||
} amdsmi_link_metrics_t;
|
||||
|
||||
typedef struct {
|
||||
amdsmi_vram_type_t vram_type;
|
||||
amdsmi_vram_vendor_type_t vram_vendor;
|
||||
uint64_t vram_size_mb;
|
||||
@@ -562,18 +612,18 @@ typedef struct{
|
||||
|
||||
|
||||
typedef struct {
|
||||
char driver_name[AMDSMI_MAX_STRING_LENGTH];
|
||||
char driver_version[AMDSMI_MAX_STRING_LENGTH];
|
||||
char driver_date[AMDSMI_MAX_STRING_LENGTH];
|
||||
char driver_version[AMDSMI_MAX_STRING_LENGTH];
|
||||
char driver_date[AMDSMI_MAX_STRING_LENGTH];
|
||||
char driver_name[AMDSMI_MAX_STRING_LENGTH];
|
||||
} amdsmi_driver_info_t;
|
||||
|
||||
typedef struct {
|
||||
bool is_master;
|
||||
char model_number[AMDSMI_NORMAL_STRING_LENGTH];
|
||||
char product_serial[AMDSMI_NORMAL_STRING_LENGTH];
|
||||
char fru_id[AMDSMI_NORMAL_STRING_LENGTH];
|
||||
char manufacturer_name[AMDSMI_NORMAL_STRING_LENGTH];
|
||||
char product_name[AMDSMI_PRODUCT_NAME_LENGTH];
|
||||
char manufacturer_name[AMDSMI_NORMAL_STRING_LENGTH];
|
||||
uint32_t reserved[32];
|
||||
} amdsmi_board_info_t;
|
||||
|
||||
typedef struct {
|
||||
@@ -1272,7 +1322,7 @@ typedef struct {
|
||||
/*
|
||||
* v1.2 additions
|
||||
*/
|
||||
// PMFW attached timestamp (10ns resolution)
|
||||
// PMFW attached timestamp (10ns resolution)
|
||||
uint64_t firmware_timestamp;
|
||||
|
||||
|
||||
@@ -1334,7 +1384,7 @@ typedef struct {
|
||||
*/
|
||||
// JPEG activity % per AID
|
||||
uint16_t jpeg_activity[AMDSMI_MAX_NUM_JPEG];
|
||||
|
||||
|
||||
// Memory Bandwidth Usage Accumulated (GB/sec)
|
||||
uint64_t mem_bandwidth_acc;
|
||||
|
||||
@@ -1390,27 +1440,6 @@ typedef struct {
|
||||
uint64_t reserved[2];
|
||||
} amdsmi_error_count_t;
|
||||
|
||||
/**
|
||||
* @brief This is a enum translation for pcie_slot_type
|
||||
*/
|
||||
typedef enum {
|
||||
AMDSMI_SLOT_TYPE__PCIE = 0,
|
||||
AMDSMI_SLOT_TYPE__CEM = 1,
|
||||
AMDSMI_SLOT_TYPE__OAM = 2,
|
||||
AMDSMI_SLOT_TYPE__RESERVED = 3,
|
||||
} amdsmi_pcie_slot_type_t;
|
||||
|
||||
/**
|
||||
* @brief This structure holds pcie info.
|
||||
*/
|
||||
typedef struct {
|
||||
uint16_t pcie_lanes;
|
||||
uint32_t pcie_speed;
|
||||
uint32_t pcie_interface_version;
|
||||
amdsmi_pcie_slot_type_t pcie_slot_type; // 0: PCIE, 1: CEM, 2: OAM, 3: Reserved
|
||||
uint32_t reserved[4];
|
||||
} amdsmi_pcie_info_t;
|
||||
|
||||
/**
|
||||
* @brief This structure contains information specific to a process.
|
||||
*/
|
||||
@@ -2687,37 +2716,6 @@ amdsmi_get_utilization_count(amdsmi_processor_handle processor_handle,
|
||||
uint32_t count,
|
||||
uint64_t *timestamp);
|
||||
|
||||
/**
|
||||
* @brief Get current PCIE info of the device with provided processor handle. It is not supported
|
||||
* on virtual machine guest
|
||||
*
|
||||
* @details Given a processor handle @p processor_handle, this function returns PCIE info of the
|
||||
* given device.
|
||||
*
|
||||
* @param[in] processor_handle a processor handle
|
||||
*
|
||||
* @param[out] info amdsmi_pcie_info_t struct which will hold all the extracted PCIE info data.
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_pcie_link_status(amdsmi_processor_handle processor_handle,
|
||||
amdsmi_pcie_info_t *info);
|
||||
|
||||
/**
|
||||
* @brief Get max PCIe capabilities of the device with provided processor handle.
|
||||
*
|
||||
* @details Given a processor handle @p processor_handle, this function returns PCIe caps info of the
|
||||
* given device.
|
||||
*
|
||||
* @param[in] processor_handle a processor handle
|
||||
*
|
||||
* @param[out] info amdsmi_pcie_info_t struct which will hold all the extracted PCIe caps data.
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_pcie_link_caps(amdsmi_processor_handle processor_handle,
|
||||
amdsmi_pcie_info_t *info);
|
||||
|
||||
/**
|
||||
* @brief Get the performance level of the device. It is not supported on virtual
|
||||
* machine guest
|
||||
@@ -3680,6 +3678,19 @@ amdsmi_reset_gpu_xgmi_error(amdsmi_processor_handle processor_handle);
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Return link metric information
|
||||
*
|
||||
* @param[in] processor_handle PF of a processor for which to query
|
||||
*
|
||||
* @param[out] link_metrics reference to the link metrics struct.
|
||||
* Must be allocated by user.
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_link_metrics(amdsmi_processor_handle processor_handle,
|
||||
amdsmi_link_metrics_t *link_metrics);
|
||||
|
||||
/**
|
||||
* @brief Retrieve the NUMA CPU node number for a device
|
||||
*
|
||||
@@ -4194,6 +4205,19 @@ amdsmi_status_t
|
||||
amdsmi_get_power_cap_info(amdsmi_processor_handle processor_handle, uint32_t sensor_ind,
|
||||
amdsmi_power_cap_info_t *info);
|
||||
|
||||
/**
|
||||
* @brief Returns the PCIe info for the GPU.
|
||||
*
|
||||
* @param[in] processor_handle Device which to query
|
||||
*
|
||||
* @param[out] info Reference to the PCIe information
|
||||
* returned by the library. Must be allocated by user.
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_pcie_info(amdsmi_processor_handle processor_handle,
|
||||
amdsmi_pcie_info_t *info);
|
||||
|
||||
/**
|
||||
* @brief Returns XGMI information for the GPU.
|
||||
*
|
||||
@@ -4280,7 +4304,7 @@ amdsmi_get_power_info(amdsmi_processor_handle processor_handle, amdsmi_power_inf
|
||||
*
|
||||
* @param[in] processor_handle PF of a processor for which to query
|
||||
*
|
||||
* @param[out] status Reference to bool. Must be allocated by user.
|
||||
* @param[out] enabled Reference to bool. Must be allocated by user.
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
|
||||
@@ -761,7 +761,7 @@ except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
### amdsmi_get_pcie_link_status
|
||||
### amdsmi_get_pcie_info
|
||||
|
||||
Description: Returns the pcie link status for the given GPU.
|
||||
It is not supported on virtual machine guest
|
||||
@@ -778,7 +778,7 @@ Field | Description
|
||||
`pcie_speed`| current pcie speed
|
||||
`pcie_interface_version`| current pcie generation
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_get_pcie_link_status` function:
|
||||
Exceptions that can be thrown by `amdsmi_get_pcie_info` function:
|
||||
|
||||
* `AmdSmiLibraryException`
|
||||
* `AmdSmiRetryException`
|
||||
@@ -793,7 +793,7 @@ try:
|
||||
print("No GPUs on machine")
|
||||
else:
|
||||
for device in devices:
|
||||
pcie_link_status = amdsmi_get_pcie_link_status(device)
|
||||
pcie_link_status = amdsmi_get_pcie_info(device)
|
||||
print(pcie_link_status["pcie_lanes"])
|
||||
print(pcie_link_status["pcie_speed"])
|
||||
print(pcie_link_status["pcie_interface_version"])
|
||||
@@ -801,43 +801,6 @@ except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
### amdsmi_get_pcie_link_caps
|
||||
|
||||
Description: Returns the max pcie link capabilities for the given GPU
|
||||
|
||||
Input parameters:
|
||||
|
||||
* `processor_handle` device which to query
|
||||
|
||||
Output: Dictionary with fields
|
||||
|
||||
Field | Description
|
||||
---|---
|
||||
`pcie_lanes` | Number of PCIe lanes
|
||||
`pcie_speed` | PCIe speed in MT/s
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_get_pcie_link_caps` 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:
|
||||
pcie_caps = amdsmi_get_pcie_link_caps(device)
|
||||
print(pcie_caps['pcie_lanes'])
|
||||
print(pcie_caps['pcie_speed'])
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
### amdsmi_get_gpu_bad_page_info
|
||||
|
||||
Description: Returns bad page info for the given GPU.
|
||||
|
||||
@@ -98,8 +98,7 @@ from .amdsmi_interface import amdsmi_get_gpu_vram_usage
|
||||
from .amdsmi_interface import amdsmi_get_power_info
|
||||
from .amdsmi_interface import amdsmi_get_clock_info
|
||||
|
||||
from .amdsmi_interface import amdsmi_get_pcie_link_status
|
||||
from .amdsmi_interface import amdsmi_get_pcie_link_caps
|
||||
from .amdsmi_interface import amdsmi_get_pcie_info
|
||||
from .amdsmi_interface import amdsmi_get_gpu_bad_page_info
|
||||
|
||||
# # Process Information
|
||||
|
||||
@@ -2064,7 +2064,7 @@ def amdsmi_get_gpu_vram_usage(
|
||||
return {"vram_total": vram_info.vram_total, "vram_used": vram_info.vram_used}
|
||||
|
||||
|
||||
def amdsmi_get_pcie_link_status(
|
||||
def amdsmi_get_pcie_info(
|
||||
processor_handle: amdsmi_wrapper.amdsmi_processor_handle,
|
||||
) -> Dict[str, Any]:
|
||||
if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle):
|
||||
@@ -2074,34 +2074,18 @@ def amdsmi_get_pcie_link_status(
|
||||
|
||||
pcie_info = amdsmi_wrapper.amdsmi_pcie_info_t()
|
||||
_check_res(
|
||||
amdsmi_wrapper.amdsmi_get_pcie_link_status(
|
||||
amdsmi_wrapper.amdsmi_get_pcie_info(
|
||||
processor_handle, ctypes.byref(pcie_info)
|
||||
)
|
||||
)
|
||||
|
||||
return {"pcie_speed": pcie_info.pcie_speed,
|
||||
"pcie_lanes": pcie_info.pcie_lanes,
|
||||
"pcie_interface_version": pcie_info.pcie_interface_version,
|
||||
"pcie_slot_type": pcie_info.pcie_slot_type}
|
||||
|
||||
def amdsmi_get_pcie_link_caps(
|
||||
processor_handle: amdsmi_wrapper.amdsmi_processor_handle,
|
||||
) -> Dict[str, Any]:
|
||||
if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle):
|
||||
raise AmdSmiParameterException(
|
||||
processor_handle, amdsmi_wrapper.amdsmi_processor_handle
|
||||
)
|
||||
|
||||
pcie_info = amdsmi_wrapper.amdsmi_pcie_info_t()
|
||||
_check_res(
|
||||
amdsmi_wrapper.amdsmi_get_pcie_link_caps(
|
||||
processor_handle, ctypes.byref(pcie_info))
|
||||
)
|
||||
|
||||
return {"max_pcie_speed": pcie_info.pcie_speed,
|
||||
"max_pcie_lanes": pcie_info.pcie_lanes,
|
||||
"pcie_interface_version": pcie_info.pcie_interface_version,
|
||||
"pcie_slot_type": pcie_info.pcie_slot_type}
|
||||
return {"pcie_speed": pcie_info.pcie_metric.pcie_speed,
|
||||
"pcie_lanes": pcie_info.pcie_metric.pcie_lanes,
|
||||
"pcie_interface_version": pcie_info.pcie_static.pcie_interface_version,
|
||||
"max_pcie_speed": pcie_info.pcie_static.max_pcie_speed,
|
||||
"max_pcie_lanes": pcie_info.pcie_static.max_pcie_lanes,
|
||||
"pcie_interface_version": pcie_info.pcie_static.pcie_interface_version,
|
||||
"pcie_slot_type": pcie_info.pcie_static.slot_type}
|
||||
|
||||
|
||||
def amdsmi_get_processor_handle_from_bdf(bdf):
|
||||
|
||||
@@ -732,6 +732,59 @@ union_amdsmi_bdf_t._fields_ = [
|
||||
]
|
||||
|
||||
amdsmi_bdf_t = union_amdsmi_bdf_t
|
||||
|
||||
# values for enumeration 'amdsmi_card_form_factor_t'
|
||||
amdsmi_card_form_factor_t__enumvalues = {
|
||||
0: 'AMDSMI_CARD_FORM_FACTOR_PCIE',
|
||||
1: 'AMDSMI_CARD_FORM_FACTOR_OAM',
|
||||
2: 'AMDSMI_CARD_FORM_FACTOR_UNKNOWN',
|
||||
}
|
||||
AMDSMI_CARD_FORM_FACTOR_PCIE = 0
|
||||
AMDSMI_CARD_FORM_FACTOR_OAM = 1
|
||||
AMDSMI_CARD_FORM_FACTOR_UNKNOWN = 2
|
||||
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_lanes', 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
|
||||
|
||||
struct_pcie_metric_._pack_ = 1 # source:False
|
||||
struct_pcie_metric_._fields_ = [
|
||||
('pcie_speed', ctypes.c_uint32),
|
||||
('pcie_lanes', ctypes.c_uint16),
|
||||
('PADDING_0', ctypes.c_ubyte * 2),
|
||||
('pcie_bandwidth', ctypes.c_uint32),
|
||||
('PADDING_1', ctypes.c_ubyte * 4),
|
||||
('pcie_replay_count', ctypes.c_uint64),
|
||||
('pcie_l0_to_recovery_count', ctypes.c_uint64),
|
||||
('pcie_replay_roll_over_count', ctypes.c_uint64),
|
||||
('pcie_nak_sent_count', ctypes.c_uint64),
|
||||
('pcie_nak_received_count', ctypes.c_uint64),
|
||||
('reserved', ctypes.c_uint64 * 13),
|
||||
]
|
||||
|
||||
struct_amdsmi_pcie_info_t._pack_ = 1 # source:False
|
||||
struct_amdsmi_pcie_info_t._fields_ = [
|
||||
('pcie_static', struct_pcie_static_),
|
||||
('pcie_metric', struct_pcie_metric_),
|
||||
('reserved', ctypes.c_uint64 * 32),
|
||||
]
|
||||
|
||||
amdsmi_pcie_info_t = struct_amdsmi_pcie_info_t
|
||||
class struct_amdsmi_power_cap_info_t(Structure):
|
||||
pass
|
||||
|
||||
@@ -839,6 +892,46 @@ struct_amdsmi_asic_info_t._fields_ = [
|
||||
]
|
||||
|
||||
amdsmi_asic_info_t = struct_amdsmi_asic_info_t
|
||||
|
||||
# values for enumeration 'amdsmi_link_type_t'
|
||||
amdsmi_link_type_t__enumvalues = {
|
||||
0: 'AMDSMI_LINK_TYPE_PCIE',
|
||||
1: 'AMDSMI_LINK_TYPE_XGMI',
|
||||
2: 'AMDSMI_LINK_TYPE_NOT_APPLICABLE',
|
||||
3: 'AMDSMI_LINK_TYPE_UNKNOWN',
|
||||
}
|
||||
AMDSMI_LINK_TYPE_PCIE = 0
|
||||
AMDSMI_LINK_TYPE_XGMI = 1
|
||||
AMDSMI_LINK_TYPE_NOT_APPLICABLE = 2
|
||||
AMDSMI_LINK_TYPE_UNKNOWN = 3
|
||||
amdsmi_link_type_t = ctypes.c_uint32 # enum
|
||||
class struct_amdsmi_link_metrics_t(Structure):
|
||||
pass
|
||||
|
||||
class struct__links(Structure):
|
||||
pass
|
||||
|
||||
struct__links._pack_ = 1 # source:False
|
||||
struct__links._fields_ = [
|
||||
('bdf', amdsmi_bdf_t),
|
||||
('bit_rate', ctypes.c_uint32),
|
||||
('max_bandwidth', ctypes.c_uint32),
|
||||
('link_type', amdsmi_link_type_t),
|
||||
('PADDING_0', ctypes.c_ubyte * 4),
|
||||
('read', ctypes.c_uint64),
|
||||
('write', ctypes.c_uint64),
|
||||
('reserved', ctypes.c_uint64 * 2),
|
||||
]
|
||||
|
||||
struct_amdsmi_link_metrics_t._pack_ = 1 # source:False
|
||||
struct_amdsmi_link_metrics_t._fields_ = [
|
||||
('num_links', ctypes.c_uint32),
|
||||
('PADDING_0', ctypes.c_ubyte * 4),
|
||||
('links', struct__links * 64),
|
||||
('reserved', ctypes.c_uint64 * 7),
|
||||
]
|
||||
|
||||
amdsmi_link_metrics_t = struct_amdsmi_link_metrics_t
|
||||
class struct_amdsmi_vram_info_t(Structure):
|
||||
pass
|
||||
|
||||
@@ -855,9 +948,9 @@ class struct_amdsmi_driver_info_t(Structure):
|
||||
|
||||
struct_amdsmi_driver_info_t._pack_ = 1 # source:False
|
||||
struct_amdsmi_driver_info_t._fields_ = [
|
||||
('driver_name', ctypes.c_char * 64),
|
||||
('driver_version', ctypes.c_char * 64),
|
||||
('driver_date', ctypes.c_char * 64),
|
||||
('driver_name', ctypes.c_char * 64),
|
||||
]
|
||||
|
||||
amdsmi_driver_info_t = struct_amdsmi_driver_info_t
|
||||
@@ -866,12 +959,12 @@ class struct_amdsmi_board_info_t(Structure):
|
||||
|
||||
struct_amdsmi_board_info_t._pack_ = 1 # source:False
|
||||
struct_amdsmi_board_info_t._fields_ = [
|
||||
('is_master', ctypes.c_bool),
|
||||
('model_number', ctypes.c_char * 32),
|
||||
('product_serial', ctypes.c_char * 32),
|
||||
('fru_id', ctypes.c_char * 32),
|
||||
('manufacturer_name', ctypes.c_char * 32),
|
||||
('product_name', ctypes.c_char * 128),
|
||||
('manufacturer_name', ctypes.c_char * 32),
|
||||
('reserved', ctypes.c_uint32 * 32),
|
||||
]
|
||||
|
||||
amdsmi_board_info_t = struct_amdsmi_board_info_t
|
||||
@@ -919,6 +1012,16 @@ amdsmi_process_handle_t = ctypes.c_uint32
|
||||
class struct_amdsmi_proc_info_t(Structure):
|
||||
pass
|
||||
|
||||
class struct_engine_usage_(Structure):
|
||||
pass
|
||||
|
||||
struct_engine_usage_._pack_ = 1 # source:False
|
||||
struct_engine_usage_._fields_ = [
|
||||
('gfx', ctypes.c_uint64),
|
||||
('enc', ctypes.c_uint64),
|
||||
('reserved', ctypes.c_uint32 * 12),
|
||||
]
|
||||
|
||||
class struct_memory_usage_(Structure):
|
||||
pass
|
||||
|
||||
@@ -930,16 +1033,6 @@ struct_memory_usage_._fields_ = [
|
||||
('reserved', ctypes.c_uint32 * 10),
|
||||
]
|
||||
|
||||
class struct_engine_usage_(Structure):
|
||||
pass
|
||||
|
||||
struct_engine_usage_._pack_ = 1 # source:False
|
||||
struct_engine_usage_._fields_ = [
|
||||
('gfx', ctypes.c_uint64),
|
||||
('enc', ctypes.c_uint64),
|
||||
('reserved', ctypes.c_uint32 * 12),
|
||||
]
|
||||
|
||||
struct_amdsmi_proc_info_t._pack_ = 1 # source:False
|
||||
struct_amdsmi_proc_info_t._fields_ = [
|
||||
('name', ctypes.c_char * 32),
|
||||
@@ -1319,8 +1412,8 @@ amdsmi_io_link_type_t = ctypes.c_uint32 # enum
|
||||
amdsmi_utilization_counter_type_t__enumvalues = {
|
||||
0: 'AMDSMI_UTILIZATION_COUNTER_FIRST',
|
||||
0: 'AMDSMI_COARSE_GRAIN_GFX_ACTIVITY',
|
||||
1: 'AMDSMI_UTILIZATION_COUNTER_LAST',
|
||||
1: 'AMDSMI_COARSE_GRAIN_MEM_ACTIVITY',
|
||||
1: 'AMDSMI_UTILIZATION_COUNTER_LAST',
|
||||
}
|
||||
AMDSMI_UTILIZATION_COUNTER_FIRST = 0
|
||||
AMDSMI_COARSE_GRAIN_GFX_ACTIVITY = 0
|
||||
@@ -1581,33 +1674,6 @@ struct_amdsmi_error_count_t._fields_ = [
|
||||
]
|
||||
|
||||
amdsmi_error_count_t = struct_amdsmi_error_count_t
|
||||
|
||||
# values for enumeration 'amdsmi_pcie_slot_type_t'
|
||||
amdsmi_pcie_slot_type_t__enumvalues = {
|
||||
0: 'AMDSMI_SLOT_TYPE__PCIE',
|
||||
1: 'AMDSMI_SLOT_TYPE__CEM',
|
||||
2: 'AMDSMI_SLOT_TYPE__OAM',
|
||||
3: 'AMDSMI_SLOT_TYPE__RESERVED',
|
||||
}
|
||||
AMDSMI_SLOT_TYPE__PCIE = 0
|
||||
AMDSMI_SLOT_TYPE__CEM = 1
|
||||
AMDSMI_SLOT_TYPE__OAM = 2
|
||||
AMDSMI_SLOT_TYPE__RESERVED = 3
|
||||
amdsmi_pcie_slot_type_t = ctypes.c_uint32 # enum
|
||||
class struct_amdsmi_pcie_info_t(Structure):
|
||||
pass
|
||||
|
||||
struct_amdsmi_pcie_info_t._pack_ = 1 # source:False
|
||||
struct_amdsmi_pcie_info_t._fields_ = [
|
||||
('pcie_lanes', ctypes.c_uint16),
|
||||
('PADDING_0', ctypes.c_ubyte * 2),
|
||||
('pcie_speed', ctypes.c_uint32),
|
||||
('pcie_interface_version', ctypes.c_uint32),
|
||||
('pcie_slot_type', amdsmi_pcie_slot_type_t),
|
||||
('reserved', ctypes.c_uint32 * 4),
|
||||
]
|
||||
|
||||
amdsmi_pcie_info_t = struct_amdsmi_pcie_info_t
|
||||
class struct_amdsmi_process_info_t(Structure):
|
||||
pass
|
||||
|
||||
@@ -1911,13 +1977,7 @@ amdsmi_set_gpu_fan_speed.restype = amdsmi_status_t
|
||||
amdsmi_set_gpu_fan_speed.argtypes = [amdsmi_processor_handle, uint32_t, uint64_t]
|
||||
amdsmi_get_utilization_count = _libraries['libamd_smi.so'].amdsmi_get_utilization_count
|
||||
amdsmi_get_utilization_count.restype = amdsmi_status_t
|
||||
amdsmi_get_utilization_count.argtypes = [amdsmi_processor_handle, ctypes.POINTER(struct_amdsmi_utilization_counter_t), uint32_t, ctypes.POINTER(ctypes.c_uint64)]
|
||||
amdsmi_get_pcie_link_status = _libraries['libamd_smi.so'].amdsmi_get_pcie_link_status
|
||||
amdsmi_get_pcie_link_status.restype = amdsmi_status_t
|
||||
amdsmi_get_pcie_link_status.argtypes = [amdsmi_processor_handle, ctypes.POINTER(struct_amdsmi_pcie_info_t)]
|
||||
amdsmi_get_pcie_link_caps = _libraries['libamd_smi.so'].amdsmi_get_pcie_link_caps
|
||||
amdsmi_get_pcie_link_caps.restype = amdsmi_status_t
|
||||
amdsmi_get_pcie_link_caps.argtypes = [amdsmi_processor_handle, ctypes.POINTER(struct_amdsmi_pcie_info_t)]
|
||||
amdsmi_get_utilization_count.argtypes = [amdsmi_processor_handle, struct_amdsmi_utilization_counter_t * 0, uint32_t, ctypes.POINTER(ctypes.c_uint64)]
|
||||
amdsmi_get_gpu_perf_level = _libraries['libamd_smi.so'].amdsmi_get_gpu_perf_level
|
||||
amdsmi_get_gpu_perf_level.restype = amdsmi_status_t
|
||||
amdsmi_get_gpu_perf_level.argtypes = [amdsmi_processor_handle, ctypes.POINTER(amdsmi_dev_perf_level_t)]
|
||||
@@ -2017,6 +2077,9 @@ amdsmi_gpu_xgmi_error_status.argtypes = [amdsmi_processor_handle, ctypes.POINTER
|
||||
amdsmi_reset_gpu_xgmi_error = _libraries['libamd_smi.so'].amdsmi_reset_gpu_xgmi_error
|
||||
amdsmi_reset_gpu_xgmi_error.restype = amdsmi_status_t
|
||||
amdsmi_reset_gpu_xgmi_error.argtypes = [amdsmi_processor_handle]
|
||||
amdsmi_get_link_metrics = _libraries['libamd_smi.so'].amdsmi_get_link_metrics
|
||||
amdsmi_get_link_metrics.restype = amdsmi_status_t
|
||||
amdsmi_get_link_metrics.argtypes = [amdsmi_processor_handle, ctypes.POINTER(struct_amdsmi_link_metrics_t)]
|
||||
amdsmi_topo_get_numa_node_number = _libraries['libamd_smi.so'].amdsmi_topo_get_numa_node_number
|
||||
amdsmi_topo_get_numa_node_number.restype = amdsmi_status_t
|
||||
amdsmi_topo_get_numa_node_number.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32)]
|
||||
@@ -2083,6 +2146,9 @@ amdsmi_get_gpu_board_info.argtypes = [amdsmi_processor_handle, ctypes.POINTER(st
|
||||
amdsmi_get_power_cap_info = _libraries['libamd_smi.so'].amdsmi_get_power_cap_info
|
||||
amdsmi_get_power_cap_info.restype = amdsmi_status_t
|
||||
amdsmi_get_power_cap_info.argtypes = [amdsmi_processor_handle, uint32_t, ctypes.POINTER(struct_amdsmi_power_cap_info_t)]
|
||||
amdsmi_get_pcie_info = _libraries['libamd_smi.so'].amdsmi_get_pcie_info
|
||||
amdsmi_get_pcie_info.restype = amdsmi_status_t
|
||||
amdsmi_get_pcie_info.argtypes = [amdsmi_processor_handle, ctypes.POINTER(struct_amdsmi_pcie_info_t)]
|
||||
amdsmi_get_xgmi_info = _libraries['libamd_smi.so'].amdsmi_get_xgmi_info
|
||||
amdsmi_get_xgmi_info.restype = amdsmi_status_t
|
||||
amdsmi_get_xgmi_info.argtypes = [amdsmi_processor_handle, ctypes.POINTER(struct_amdsmi_xgmi_info_t)]
|
||||
@@ -2403,8 +2469,9 @@ 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))]
|
||||
__all__ = \
|
||||
['AGG_BW0', 'AMDSMI_ARG_PTR_NULL', 'AMDSMI_AVERAGE_POWER',
|
||||
'AMDSMI_CNTR_CMD_START', 'AMDSMI_CNTR_CMD_STOP',
|
||||
'AMDSMI_COARSE_GRAIN_GFX_ACTIVITY',
|
||||
'AMDSMI_CARD_FORM_FACTOR_OAM', 'AMDSMI_CARD_FORM_FACTOR_PCIE',
|
||||
'AMDSMI_CARD_FORM_FACTOR_UNKNOWN', 'AMDSMI_CNTR_CMD_START',
|
||||
'AMDSMI_CNTR_CMD_STOP', 'AMDSMI_COARSE_GRAIN_GFX_ACTIVITY',
|
||||
'AMDSMI_COARSE_GRAIN_MEM_ACTIVITY', 'AMDSMI_CURRENT_POWER',
|
||||
'AMDSMI_DEV_PERF_LEVEL_AUTO', 'AMDSMI_DEV_PERF_LEVEL_DETERMINISM',
|
||||
'AMDSMI_DEV_PERF_LEVEL_FIRST', 'AMDSMI_DEV_PERF_LEVEL_HIGH',
|
||||
@@ -2448,6 +2515,8 @@ __all__ = \
|
||||
'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',
|
||||
'AMDSMI_LINK_TYPE_UNKNOWN', 'AMDSMI_LINK_TYPE_XGMI',
|
||||
'AMDSMI_MEM_PAGE_STATUS_PENDING',
|
||||
'AMDSMI_MEM_PAGE_STATUS_RESERVED',
|
||||
'AMDSMI_MEM_PAGE_STATUS_UNRESERVABLE', 'AMDSMI_MEM_TYPE_FIRST',
|
||||
@@ -2470,9 +2539,7 @@ __all__ = \
|
||||
'AMDSMI_RAS_ERR_STATE_PARITY', 'AMDSMI_RAS_ERR_STATE_POISON',
|
||||
'AMDSMI_RAS_ERR_STATE_SING_C', 'AMDSMI_REG_PCIE',
|
||||
'AMDSMI_REG_USR', 'AMDSMI_REG_USR1', 'AMDSMI_REG_WAFL',
|
||||
'AMDSMI_REG_XGMI', 'AMDSMI_SLOT_TYPE__CEM',
|
||||
'AMDSMI_SLOT_TYPE__OAM', 'AMDSMI_SLOT_TYPE__PCIE',
|
||||
'AMDSMI_SLOT_TYPE__RESERVED', 'AMDSMI_STATUS_ADDRESS_FAULT',
|
||||
'AMDSMI_REG_XGMI', 'AMDSMI_STATUS_ADDRESS_FAULT',
|
||||
'AMDSMI_STATUS_AMDGPU_RESTART_ERR', 'AMDSMI_STATUS_API_FAILED',
|
||||
'AMDSMI_STATUS_BUSY', 'AMDSMI_STATUS_DRIVER_NOT_LOADED',
|
||||
'AMDSMI_STATUS_DRM_ERROR', 'AMDSMI_STATUS_FAIL_LOAD_MODULE',
|
||||
@@ -2499,9 +2566,7 @@ __all__ = \
|
||||
'AMDSMI_TEMP_MAX', 'AMDSMI_TEMP_MAX_HYST', 'AMDSMI_TEMP_MIN',
|
||||
'AMDSMI_TEMP_MIN_HYST', 'AMDSMI_TEMP_OFFSET',
|
||||
'AMDSMI_UTILIZATION_COUNTER_FIRST',
|
||||
'AMDSMI_COARSE_GRAIN_GFX_ACTIVITY',
|
||||
'AMDSMI_UTILIZATION_COUNTER_LAST',
|
||||
'AMDSMI_COARSE_GRAIN_MEM_ACTIVITY', 'AMDSMI_VOLT_AVERAGE',
|
||||
'AMDSMI_UTILIZATION_COUNTER_LAST', 'AMDSMI_VOLT_AVERAGE',
|
||||
'AMDSMI_VOLT_CURRENT', 'AMDSMI_VOLT_FIRST', 'AMDSMI_VOLT_HIGHEST',
|
||||
'AMDSMI_VOLT_LAST', 'AMDSMI_VOLT_LOWEST', 'AMDSMI_VOLT_MAX',
|
||||
'AMDSMI_VOLT_MAX_CRIT', 'AMDSMI_VOLT_MIN', 'AMDSMI_VOLT_MIN_CRIT',
|
||||
@@ -2571,17 +2636,17 @@ __all__ = \
|
||||
'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_clk_info_t', 'amdsmi_clk_type_t',
|
||||
'amdsmi_compute_partition_type_t', 'amdsmi_container_types_t',
|
||||
'amdsmi_counter_command_t', 'amdsmi_counter_value_t',
|
||||
'amdsmi_cpu_apb_disable', 'amdsmi_cpu_apb_enable',
|
||||
'amdsmi_cpusocket_handle', 'amdsmi_ddr_bw_metrics_t',
|
||||
'amdsmi_dev_perf_level_t', 'amdsmi_dimm_power_t',
|
||||
'amdsmi_dimm_thermal_t', 'amdsmi_dpm_level_t',
|
||||
'amdsmi_driver_info_t', 'amdsmi_engine_usage_t',
|
||||
'amdsmi_error_count_t', 'amdsmi_event_group_t',
|
||||
'amdsmi_event_handle_t', 'amdsmi_event_type_t',
|
||||
'amdsmi_evt_notification_data_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',
|
||||
'amdsmi_counter_value_t', 'amdsmi_cpu_apb_disable',
|
||||
'amdsmi_cpu_apb_enable', 'amdsmi_cpusocket_handle',
|
||||
'amdsmi_ddr_bw_metrics_t', 'amdsmi_dev_perf_level_t',
|
||||
'amdsmi_dimm_power_t', 'amdsmi_dimm_thermal_t',
|
||||
'amdsmi_dpm_level_t', 'amdsmi_driver_info_t',
|
||||
'amdsmi_engine_usage_t', 'amdsmi_error_count_t',
|
||||
'amdsmi_event_group_t', 'amdsmi_event_handle_t',
|
||||
'amdsmi_event_type_t', 'amdsmi_evt_notification_data_t',
|
||||
'amdsmi_evt_notification_type_t',
|
||||
'amdsmi_first_online_core_on_cpu_socket', 'amdsmi_freq_ind_t',
|
||||
'amdsmi_freq_volt_region_t', 'amdsmi_frequencies_t',
|
||||
@@ -2695,10 +2760,11 @@ __all__ = \
|
||||
'amdsmi_get_gpu_vendor_name', 'amdsmi_get_gpu_volt_metric',
|
||||
'amdsmi_get_gpu_vram_info', 'amdsmi_get_gpu_vram_usage',
|
||||
'amdsmi_get_gpu_vram_vendor', 'amdsmi_get_lib_version',
|
||||
'amdsmi_get_metrics_table', 'amdsmi_get_metrics_table_version',
|
||||
'amdsmi_get_link_metrics', 'amdsmi_get_metrics_table',
|
||||
'amdsmi_get_metrics_table_version',
|
||||
'amdsmi_get_minmax_bandwidth_between_processors',
|
||||
'amdsmi_get_pcie_link_caps', 'amdsmi_get_pcie_link_status',
|
||||
'amdsmi_get_power_cap_info', 'amdsmi_get_power_info',
|
||||
'amdsmi_get_pcie_info', 'amdsmi_get_power_cap_info',
|
||||
'amdsmi_get_power_info',
|
||||
'amdsmi_get_processor_count_from_handles',
|
||||
'amdsmi_get_processor_handle_from_bdf',
|
||||
'amdsmi_get_processor_handles',
|
||||
@@ -2716,13 +2782,14 @@ __all__ = \
|
||||
'amdsmi_io_bw_encoding_t', 'amdsmi_io_link_type_t',
|
||||
'amdsmi_is_P2P_accessible',
|
||||
'amdsmi_is_gpu_power_management_enabled',
|
||||
'amdsmi_link_id_bw_type_t', 'amdsmi_memory_page_status_t',
|
||||
'amdsmi_link_id_bw_type_t', 'amdsmi_link_metrics_t',
|
||||
'amdsmi_link_type_t', 'amdsmi_memory_page_status_t',
|
||||
'amdsmi_memory_partition_type_t', 'amdsmi_memory_type_t',
|
||||
'amdsmi_mm_ip_t', 'amdsmi_name_value_t', 'amdsmi_od_vddc_point_t',
|
||||
'amdsmi_od_volt_curve_t', 'amdsmi_od_volt_freq_data_t',
|
||||
'amdsmi_pcie_bandwidth_t', 'amdsmi_pcie_info_t',
|
||||
'amdsmi_pcie_slot_type_t', 'amdsmi_power_cap_info_t',
|
||||
'amdsmi_power_info_t', 'amdsmi_power_profile_preset_masks_t',
|
||||
'amdsmi_power_cap_info_t', 'amdsmi_power_info_t',
|
||||
'amdsmi_power_profile_preset_masks_t',
|
||||
'amdsmi_power_profile_status_t', 'amdsmi_power_type_t',
|
||||
'amdsmi_proc_info_t', 'amdsmi_process_handle_t',
|
||||
'amdsmi_process_info_t', 'amdsmi_processor_handle',
|
||||
@@ -2764,19 +2831,21 @@ __all__ = \
|
||||
'gpu_metric_curr_vclk0_t', 'gpu_metric_temp_hbm_t',
|
||||
'gpu_metric_vcn_activity_t', 'gpu_metric_xgmi_read_data_acc_t',
|
||||
'gpu_metric_xgmi_write_data_acc_t', 'processor_type_t', 'size_t',
|
||||
'struct_amd_metrics_table_header_t', 'struct_amdsmi_asic_info_t',
|
||||
'struct_amdsmi_board_info_t', 'struct_amdsmi_clk_info_t',
|
||||
'struct_amdsmi_counter_value_t', 'struct_amdsmi_ddr_bw_metrics_t',
|
||||
'struct_amdsmi_dimm_power_t', 'struct_amdsmi_dimm_thermal_t',
|
||||
'struct_amdsmi_dpm_level_t', 'struct_amdsmi_driver_info_t',
|
||||
'struct_amdsmi_engine_usage_t', 'struct_amdsmi_error_count_t',
|
||||
'struct__links', 'struct_amd_metrics_table_header_t',
|
||||
'struct_amdsmi_asic_info_t', 'struct_amdsmi_board_info_t',
|
||||
'struct_amdsmi_clk_info_t', 'struct_amdsmi_counter_value_t',
|
||||
'struct_amdsmi_ddr_bw_metrics_t', 'struct_amdsmi_dimm_power_t',
|
||||
'struct_amdsmi_dimm_thermal_t', 'struct_amdsmi_dpm_level_t',
|
||||
'struct_amdsmi_driver_info_t', 'struct_amdsmi_engine_usage_t',
|
||||
'struct_amdsmi_error_count_t',
|
||||
'struct_amdsmi_evt_notification_data_t',
|
||||
'struct_amdsmi_freq_volt_region_t', 'struct_amdsmi_frequencies_t',
|
||||
'struct_amdsmi_frequency_range_t', 'struct_amdsmi_fw_info_t',
|
||||
'struct_amdsmi_gpu_cache_info_t', 'struct_amdsmi_gpu_metrics_t',
|
||||
'struct_amdsmi_hsmp_metric_table_t',
|
||||
'struct_amdsmi_link_id_bw_type_t', 'struct_amdsmi_name_value_t',
|
||||
'struct_amdsmi_od_vddc_point_t', 'struct_amdsmi_od_volt_curve_t',
|
||||
'struct_amdsmi_link_id_bw_type_t', 'struct_amdsmi_link_metrics_t',
|
||||
'struct_amdsmi_name_value_t', 'struct_amdsmi_od_vddc_point_t',
|
||||
'struct_amdsmi_od_volt_curve_t',
|
||||
'struct_amdsmi_od_volt_freq_data_t',
|
||||
'struct_amdsmi_pcie_bandwidth_t', 'struct_amdsmi_pcie_info_t',
|
||||
'struct_amdsmi_power_cap_info_t', 'struct_amdsmi_power_info_t',
|
||||
@@ -2791,5 +2860,6 @@ __all__ = \
|
||||
'struct_amdsmi_vram_info_t', 'struct_amdsmi_vram_usage_t',
|
||||
'struct_amdsmi_xgmi_info_t', 'struct_cache_',
|
||||
'struct_engine_usage_', 'struct_fields_', 'struct_fw_info_list_',
|
||||
'struct_memory_usage_', 'uint32_t', 'uint64_t', 'uint8_t',
|
||||
'struct_memory_usage_', 'struct_pcie_metric_',
|
||||
'struct_pcie_static_', 'uint32_t', 'uint64_t', 'uint8_t',
|
||||
'union_amdsmi_bdf_t']
|
||||
|
||||
@@ -919,6 +919,29 @@ amdsmi_status_t
|
||||
return amd::smi::rsmi_to_amdsmi_status(rstatus);
|
||||
}
|
||||
|
||||
|
||||
amdsmi_status_t amdsmi_get_link_metrics(amdsmi_processor_handle processor_handle,
|
||||
amdsmi_link_metrics_t *link_metrics) {
|
||||
AMDSMI_CHECK_INIT();
|
||||
if (link_metrics == nullptr) return AMDSMI_STATUS_INVAL;
|
||||
|
||||
amdsmi_gpu_metrics_t metric_info = {};
|
||||
amdsmi_status_t status = amdsmi_get_gpu_metrics_info(
|
||||
processor_handle, &metric_info);
|
||||
if (status != AMDSMI_STATUS_SUCCESS)
|
||||
return status;
|
||||
link_metrics->num_links = AMDSMI_MAX_NUM_XGMI_LINKS;
|
||||
for (unsigned int i = 0; i < link_metrics->num_links; i++) {
|
||||
link_metrics->links[i].read = metric_info.xgmi_read_data_acc[i];
|
||||
link_metrics->links[i].write = metric_info.xgmi_write_data_acc[i];
|
||||
link_metrics->links[i].bit_rate = metric_info.xgmi_link_speed;
|
||||
link_metrics->links[i].max_bandwidth = metric_info.xgmi_link_width;
|
||||
link_metrics->links[i].link_type = AMDSMI_LINK_TYPE_XGMI;
|
||||
}
|
||||
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
amdsmi_status_t
|
||||
amdsmi_topo_get_link_type(amdsmi_processor_handle processor_handle_src, amdsmi_processor_handle processor_handle_dst,
|
||||
uint64_t *hops, amdsmi_io_link_type_t *type) {
|
||||
@@ -1939,65 +1962,7 @@ amdsmi_get_gpu_device_uuid(amdsmi_processor_handle processor_handle, unsigned in
|
||||
return status;
|
||||
}
|
||||
|
||||
amdsmi_status_t
|
||||
amdsmi_get_pcie_link_status(amdsmi_processor_handle processor_handle, amdsmi_pcie_info_t *info){
|
||||
AMDSMI_CHECK_INIT();
|
||||
|
||||
if (info == nullptr) {
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
}
|
||||
amdsmi_status_t status = AMDSMI_STATUS_SUCCESS;
|
||||
amdsmi_gpu_metrics_t metric_info = {};
|
||||
status = amdsmi_get_gpu_metrics_info(
|
||||
processor_handle, &metric_info);
|
||||
if (status != AMDSMI_STATUS_SUCCESS)
|
||||
return status;
|
||||
|
||||
info->pcie_lanes = metric_info.pcie_link_width;
|
||||
// gpu metrics is inconsistent with pcie_speed values, if 0-6 then it needs to be translated
|
||||
if (metric_info.pcie_link_speed <= 6) {
|
||||
status = smi_amdgpu_get_pcie_speed_from_pcie_type(metric_info.pcie_link_speed, &info->pcie_speed); // mapping to MT/s
|
||||
} else {
|
||||
// gpu metrics returns pcie link speed in .1 GT/s ex. 160 vs 16
|
||||
info->pcie_speed = metric_info.pcie_link_speed * 100;
|
||||
}
|
||||
|
||||
switch (info->pcie_speed) {
|
||||
case 2500:
|
||||
info->pcie_interface_version = 1;
|
||||
break;
|
||||
case 5000:
|
||||
info->pcie_interface_version = 2;
|
||||
break;
|
||||
case 8000:
|
||||
info->pcie_interface_version = 3;
|
||||
break;
|
||||
case 16000:
|
||||
info->pcie_interface_version = 4;
|
||||
break;
|
||||
case 32000:
|
||||
info->pcie_interface_version = 5;
|
||||
break;
|
||||
case 64000:
|
||||
info->pcie_interface_version = 6;
|
||||
break;
|
||||
default:
|
||||
info->pcie_interface_version = 0;
|
||||
}
|
||||
|
||||
// default to PCIe
|
||||
info->pcie_slot_type = AMDSMI_SLOT_TYPE__PCIE;
|
||||
rsmi_pcie_slot_type_t slot_type;
|
||||
status = rsmi_wrapper(rsmi_dev_pcie_slot_type_get,
|
||||
processor_handle, &slot_type);
|
||||
if (status == AMDSMI_STATUS_SUCCESS) {
|
||||
info->pcie_slot_type = static_cast<amdsmi_pcie_slot_type_t>(slot_type);
|
||||
}
|
||||
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_get_pcie_link_caps(amdsmi_processor_handle processor_handle, amdsmi_pcie_info_t *info) {
|
||||
amdsmi_status_t amdsmi_get_pcie_info(amdsmi_processor_handle processor_handle, amdsmi_pcie_info_t *info) {
|
||||
AMDSMI_CHECK_INIT();
|
||||
|
||||
if (info == nullptr) {
|
||||
@@ -2029,7 +1994,7 @@ amdsmi_status_t amdsmi_get_pcie_link_caps(amdsmi_processor_handle processor_hand
|
||||
printf("Failed to open file: %s \n", path_max_link_width.c_str());
|
||||
return AMDSMI_STATUS_API_FAILED;
|
||||
}
|
||||
info->pcie_lanes = (uint16_t)pcie_width;
|
||||
info->pcie_static.max_pcie_lanes = (uint16_t)pcie_width;
|
||||
|
||||
std::string path_max_link_speed = "/sys/class/drm/" +
|
||||
gpu_device->get_gpu_path() + "/device/max_link_speed";
|
||||
@@ -2043,38 +2008,63 @@ amdsmi_status_t amdsmi_get_pcie_link_caps(amdsmi_processor_handle processor_hand
|
||||
}
|
||||
|
||||
// pcie speed in sysfs returns in GT/s
|
||||
info->pcie_speed = pcie_speed * 1000;
|
||||
info->pcie_static.max_pcie_speed = pcie_speed * 1000;
|
||||
|
||||
switch (info->pcie_speed) {
|
||||
switch (info->pcie_static.max_pcie_speed) {
|
||||
case 2500:
|
||||
info->pcie_interface_version = 1;
|
||||
info->pcie_static.pcie_interface_version = 1;
|
||||
break;
|
||||
case 5000:
|
||||
info->pcie_interface_version = 2;
|
||||
info->pcie_static.pcie_interface_version = 2;
|
||||
break;
|
||||
case 8000:
|
||||
info->pcie_interface_version = 3;
|
||||
info->pcie_static.pcie_interface_version = 3;
|
||||
break;
|
||||
case 16000:
|
||||
info->pcie_interface_version = 4;
|
||||
info->pcie_static.pcie_interface_version = 4;
|
||||
break;
|
||||
case 32000:
|
||||
info->pcie_interface_version = 5;
|
||||
info->pcie_static.pcie_interface_version = 5;
|
||||
break;
|
||||
case 64000:
|
||||
info->pcie_interface_version = 6;
|
||||
info->pcie_static.pcie_interface_version = 6;
|
||||
break;
|
||||
default:
|
||||
info->pcie_interface_version = 0;
|
||||
info->pcie_static.pcie_interface_version = 0;
|
||||
}
|
||||
|
||||
// default to PCIe
|
||||
info->pcie_slot_type = AMDSMI_SLOT_TYPE__PCIE;
|
||||
info->pcie_static.slot_type = AMDSMI_CARD_FORM_FACTOR_PCIE;
|
||||
rsmi_pcie_slot_type_t slot_type;
|
||||
status = rsmi_wrapper(rsmi_dev_pcie_slot_type_get,
|
||||
processor_handle, &slot_type);
|
||||
if (status == AMDSMI_STATUS_SUCCESS) {
|
||||
info->pcie_slot_type = static_cast<amdsmi_pcie_slot_type_t>(slot_type);
|
||||
switch (slot_type) {
|
||||
case RSMI_PCIE_SLOT_OAM:
|
||||
info->pcie_static.slot_type = AMDSMI_CARD_FORM_FACTOR_OAM;
|
||||
break;
|
||||
case RSMI_PCIE_SLOT_PCIE:
|
||||
info->pcie_static.slot_type = AMDSMI_CARD_FORM_FACTOR_PCIE;
|
||||
break;
|
||||
default:
|
||||
info->pcie_static.slot_type = AMDSMI_CARD_FORM_FACTOR_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
// metrics
|
||||
amdsmi_gpu_metrics_t metric_info = {};
|
||||
status = amdsmi_get_gpu_metrics_info(
|
||||
processor_handle, &metric_info);
|
||||
if (status != AMDSMI_STATUS_SUCCESS)
|
||||
return status;
|
||||
|
||||
info->pcie_metric.pcie_lanes = metric_info.pcie_link_width;
|
||||
// gpu metrics is inconsistent with pcie_speed values, if 0-6 then it needs to be translated
|
||||
if (metric_info.pcie_link_speed <= 6) {
|
||||
status = smi_amdgpu_get_pcie_speed_from_pcie_type(metric_info.pcie_link_speed, &info->pcie_metric.pcie_speed); // mapping to MT/s
|
||||
} else {
|
||||
// gpu metrics returns pcie link speed in .1 GT/s ex. 160 vs 16
|
||||
info->pcie_metric.pcie_speed = metric_info.pcie_link_speed * 100;
|
||||
}
|
||||
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
|
||||
Ссылка в новой задаче
Block a user