diff --git a/src/ucp/proto/proto_common.c b/src/ucp/proto/proto_common.c index 5704ba33f3a..b4bc45dcd90 100644 --- a/src/ucp/proto/proto_common.c +++ b/src/ucp/proto/proto_common.c @@ -350,7 +350,7 @@ ucp_proto_common_get_lane_perf(const ucp_proto_common_init_params_t *params, ucs_sys_dev_distance_t distance; size_t tl_min_frag, tl_max_frag; uct_perf_attr_t perf_attr; - ucs_sys_device_t sys_dev; + ucs_sys_device_t sys_dev, device_sys_dev; ucs_status_t status; char bdf_name[32]; @@ -427,6 +427,15 @@ ucp_proto_common_get_lane_perf(const ucp_proto_common_init_params_t *params, ucs_topo_sys_device_get_name(sys_dev), ucs_topo_sys_device_bdf_name(sys_dev, bdf_name, sizeof(bdf_name))); + + /* Add bandwidth for interfaces very close to the memory. */ + device_sys_dev = ucp_proto_common_get_tl_rsc(¶ms->super, lane)->sys_device; + if ((sys_dev != UCS_SYS_DEVICE_ID_UNKNOWN) && + (device_sys_dev != UCS_SYS_DEVICE_ID_UNKNOWN) && + (sys_dev != device_sys_dev) && + ucs_topo_is_pci_bridge(device_sys_dev, sys_dev)) { + tl_perf->bandwidth *= 1.2; + } } /* For remote memory access, consider remote system topology distance */ diff --git a/src/ucs/sys/topo/base/topo.c b/src/ucs/sys/topo/base/topo.c index fe4279e092e..feea25cbeba 100644 --- a/src/ucs/sys/topo/base/topo.c +++ b/src/ucs/sys/topo/base/topo.c @@ -832,7 +832,7 @@ ucs_numa_node_t ucs_topo_sys_device_get_numa_node(ucs_sys_device_t sys_dev) * @return 1 if the devices share a PCI bridge, 0 otherwise. Returns 0 the * devices are the same. */ -static int +int ucs_topo_is_pci_bridge(ucs_sys_device_t sys_dev1, ucs_sys_device_t sys_dev2) { ucs_status_t status; diff --git a/src/ucs/sys/topo/base/topo.h b/src/ucs/sys/topo/base/topo.h index fc64d2a3a32..e5266d12934 100644 --- a/src/ucs/sys/topo/base/topo.h +++ b/src/ucs/sys/topo/base/topo.h @@ -358,6 +358,11 @@ void ucs_topo_init(void); */ void ucs_topo_cleanup(void); +/** + * Check if two system devices share a PCI bridge. + */ +int ucs_topo_is_pci_bridge(ucs_sys_device_t sys_dev1, ucs_sys_device_t sys_dev2); + END_C_DECLS #endif