1717
1818#define UCP_PROTO_RNDV_GET_DESC "read from remote"
1919
20+ static ucp_lane_index_t
21+ ucp_proto_rndv_get_max_lanes (const ucp_proto_init_params_t * init_params )
22+ {
23+ ucp_context_t * context = init_params -> worker -> context ;
24+ const ucp_ep_config_key_t * ep_key = init_params -> ep_config_key ;
25+ ucp_lane_index_t max_lanes = context -> config .ext .max_rndv_lanes ;
26+ const uct_iface_attr_t * iface_attr ;
27+ ucp_lane_index_t lane ;
28+
29+ if (context -> config .ext .max_rndv_lanes_config != UCS_ULUNITS_AUTO ) {
30+ return max_lanes ;
31+ }
32+
33+ for (lane = 0 ; lane < ep_key -> num_lanes ; ++ lane ) {
34+ if (!(ep_key -> lanes [lane ].lane_types &
35+ UCS_BIT (UCP_LANE_TYPE_RMA_BW ))) {
36+ continue ;
37+ }
38+
39+ iface_attr = ucp_proto_common_get_iface_attr (init_params , lane );
40+ if (!(iface_attr -> cap .flags & UCT_IFACE_FLAG_GET_ZCOPY )) {
41+ continue ;
42+ }
43+
44+ max_lanes = ucs_max (max_lanes ,
45+ ucs_min (iface_attr -> dev_num_paths ,
46+ UCP_PROTO_MAX_LANES ));
47+ }
48+
49+ return max_lanes ;
50+ }
51+
52+ static void
53+ ucp_proto_rndv_get_add_proto (ucp_proto_multi_init_params_t * params )
54+ {
55+ ucp_proto_rndv_bulk_priv_t rpriv ;
56+ ucp_proto_perf_t * perf ;
57+ ucs_status_t status ;
58+
59+ status = ucp_proto_rndv_bulk_init (params , UCP_PROTO_RNDV_GET_DESC ,
60+ UCP_PROTO_RNDV_ATS_NAME , & perf , & rpriv );
61+ if (status != UCS_OK ) {
62+ return ;
63+ }
64+
65+ ucp_proto_select_add_proto (& params -> super .super , params -> super .cfg_thresh ,
66+ params -> super .cfg_priority , perf , & rpriv ,
67+ UCP_PROTO_MULTI_EXTENDED_PRIV_SIZE (& rpriv ,
68+ mpriv ));
69+ }
70+
2071static void
2172ucp_proto_rndv_get_common_probe (const ucp_proto_init_params_t * init_params ,
2273 uint64_t rndv_modes , size_t max_length ,
@@ -26,6 +77,8 @@ ucp_proto_rndv_get_common_probe(const ucp_proto_init_params_t *init_params,
2677 const ucp_memory_info_t * reg_mem_info )
2778{
2879 ucp_context_t * context = init_params -> worker -> context ;
80+ ucp_lane_index_t max_lanes =
81+ ucp_proto_rndv_get_max_lanes (init_params );
2982 ucp_proto_multi_init_params_t params = {
3083 .super .super = * init_params ,
3184 .super .cfg_thresh = ucp_proto_rndv_cfg_thresh (context , rndv_modes ),
@@ -58,25 +111,18 @@ ucp_proto_rndv_get_common_probe(const ucp_proto_init_params_t *init_params,
58111 .opt_align_offs = ucs_offsetof (uct_iface_attr_t ,
59112 cap .get .opt_zcopy_align ),
60113 };
61- ucp_proto_rndv_bulk_priv_t rpriv ;
62- ucp_proto_perf_t * perf ;
63- ucs_status_t status ;
64114
65115 if (!ucp_proto_rndv_op_check (init_params , UCP_OP_ID_RNDV_RECV ,
66116 support_ppln )) {
67117 return ;
68118 }
69119
70- status = ucp_proto_rndv_bulk_init (& params , UCP_PROTO_RNDV_GET_DESC ,
71- UCP_PROTO_RNDV_ATS_NAME , & perf , & rpriv );
72- if (status != UCS_OK ) {
73- return ;
74- }
120+ ucp_proto_rndv_get_add_proto (& params );
75121
76- ucp_proto_select_add_proto ( & params . super . super , params .super . cfg_thresh ,
77- params .super . cfg_priority , perf , & rpriv ,
78- UCP_PROTO_MULTI_EXTENDED_PRIV_SIZE ( & rpriv ,
79- mpriv ));
122+ if ( max_lanes > params .max_lanes ) {
123+ params .max_lanes = max_lanes ;
124+ ucp_proto_rndv_get_add_proto ( & params );
125+ }
80126}
81127
82128static UCS_F_ALWAYS_INLINE ucs_status_t
0 commit comments