Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UCP/RNDV: Adjust max_frag to be at least of minimal RNDV chunk size #10407

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
2 changes: 2 additions & 0 deletions src/ucp/am/eager_multi.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ ucp_am_eager_multi_bcopy_proto_probe(const ucp_proto_init_params_t *init_params)
.super.cfg_priority = 20,
.super.min_length = 0,
.super.max_length = SIZE_MAX,
.super.min_chunk = 0,
.super.min_frag_offs = UCP_PROTO_COMMON_OFFSET_INVALID,
.super.max_frag_offs = ucs_offsetof(uct_iface_attr_t, cap.am.max_bcopy),
.super.max_iov_offs = UCP_PROTO_COMMON_OFFSET_INVALID,
Expand Down Expand Up @@ -196,6 +197,7 @@ ucp_am_eager_multi_zcopy_proto_probe(const ucp_proto_init_params_t *init_params)
.super.cfg_priority = 30,
.super.min_length = 0,
.super.max_length = SIZE_MAX,
.super.min_chunk = 0,
.super.min_iov = 2,
.super.min_frag_offs = ucs_offsetof(uct_iface_attr_t, cap.am.min_zcopy),
.super.max_frag_offs = ucs_offsetof(uct_iface_attr_t, cap.am.max_zcopy),
Expand Down
3 changes: 3 additions & 0 deletions src/ucp/am/eager_single.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ ucp_am_eager_short_probe_common(const ucp_proto_init_params_t *init_params,
.super.cfg_priority = 0,
.super.min_length = 0,
.super.max_length = SIZE_MAX,
.super.min_chunk = 0,
.super.min_iov = 3,
.super.min_frag_offs = UCP_PROTO_COMMON_OFFSET_INVALID,
.super.max_frag_offs = ucs_offsetof(uct_iface_attr_t, cap.am.max_short),
Expand Down Expand Up @@ -230,6 +231,7 @@ static void ucp_am_eager_single_bcopy_probe_common(
.super.cfg_priority = 20,
.super.min_length = 0,
.super.max_length = SIZE_MAX,
.super.min_chunk = 0,
.super.min_iov = 0,
.super.min_frag_offs = UCP_PROTO_COMMON_OFFSET_INVALID,
.super.max_frag_offs = ucs_offsetof(uct_iface_attr_t, cap.am.max_bcopy),
Expand Down Expand Up @@ -320,6 +322,7 @@ static void ucp_am_eager_single_zcopy_probe_common(
.super.cfg_priority = 30,
.super.min_length = 0,
.super.max_length = SIZE_MAX,
.super.min_chunk = 0,
.super.min_iov = 2,
.super.min_frag_offs = ucs_offsetof(uct_iface_attr_t, cap.am.min_zcopy),
.super.max_frag_offs = ucs_offsetof(uct_iface_attr_t, cap.am.max_zcopy),
Expand Down
8 changes: 8 additions & 0 deletions src/ucp/proto/proto_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ ucp_proto_common_init_params(const ucp_proto_init_params_t *init_params)
.cfg_priority = 0,
.min_length = 0,
.max_length = SIZE_MAX,
.min_chunk = 0,
.min_iov = 0,
.min_frag_offs = UCP_PROTO_COMMON_OFFSET_INVALID,
.max_frag_offs = UCP_PROTO_COMMON_OFFSET_INVALID,
Expand Down Expand Up @@ -355,6 +356,13 @@ ucp_proto_common_get_lane_perf(const ucp_proto_common_init_params_t *params,

ucp_proto_common_get_frag_size(params, &wiface->attr, lane, &tl_min_frag,
&tl_max_frag);
if (params->min_length > tl_max_frag) {
ucs_debug("protocol %s: params->min_length=%zu is invalid, larger than "
"tl_max_frag=%zu",
ucp_proto_id_field(params->super.proto_id, name),
params->min_length, tl_max_frag);
return UCS_ERR_INVALID_PARAM;
}

perf_node = ucp_proto_perf_node_new_data("lane", "%u ppn %u eps",
context->config.est_num_ppn,
Expand Down
3 changes: 3 additions & 0 deletions src/ucp/proto/proto_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ typedef struct {
/* Maximal payload size */
size_t max_length;

/* Minimal chunk size */
size_t min_chunk;

/* Minimal number of iov */
size_t min_iov;

Expand Down
12 changes: 8 additions & 4 deletions src/ucp/proto/proto_multi.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ ucs_status_t ucp_proto_multi_init(const ucp_proto_multi_init_params_t *params,
ucp_lane_index_t i, lane, num_lanes;
ucp_proto_multi_lane_priv_t *lpriv;
ucp_proto_perf_node_t *perf_node;
size_t max_frag, min_length, min_end_offset;
size_t max_frag, min_length, min_end_offset, min_chunk;
ucp_lane_map_t lane_map;
ucp_md_map_t reg_md_map;
uint32_t weight_sum;
Expand Down Expand Up @@ -167,6 +167,12 @@ ucs_status_t ucp_proto_multi_init(const ucp_proto_multi_init_params_t *params,
/* Make sure fragment is not zero */
ucs_assert(max_frag > 0);

min_chunk = lane_perf->bandwidth * params->super.min_chunk /
min_bandwidth;
/* min_chunk must operate within iface/HW limits */
min_chunk = ucs_max(ucs_min(min_chunk, lane_perf->max_frag),
lane_perf->min_length);
max_frag = ucs_max(max_frag, min_chunk);
lpriv->max_frag = max_frag;
perf.max_frag += max_frag;

Expand Down Expand Up @@ -215,9 +221,7 @@ ucs_status_t ucp_proto_multi_init(const ucp_proto_multi_init_params_t *params,
perf.min_length = ucs_max(perf.min_length, min_length);

weight_sum += lpriv->weight;
min_end_offset += lane_perf->bandwidth *
context->config.ext.min_rndv_chunk_size /
min_bandwidth;
min_end_offset += min_chunk;
mpriv->min_frag = ucs_max(mpriv->min_frag, lane_perf->min_length);
mpriv->max_frag_sum += lpriv->max_frag;
lpriv->weight_sum = weight_sum;
Expand Down
1 change: 1 addition & 0 deletions src/ucp/rma/amo_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ static void ucp_proto_amo_probe(const ucp_proto_init_params_t *init_params,
.super.cfg_priority = 20,
.super.min_length = length,
.super.max_length = length,
.super.min_chunk = 0,
.super.min_iov = 0,
.super.min_frag_offs = UCP_PROTO_COMMON_OFFSET_INVALID,
.super.max_frag_offs = UCP_PROTO_COMMON_OFFSET_INVALID,
Expand Down
1 change: 1 addition & 0 deletions src/ucp/rma/amo_sw.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ static void ucp_proto_amo_sw_probe(const ucp_proto_init_params_t *init_params,
.super.cfg_priority = 20,
.super.min_length = sizeof(uint32_t),
.super.max_length = sizeof(uint64_t),
.super.min_chunk = 0,
.super.min_iov = 0,
.super.min_frag_offs = UCP_PROTO_COMMON_OFFSET_INVALID,
.super.max_frag_offs = UCP_PROTO_COMMON_OFFSET_INVALID,
Expand Down
1 change: 1 addition & 0 deletions src/ucp/rma/get_am.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ ucp_proto_get_am_bcopy_probe(const ucp_proto_init_params_t *init_params)
.super.cfg_priority = 20,
.super.min_length = 0,
.super.max_length = SIZE_MAX,
.super.min_chunk = 0,
.super.min_iov = 0,
.super.min_frag_offs = UCP_PROTO_COMMON_OFFSET_INVALID,
.super.max_frag_offs = ucs_offsetof(uct_iface_attr_t, cap.am.max_bcopy),
Expand Down
2 changes: 2 additions & 0 deletions src/ucp/rma/get_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ ucp_proto_get_offload_bcopy_probe(const ucp_proto_init_params_t *init_params)
.super.cfg_priority = 20,
.super.min_length = 0,
.super.max_length = SIZE_MAX,
.super.min_chunk = 0,
.super.min_iov = 0,
.super.min_frag_offs = UCP_PROTO_COMMON_OFFSET_INVALID,
.super.max_frag_offs = ucs_offsetof(uct_iface_attr_t,
Expand Down Expand Up @@ -188,6 +189,7 @@ ucp_proto_get_offload_zcopy_probe(const ucp_proto_init_params_t *init_params)
.super.cfg_priority = 30,
.super.min_length = 0,
.super.max_length = SIZE_MAX,
.super.min_chunk = 0,
.super.min_iov = 1,
.super.min_frag_offs = ucs_offsetof(uct_iface_attr_t,
cap.get.min_zcopy),
Expand Down
1 change: 1 addition & 0 deletions src/ucp/rma/put_am.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ ucp_proto_put_am_bcopy_probe(const ucp_proto_init_params_t *init_params)
.super.cfg_priority = 20,
.super.min_length = 0,
.super.max_length = SIZE_MAX,
.super.min_chunk = 0,
.super.min_iov = 0,
.super.min_frag_offs = UCP_PROTO_COMMON_OFFSET_INVALID,
.super.max_frag_offs = ucs_offsetof(uct_iface_attr_t, cap.am.max_bcopy),
Expand Down
3 changes: 3 additions & 0 deletions src/ucp/rma/put_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ ucp_proto_put_offload_short_probe(const ucp_proto_init_params_t *init_params)
.super.cfg_thresh = UCS_MEMUNITS_AUTO,
.super.cfg_priority = 0,
.super.min_length = 0,
.super.min_chunk = 0,
.super.max_length = SIZE_MAX,
.super.min_iov = 0,
.super.min_frag_offs = UCP_PROTO_COMMON_OFFSET_INVALID,
Expand Down Expand Up @@ -155,6 +156,7 @@ ucp_proto_put_offload_bcopy_probe(const ucp_proto_init_params_t *init_params)
.super.cfg_priority = 20,
.super.min_length = 0,
.super.max_length = SIZE_MAX,
.super.min_chunk = 0,
.super.min_iov = 0,
.super.min_frag_offs = UCP_PROTO_COMMON_OFFSET_INVALID,
.super.max_frag_offs = ucs_offsetof(uct_iface_attr_t,
Expand Down Expand Up @@ -242,6 +244,7 @@ ucp_proto_put_offload_zcopy_probe(const ucp_proto_init_params_t *init_params)
.super.cfg_priority = 30,
.super.min_length = 0,
.super.max_length = SIZE_MAX,
.super.min_chunk = 0,
.super.min_iov = 1,
.super.min_frag_offs = ucs_offsetof(uct_iface_attr_t,
cap.put.min_zcopy),
Expand Down
1 change: 1 addition & 0 deletions src/ucp/rndv/proto_rndv.c
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,7 @@ void ucp_proto_rndv_rts_probe(const ucp_proto_init_params_t *init_params)
.super.cfg_priority = 60,
.super.min_length = 0,
.super.max_length = SIZE_MAX,
.super.min_chunk = 0,
.super.min_iov = 0,
.super.min_frag_offs = UCP_PROTO_COMMON_OFFSET_INVALID,
.super.max_frag_offs = ucs_offsetof(uct_iface_attr_t, cap.am.max_bcopy),
Expand Down
1 change: 1 addition & 0 deletions src/ucp/rndv/rndv_am.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ static void ucp_rndv_am_probe_common(ucp_proto_multi_init_params_t *params)
params->super.exclude_map = 0;
params->super.min_length = 0;
params->super.max_length = SIZE_MAX;
params->super.min_chunk = context->config.ext.min_rndv_chunk_size,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can set it to 0

params->super.overhead = context->config.ext.proto_overhead_multi;
params->super.latency = 0;
params->first.lane_type = UCP_LANE_TYPE_AM;
Expand Down
1 change: 1 addition & 0 deletions src/ucp/rndv/rndv_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ ucp_proto_rndv_get_common_probe(const ucp_proto_init_params_t *init_params,
.super.latency = 0,
.super.min_length = 0,
.super.max_length = max_length,
.super.min_chunk = context->config.ext.min_rndv_chunk_size,
.super.min_iov = 1,
.super.min_frag_offs = ucs_offsetof(uct_iface_attr_t,
cap.get.min_zcopy),
Expand Down
1 change: 1 addition & 0 deletions src/ucp/rndv/rndv_put.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ ucp_proto_rndv_put_common_probe(const ucp_proto_init_params_t *init_params,
.super.cfg_priority = 80,
.super.min_length = 0,
.super.max_length = max_length,
.super.min_chunk = context->config.ext.min_rndv_chunk_size,
.super.min_iov = 1,
.super.min_frag_offs = ucs_offsetof(uct_iface_attr_t,
cap.put.min_zcopy),
Expand Down
2 changes: 2 additions & 0 deletions src/ucp/rndv/rndv_rkey_ptr.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ ucp_proto_rndv_rkey_ptr_probe(const ucp_proto_init_params_t *init_params)
.super.latency = 0,
.super.min_length = 0,
.super.max_length = SIZE_MAX,
.super.min_chunk = 0,
.super.min_iov = 0,
.super.min_frag_offs = UCP_PROTO_COMMON_OFFSET_INVALID,
.super.max_frag_offs = UCP_PROTO_COMMON_OFFSET_INVALID,
Expand Down Expand Up @@ -260,6 +261,7 @@ ucp_proto_rndv_rkey_ptr_mtype_probe(const ucp_proto_init_params_t *init_params)
.super.cfg_thresh = ucp_proto_rndv_cfg_thresh(context, rndv_modes),
.super.cfg_priority = 80,
.super.min_length = 0,
.super.min_chunk = 0,
.super.min_iov = 0,
.super.min_frag_offs = UCP_PROTO_COMMON_OFFSET_INVALID,
.super.max_frag_offs = UCP_PROTO_COMMON_OFFSET_INVALID,
Expand Down
2 changes: 2 additions & 0 deletions src/ucp/rndv/rndv_rtr.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ static void ucp_proto_rndv_rtr_probe(const ucp_proto_init_params_t *init_params)
.super.cfg_priority = 80,
.super.min_length = 1,
.super.max_length = SIZE_MAX,
.super.min_chunk = 0,
.super.min_frag_offs = UCP_PROTO_COMMON_OFFSET_INVALID,
.super.max_frag_offs = ucs_offsetof(uct_iface_attr_t, cap.am.max_bcopy),
.super.max_iov_offs = UCP_PROTO_COMMON_OFFSET_INVALID,
Expand Down Expand Up @@ -381,6 +382,7 @@ ucp_proto_rndv_rtr_mtype_probe(const ucp_proto_init_params_t *init_params)
UCS_BIT(UCP_RNDV_MODE_PUT_PIPELINE)),
.super.cfg_priority = 80,
.super.min_length = 1,
.super.min_chunk = 0,
.super.min_frag_offs = UCP_PROTO_COMMON_OFFSET_INVALID,
.super.max_frag_offs = ucs_offsetof(uct_iface_attr_t, cap.am.max_bcopy),
.super.max_iov_offs = UCP_PROTO_COMMON_OFFSET_INVALID,
Expand Down
2 changes: 2 additions & 0 deletions src/ucp/stream/stream_multi.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ ucp_stream_multi_bcopy_probe(const ucp_proto_init_params_t *init_params)
.super.cfg_priority = 20,
.super.min_length = 0,
.super.max_length = SIZE_MAX,
.super.min_chunk = 0,
.super.min_iov = 0,
.super.min_frag_offs = UCP_PROTO_COMMON_OFFSET_INVALID,
.super.max_frag_offs = ucs_offsetof(uct_iface_attr_t, cap.am.max_bcopy),
Expand Down Expand Up @@ -155,6 +156,7 @@ ucp_stream_multi_zcopy_probe(const ucp_proto_init_params_t *init_params)
.super.cfg_priority = 30,
.super.min_length = 0,
.super.max_length = SIZE_MAX,
.super.min_chunk = 0,
.super.min_iov = 1,
.super.min_frag_offs = ucs_offsetof(uct_iface_attr_t, cap.am.min_zcopy),
.super.max_frag_offs = ucs_offsetof(uct_iface_attr_t, cap.am.max_zcopy),
Expand Down
2 changes: 2 additions & 0 deletions src/ucp/tag/eager_multi.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ static void ucp_proto_eager_bcopy_multi_common_probe(
.super.cfg_priority = 20,
.super.min_length = 0,
.super.max_length = SIZE_MAX,
.super.min_chunk = 0,
.super.min_iov = 0,
.super.min_frag_offs = UCP_PROTO_COMMON_OFFSET_INVALID,
.super.max_frag_offs = ucs_offsetof(uct_iface_attr_t, cap.am.max_bcopy),
Expand Down Expand Up @@ -231,6 +232,7 @@ ucp_proto_eager_zcopy_multi_probe(const ucp_proto_init_params_t *init_params)
.super.cfg_priority = 30,
.super.min_length = 0,
.super.max_length = SIZE_MAX,
.super.min_chunk = 0,
.super.min_iov = 1,
.super.min_frag_offs = ucs_offsetof(uct_iface_attr_t, cap.am.min_zcopy),
.super.max_frag_offs = ucs_offsetof(uct_iface_attr_t, cap.am.max_zcopy),
Expand Down
3 changes: 3 additions & 0 deletions src/ucp/tag/eager_single.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ ucp_proto_eager_short_probe(const ucp_proto_init_params_t *init_params)
.super.cfg_priority = 0,
.super.min_length = 0,
.super.max_length = SIZE_MAX,
.super.min_chunk = 0,
.super.min_iov = 0,
.super.min_frag_offs = UCP_PROTO_COMMON_OFFSET_INVALID,
.super.max_frag_offs = ucs_offsetof(uct_iface_attr_t, cap.am.max_short),
Expand Down Expand Up @@ -130,6 +131,7 @@ ucp_proto_eager_bcopy_single_probe(const ucp_proto_init_params_t *init_params)
.super.cfg_priority = 20,
.super.min_length = 0,
.super.max_length = SIZE_MAX,
.super.min_chunk = 0,
.super.min_iov = 0,
.super.min_frag_offs = UCP_PROTO_COMMON_OFFSET_INVALID,
.super.max_frag_offs = ucs_offsetof(uct_iface_attr_t, cap.am.max_bcopy),
Expand Down Expand Up @@ -177,6 +179,7 @@ ucp_proto_eager_zcopy_single_probe(const ucp_proto_init_params_t *init_params)
.super.cfg_priority = 30,
.super.min_length = 0,
.super.max_length = SIZE_MAX,
.super.min_chunk = 0,
.super.min_iov = 1,
.super.min_frag_offs = ucs_offsetof(uct_iface_attr_t, cap.am.min_zcopy),
.super.max_frag_offs = ucs_offsetof(uct_iface_attr_t, cap.am.max_zcopy),
Expand Down
3 changes: 3 additions & 0 deletions src/ucp/tag/offload/eager.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ static void ucp_proto_eager_tag_offload_short_probe(
.super.cfg_priority = 0,
.super.min_length = 0,
.super.max_length = SIZE_MAX,
.super.min_chunk = 0,
.super.min_iov = 0,
.super.min_frag_offs = UCP_PROTO_COMMON_OFFSET_INVALID,
.super.max_frag_offs = ucs_offsetof(uct_iface_attr_t,
Expand Down Expand Up @@ -128,6 +129,7 @@ static void ucp_proto_eager_tag_offload_bcopy_probe_common(
.super.cfg_priority = 20,
.super.min_length = 0,
.super.max_length = SIZE_MAX,
.super.min_chunk = 0,
.super.min_iov = 0,
.super.min_frag_offs = UCP_PROTO_COMMON_OFFSET_INVALID,
.super.max_frag_offs = ucs_offsetof(uct_iface_attr_t,
Expand Down Expand Up @@ -237,6 +239,7 @@ static void ucp_proto_eager_tag_offload_zcopy_probe_common(
.super.cfg_priority = 30,
.super.min_length = 0,
.super.max_length = SIZE_MAX,
.super.min_chunk = 0,
.super.min_iov = 1,
.super.min_frag_offs = UCP_PROTO_COMMON_OFFSET_INVALID,
.super.max_frag_offs = ucs_offsetof(uct_iface_attr_t,
Expand Down
2 changes: 2 additions & 0 deletions src/ucp/tag/offload/rndv.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ ucp_tag_rndv_offload_proto_probe(const ucp_proto_init_params_t *init_params)
.super.min_length = ucp_ep_tag_offload_min_rndv_thresh(
context, init_params->ep_config_key),
.super.max_length = SIZE_MAX,
.super.min_chunk = 0,
.super.min_iov = 0,
.super.min_frag_offs = UCP_PROTO_COMMON_OFFSET_INVALID,
.super.max_frag_offs = ucs_offsetof(uct_iface_attr_t,
Expand Down Expand Up @@ -165,6 +166,7 @@ ucp_tag_rndv_offload_sw_proto_probe(const ucp_proto_init_params_t *init_params)
.super.min_length = ucp_ep_tag_offload_min_rndv_thresh(
context, init_params->ep_config_key),
.super.max_length = SIZE_MAX,
.super.min_chunk = 0,
.super.min_iov = 0,
.super.min_frag_offs = UCP_PROTO_COMMON_OFFSET_INVALID,
/* SW rendezvous request over tag offload is implemented in UCT via tag
Expand Down
Loading
Loading