[SWDEV-545342] Fixed amdsmi_link_type_t enumeration (#560)
Signed-off-by: Pham, Gabriel <Gabriel.Pham@amd.com>
Signed-off-by: Maisam Arif <Maisam.Arif@amd.com>
Co-authored-by: Maisam Arif <Maisam.Arif@amd.com>
[ROCm/amdsmi commit: e2eac98496]
This commit is contained in:
@@ -34,8 +34,8 @@ Full documentation for amd_smi_lib is available at [https://rocm.docs.amd.com/pr
|
||||
- **Added the Default command**.
|
||||
- A default view has been added. The default view provides a snapshot of commonly requested information such as bdf, current partition mode, version information, and more. Users can access that information by simply typing `amd-smi` with no additional commands or arguments. Users may also obtain this information through laternate output formats such as json or csv by using the default command with the respective output format: `amd-smi default --json` or `amd-smi default --csv`.
|
||||
|
||||
```console
|
||||
$ amd-smi
|
||||
```console
|
||||
$ amd-smi
|
||||
+------------------------------------------------------------------------------+
|
||||
| AMD-SMI 26.0.0+eaa54ecc amdgpu version: 6.12.12 ROCm version: 7.0.0 |
|
||||
|-------------------------------------+----------------------------------------|
|
||||
@@ -79,7 +79,7 @@ Full documentation for amd_smi_lib is available at [https://rocm.docs.amd.com/pr
|
||||
| 6 2427396 rvs 2.0 MB 2.1 GB 2.4 GB 0.0 % |
|
||||
| 7 2427396 rvs 2.0 MB 2.1 GB 2.5 GB 0.0 % |
|
||||
+------------------------------------------------------------------------------+
|
||||
```
|
||||
```
|
||||
|
||||
- **Added support for GPU metrics 1.8**.
|
||||
- Added new fields for `amdsmi_gpu_xcp_metrics_t` including:
|
||||
@@ -153,7 +153,7 @@ Full documentation for amd_smi_lib is available at [https://rocm.docs.amd.com/pr
|
||||
- **Updated `amdsmi_get_clock_info` in `amdsmi_interface.py`**.
|
||||
- The `clk_deep_sleep` field now returns the sleep integer value.
|
||||
|
||||
- **Added Power Cap to amd-smi monitor**.
|
||||
- **Added Power Cap to `amd-smi monitor`**.
|
||||
- `amd-smi monitor -p` will display the power cap along with power.
|
||||
|
||||
```console
|
||||
@@ -186,15 +186,46 @@ Full documentation for amd_smi_lib is available at [https://rocm.docs.amd.com/pr
|
||||
|
||||
- **Removed unused member `year` in struct `amdsmi_version_t`**
|
||||
|
||||
- **Removed `amdsmi_io_link_type_t` and replaced with amdsmi_link_type_t**.
|
||||
- The IO Link type is no longer needed as the link type is sufficient.
|
||||
- Mapping from amdsmi_io_link_type_t to amdsmi_link_type_t is as follows:
|
||||
```shell
|
||||
- **Removed `amdsmi_io_link_type_t` and replaced with `amdsmi_link_type_t`**.
|
||||
- `amdsmi_io_link_type_t` is no longer needed as `amdsmi_link_type_t` is sufficient.
|
||||
- Mapping from `amdsmi_io_link_type_t` to `amdsmi_link_type_t` is as follows:
|
||||
|
||||
```console
|
||||
AMDSMI_IOLINK_TYPE_UNDEFINED == AMDSMI_LINK_TYPE_INTERNAL
|
||||
AMDSMI_IOLINK_TYPE_PCIEXPRESS == AMDSMI_LINK_TYPE_PCIE
|
||||
AMDSMI_IOLINK_TYPE_XGMI == AMDSMI_LINK_TYPE_XGMI
|
||||
```
|
||||
|
||||
- `amdsmi_link_type_t` enum has changed, primarily the ordering of the PCI and XGMI types:
|
||||
|
||||
```C++
|
||||
typedef enum {
|
||||
AMDSMI_LINK_TYPE_INTERNAL = 0,
|
||||
AMDSMI_LINK_TYPE_PCIE = 1,
|
||||
AMDSMI_LINK_TYPE_XGMI = 2,
|
||||
AMDSMI_LINK_TYPE_NOT_APPLICABLE = 3,
|
||||
AMDSMI_LINK_TYPE_UNKNOWN = 4
|
||||
} amdsmi_link_type_t;
|
||||
```
|
||||
|
||||
- Please note that this change will also affect `amdsmi_link_metrics_t`, where the link_type field changes from `amdsmi_io_link_type_t` to `amdsmi_link_type_t`:
|
||||
|
||||
```C++
|
||||
typedef struct {
|
||||
uint32_t num_links; //!< number of links
|
||||
struct _links {
|
||||
amdsmi_bdf_t bdf; //!< bdf of the destination gpu
|
||||
uint32_t bit_rate; //!< current link speed in Gb/s
|
||||
uint32_t max_bandwidth; //!< max bandwidth of the link in Gb/s
|
||||
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;
|
||||
```
|
||||
|
||||
- **Removed `amdsmi_get_power_info_v2()`**.
|
||||
- The amdsmi_get_power_info() has been unified and the v2 function is no longer needed/used.
|
||||
|
||||
|
||||
@@ -3928,7 +3928,7 @@ Field | Description
|
||||
`max_bandwidth` | Maximum XGMI bandwidth (in appropriate units, e.g., GB/s)
|
||||
`links` | List of dictionaries, one per XGMI link, each with:
|
||||
`bdf` | BDF string for the destination
|
||||
`link_type` | Link type
|
||||
`link_type` | The connection type as an int. This should be translated according to the enum amdsmi_link_type_t. Refer to the example below for more details.
|
||||
`read` | Accumulated read data for this link (e.g., KB)
|
||||
`write` | Accumulated write data for this link (e.g., KB)
|
||||
|
||||
@@ -3950,9 +3950,20 @@ try:
|
||||
print(link_metrics['bit_rate'])
|
||||
print(link_metrics['max_bandwidth'])
|
||||
for idx, link in enumerate(link_metrics['links']):
|
||||
print(f"{idx}: {link['bdf']}, {link['link_type']}, {link['read']} KB, {link['write']} KB")
|
||||
print(f"{idx}: {link['bdf']}, {link['read']} KB, {link['write']} KB")
|
||||
if link_type['link_type'] == AmdSmiLinkType.AMDSMI_LINK_TYPE_INTERNAL:
|
||||
print('internal')
|
||||
if link_type['link_type'] == AmdSmiLinkType.AMDSMI_LINK_TYPE_PCIE:
|
||||
print('pcie')
|
||||
if link_type['link_type'] == AmdSmiLinkType.AMDSMI_LINK_TYPE_XGMI:
|
||||
print('xgmi')
|
||||
if link_type['link_type'] == AmdSmiLinkType.AMDSMI_LINK_TYPE_NOT_APPLICABLE:
|
||||
print('not applicable')
|
||||
if link_type['link_type'] == AmdSmiLinkType.AMDSMI_LINK_TYPE_UNKNOWN:
|
||||
print('unknown')
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
### amdsmi_topo_get_link_type
|
||||
|
||||
@@ -3967,8 +3978,8 @@ Output: Dictionary with fields:
|
||||
|
||||
Field | Description
|
||||
---|---
|
||||
`hops` | number of hops
|
||||
`type` | the connection type
|
||||
`hops` | Number of hops
|
||||
`type` | The connection type as an int. This should be translated according to the enum amdsmi_link_type_t. Refer to the example below for more details.
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_topo_get_link_type` function:
|
||||
|
||||
@@ -3988,7 +3999,16 @@ try:
|
||||
processor_handle_dest = devices[1]
|
||||
link_type = amdsmi_topo_get_link_type(processor_handle_src, processor_handle_dest)
|
||||
print(link_type['hops'])
|
||||
print(link_type['type'])
|
||||
if link_type['type'] == AmdSmiLinkType.AMDSMI_LINK_TYPE_INTERNAL:
|
||||
print('internal')
|
||||
if link_type['type'] == AmdSmiLinkType.AMDSMI_LINK_TYPE_PCIE:
|
||||
print('pcie')
|
||||
if link_type['type'] == AmdSmiLinkType.AMDSMI_LINK_TYPE_XGMI:
|
||||
print('xgmi')
|
||||
if link_type['type'] == AmdSmiLinkType.AMDSMI_LINK_TYPE_NOT_APPLICABLE:
|
||||
print('not applicable')
|
||||
if link_type['type'] == AmdSmiLinkType.AMDSMI_LINK_TYPE_UNKNOWN:
|
||||
print('unknown')
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
@@ -4006,7 +4026,7 @@ Output: Dictionary with fields:
|
||||
|
||||
Fields | Description
|
||||
---|---
|
||||
`type` | AmdSmiIoLinkType
|
||||
`type` | The connection type as an int. This should be translated according to the enum amdsmi_link_type_t. Refer to the example below for more details.
|
||||
`cap` | <table><thead><tr> <th> Subfield </th> <th> Description</th> </tr></thead><tbody><tr><td>`is_iolink_coherent`</td><td>1 == True; 0 == False; Uint_max = Undefined</td></tr><tr><td>`is_iolink_atomics_32bit`</td><td>Supports 32bit atomics</td></tr><tr><td>`is_iolink_atomics_64bit`</td><td>Supports 64bit atomics</td></tr><tr><td>`is_iolink_dma`</td><td>Supports DMA</td></tr><tr><td>`is_iolink_bi_directional`</td><td>Is the IOLink Bidirectional</td></tr></tbody></table>
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_get_P2P_status` function:
|
||||
@@ -4026,7 +4046,16 @@ try:
|
||||
processor_handle_src = devices[0]
|
||||
processor_handle_dest = devices[1]
|
||||
link_type = amdsmi_get_P2P_status(processor_handle_src, processor_handle_dest)
|
||||
print(link_type['type'])
|
||||
if link_type['type'] == AmdSmiLinkType.AMDSMI_LINK_TYPE_INTERNAL:
|
||||
print('internal')
|
||||
if link_type['type'] == AmdSmiLinkType.AMDSMI_LINK_TYPE_PCIE:
|
||||
print('pcie')
|
||||
if link_type['type'] == AmdSmiLinkType.AMDSMI_LINK_TYPE_XGMI:
|
||||
print('xgmi')
|
||||
if link_type['type'] == AmdSmiLinkType.AMDSMI_LINK_TYPE_NOT_APPLICABLE:
|
||||
print('not applicable')
|
||||
if link_type['type'] == AmdSmiLinkType.AMDSMI_LINK_TYPE_UNKNOWN:
|
||||
print('unknown')
|
||||
print(link_type['caps'])
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
|
||||
@@ -947,11 +947,11 @@ typedef struct {
|
||||
* @cond @tag{gpu_bm_linux} @tag{host} @endcond
|
||||
*/
|
||||
typedef enum {
|
||||
AMDSMI_LINK_TYPE_INTERNAL, //!< Internal Link Type, within chip
|
||||
AMDSMI_LINK_TYPE_XGMI, //!< GPU Memory Interconnect (multi GPU communication)
|
||||
AMDSMI_LINK_TYPE_PCIE, //!< Peripheral Component Interconnect Express Link Type
|
||||
AMDSMI_LINK_TYPE_NOT_APPLICABLE, //!< Not Applicatble Link Type
|
||||
AMDSMI_LINK_TYPE_UNKNOWN //!< Unknown Link Type
|
||||
AMDSMI_LINK_TYPE_INTERNAL = 0, //!< Internal Link Type, within chip
|
||||
AMDSMI_LINK_TYPE_PCIE = 1, //!< Peripheral Component Interconnect Express Link Type
|
||||
AMDSMI_LINK_TYPE_XGMI = 2, //!< GPU Memory Interconnect (multi GPU communication)
|
||||
AMDSMI_LINK_TYPE_NOT_APPLICABLE = 3, //!< Not Applicable Link Type
|
||||
AMDSMI_LINK_TYPE_UNKNOWN = 4 //!< Unknown Link Type
|
||||
} amdsmi_link_type_t;
|
||||
|
||||
/**
|
||||
|
||||
@@ -3154,14 +3154,12 @@ def amdsmi_topo_get_link_type(
|
||||
)
|
||||
|
||||
hops = ctypes.c_uint64()
|
||||
#type = AmdSmiIoLinkType()
|
||||
type = ctypes.c_uint32()
|
||||
|
||||
_check_res(
|
||||
amdsmi_wrapper.amdsmi_topo_get_link_type(
|
||||
#processor_handle_src, processor_handle_dst, ctypes.byref(hops), type
|
||||
processor_handle_src, processor_handle_dst, ctypes.byref(
|
||||
hops), ctypes.byref(type)
|
||||
processor_handle_src, processor_handle_dst,
|
||||
ctypes.byref(hops), ctypes.byref(type)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -1127,14 +1127,14 @@ amdsmi_accelerator_partition_profile_config_t = struct_amdsmi_accelerator_partit
|
||||
# values for enumeration 'amdsmi_link_type_t'
|
||||
amdsmi_link_type_t__enumvalues = {
|
||||
0: 'AMDSMI_LINK_TYPE_INTERNAL',
|
||||
1: 'AMDSMI_LINK_TYPE_XGMI',
|
||||
2: 'AMDSMI_LINK_TYPE_PCIE',
|
||||
1: 'AMDSMI_LINK_TYPE_PCIE',
|
||||
2: 'AMDSMI_LINK_TYPE_XGMI',
|
||||
3: 'AMDSMI_LINK_TYPE_NOT_APPLICABLE',
|
||||
4: 'AMDSMI_LINK_TYPE_UNKNOWN',
|
||||
}
|
||||
AMDSMI_LINK_TYPE_INTERNAL = 0
|
||||
AMDSMI_LINK_TYPE_XGMI = 1
|
||||
AMDSMI_LINK_TYPE_PCIE = 2
|
||||
AMDSMI_LINK_TYPE_PCIE = 1
|
||||
AMDSMI_LINK_TYPE_XGMI = 2
|
||||
AMDSMI_LINK_TYPE_NOT_APPLICABLE = 3
|
||||
AMDSMI_LINK_TYPE_UNKNOWN = 4
|
||||
amdsmi_link_type_t = ctypes.c_uint32 # enum
|
||||
|
||||
Reference in New Issue
Block a user