Query the CPU and GPU link type

The rsmi_topo_get_link_type() is extended to support query the CPU
and GPU link type by passing dv_ind_dst as 0xFFFFFFFF.

Change-Id: I1f212a01e8120adb70a08ab772fa9faaaecefa29


[ROCm/rocm_smi_lib commit: de5bc164de]
This commit is contained in:
Bill(Shuzhou) Liu
2023-10-25 08:17:25 -05:00
committed by Shuzhou Liu
parent e89751e202
commit fee0c807ce
2 changed files with 37 additions and 1 deletions
+24
View File
@@ -4387,6 +4387,30 @@ rsmi_topo_get_link_type(uint32_t dv_ind_src, uint32_t dv_ind_dst,
rsmi_status_t status;
uint32_t node_ind_dst;
// handle the link type for CPU
if (dv_ind_dst == CPU_NODE_INDEX) {
// No CPU connected
if (kfd_node->numa_node_weight() == 0) {
return RSMI_STATUS_NOT_SUPPORTED;
}
amd::smi::IO_LINK_TYPE io_link_type =
kfd_node->numa_node_type();
switch (io_link_type) {
case amd::smi::IOLINK_TYPE_XGMI:
*type = RSMI_IOLINK_TYPE_XGMI;
*hops = 1;
return RSMI_STATUS_SUCCESS;
case amd::smi::IOLINK_TYPE_PCIEXPRESS:
*type = RSMI_IOLINK_TYPE_PCIEXPRESS;
// always be the same CPU node
*hops = 2;
return RSMI_STATUS_SUCCESS;
default:
return RSMI_STATUS_NOT_SUPPORTED;
}
}
int ret = smi.get_node_index(dv_ind_dst, &node_ind_dst);
if (ret == 0) {