Skip to content

Commit e75960c

Browse files
authored
UCP: Remove single net dev filtering for single proto (#10919)
1 parent 9455002 commit e75960c

File tree

4 files changed

+10
-120
lines changed

4 files changed

+10
-120
lines changed

src/ucp/proto/proto_common.c

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -152,37 +152,6 @@ ucp_proto_common_get_sys_dev(const ucp_proto_init_params_t *params,
152152
return params->worker->context->tl_rscs[rsc_index].tl_rsc.sys_device;
153153
}
154154

155-
int ucp_proto_common_add_unique_sys_dev(ucs_sys_device_t sys_dev,
156-
ucs_sys_device_t *sys_devs,
157-
ucp_lane_index_t *num_sys_devs,
158-
ucp_lane_index_t max_sys_devs)
159-
{
160-
ucp_lane_index_t i;
161-
162-
for (i = 0; i < *num_sys_devs; ++i) {
163-
if (sys_dev == sys_devs[i]) {
164-
return 0; /* Already exists */
165-
}
166-
}
167-
168-
if (*num_sys_devs < max_sys_devs) {
169-
sys_devs[(*num_sys_devs)++] = sys_dev;
170-
return 1; /* Added */
171-
}
172-
173-
return 0; /* No space */
174-
}
175-
176-
ucp_lane_index_t
177-
ucp_proto_common_select_sys_dev_by_node_id(const ucp_proto_init_params_t *params,
178-
ucp_lane_index_t num_sys_devs)
179-
{
180-
if (num_sys_devs == 0) {
181-
return 0;
182-
}
183-
return params->worker->context->config.node_local_id % num_sys_devs;
184-
}
185-
186155
/* Pack/unpack local distance to make it equal to the remote one */
187156
static void
188157
ucp_proto_common_fp8_pack_unpack_distance(ucs_sys_dev_distance_t *distance)

src/ucp/proto/proto_common.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -255,15 +255,6 @@ ucs_sys_device_t
255255
ucp_proto_common_get_sys_dev(const ucp_proto_init_params_t *params,
256256
ucp_lane_index_t lane);
257257

258-
int ucp_proto_common_add_unique_sys_dev(ucs_sys_device_t sys_dev,
259-
ucs_sys_device_t *sys_devs,
260-
ucp_lane_index_t *num_sys_devs,
261-
ucp_lane_index_t max_sys_devs);
262-
263-
ucp_lane_index_t
264-
ucp_proto_common_select_sys_dev_by_node_id(const ucp_proto_init_params_t *params,
265-
ucp_lane_index_t num_sys_devs);
266-
267258

268259
void ucp_proto_common_get_lane_distance(const ucp_proto_init_params_t *params,
269260
ucp_lane_index_t lane,

src/ucp/proto/proto_multi.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,16 +181,22 @@ static ucp_lane_index_t ucp_proto_multi_filter_net_devices(
181181
}
182182

183183
sys_dev = ucp_proto_common_get_sys_dev(params, lane);
184-
ucp_proto_common_add_unique_sys_dev(sys_dev, sys_devs, &num_max_bw_devs,
185-
UCP_PROTO_MAX_LANES);
184+
for (i = 0; i < num_max_bw_devs; ++i) {
185+
if (sys_dev == sys_devs[i]) {
186+
break;
187+
}
188+
}
189+
190+
if (i == num_max_bw_devs) {
191+
sys_devs[num_max_bw_devs++] = sys_dev;
192+
}
186193
}
187194

188195
if (num_max_bw_devs == 0) {
189196
return num_lanes;
190197
}
191198

192-
seed = ucp_proto_common_select_sys_dev_by_node_id(params, num_max_bw_devs);
193-
199+
seed = params->worker->context->config.node_local_id % num_max_bw_devs;
194200
for (i = !!fixed_first_lane, num_filtered_lanes = i; i < num_lanes; ++i) {
195201
lane = lanes[i];
196202
tl_rsc = ucp_proto_common_get_tl_rsc(params, lane);

src/ucp/proto/proto_single.c

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -10,87 +10,13 @@
1010

1111
#include "proto_single.h"
1212
#include "proto_common.h"
13-
#include "proto_common.inl"
1413
#include "proto_init.h"
1514
#include "proto_debug.h"
1615

1716
#include <ucs/debug/assert.h>
1817
#include <ucs/debug/log.h>
1918
#include <ucs/sys/math.h>
2019

21-
static double
22-
ucp_proto_single_get_bandwidth(const ucp_proto_common_init_params_t *params,
23-
ucp_lane_index_t lane)
24-
{
25-
ucp_proto_common_tl_perf_t tl_perf;
26-
ucp_proto_perf_node_t *perf_node;
27-
ucs_status_t status;
28-
29-
status = ucp_proto_common_get_lane_perf(params, lane, &tl_perf, &perf_node);
30-
if (status != UCS_OK) {
31-
return 0;
32-
}
33-
34-
ucp_proto_perf_node_deref(&perf_node);
35-
return tl_perf.bandwidth;
36-
}
37-
38-
static void
39-
ucp_proto_single_update_lane(const ucp_proto_single_init_params_t *params,
40-
ucp_lane_index_t *lane_p)
41-
{
42-
const ucp_proto_common_init_params_t *common_params = &params->super;
43-
const ucp_proto_init_params_t *init_params = &common_params->super;
44-
const ucp_context_h context = init_params->worker->context;
45-
double bandwidth;
46-
ucp_lane_index_t lanes[UCP_PROTO_MAX_LANES];
47-
ucs_sys_device_t sys_devs[UCP_PROTO_MAX_LANES];
48-
ucp_lane_index_t num_lanes, num_same_bw_devs, i, lane;
49-
ucs_sys_device_t sys_dev;
50-
51-
if (!context->config.ext.proto_use_single_net_device ||
52-
/* skip lane update for node_local_id 0 since the original lane would be
53-
* selected anyway */
54-
(context->config.node_local_id == 0)) {
55-
return;
56-
}
57-
58-
if (!ucp_proto_common_is_net_dev(init_params, *lane_p)) {
59-
return;
60-
}
61-
62-
bandwidth = ucp_proto_single_get_bandwidth(common_params, *lane_p);
63-
lanes[0] = *lane_p;
64-
sys_devs[0] = ucp_proto_common_get_sys_dev(init_params, lanes[0]);
65-
66-
num_lanes = ucp_proto_common_find_lanes(
67-
init_params, common_params->flags, params->lane_type,
68-
params->tl_cap_flags, UCP_PROTO_MAX_LANES - 1,
69-
(common_params->exclude_map | UCS_BIT(lanes[0])),
70-
ucp_proto_common_filter_min_frag, lanes + 1);
71-
72-
for (num_same_bw_devs = 1, i = 1; i < num_lanes; ++i) {
73-
lane = lanes[i];
74-
if (!ucp_proto_common_is_net_dev(init_params, lane)) {
75-
continue;
76-
}
77-
78-
if (!ucp_proto_common_bandwidth_equal(
79-
ucp_proto_single_get_bandwidth(common_params, lane), bandwidth)) {
80-
continue;
81-
}
82-
83-
sys_dev = ucp_proto_common_get_sys_dev(init_params, lane);
84-
if (ucp_proto_common_add_unique_sys_dev(sys_dev, sys_devs,
85-
&num_same_bw_devs,
86-
UCP_PROTO_MAX_LANES)) {
87-
lanes[num_same_bw_devs - 1] = lane;
88-
}
89-
}
90-
91-
*lane_p = lanes[ucp_proto_common_select_sys_dev_by_node_id(init_params,
92-
num_same_bw_devs)];
93-
}
9420

9521
ucs_status_t ucp_proto_single_init(const ucp_proto_single_init_params_t *params,
9622
ucp_proto_perf_t **perf_p,
@@ -121,8 +47,6 @@ ucs_status_t ucp_proto_single_init(const ucp_proto_single_init_params_t *params,
12147

12248
ucs_assert(num_lanes == 1);
12349

124-
ucp_proto_single_update_lane(params, &lane);
125-
12650
reg_md_map = ucp_proto_common_reg_md_map(&params->super, UCS_BIT(lane));
12751
if (reg_md_map == 0) {
12852
spriv->reg_md = UCP_NULL_RESOURCE;

0 commit comments

Comments
 (0)