-
Notifications
You must be signed in to change notification settings - Fork 427
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/PROTO/MULTI: Allow header be greater than max_frag #10263
base: master
Are you sure you want to change the base?
Changes from 1 commit
ce3f490
cf0ff67
10d6d3c
8c8bf1e
897d55c
17f82cd
c9546a1
d7fc813
e74c74a
8f7d0cf
ed9357a
925fdc9
622a5ef
573bb76
269b69f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,10 +16,24 @@ | |
#include "proto_debug.h" | ||
#include "proto_multi.inl" | ||
|
||
#include <ucs/algorithm/qsort_r.h> | ||
#include <ucs/debug/assert.h> | ||
#include <ucs/debug/log.h> | ||
|
||
|
||
static int ucp_proto_multi_compare_tl_perf(const void *elem1, const void *elem2, | ||
void *arg) | ||
{ | ||
const ucp_lane_index_t *lane1 = elem1; | ||
const ucp_lane_index_t *lane2 = elem2; | ||
const ucp_proto_common_tl_perf_t *lanes_perf = arg; | ||
int diff; | ||
|
||
diff = lanes_perf[*lane2].bandwidth - lanes_perf[*lane1].bandwidth; | ||
/* If bandwidths are equal, prefer to maintain the original ordering */ | ||
return (diff != 0) ? diff : (elem1 - elem2); | ||
} | ||
|
||
ucs_status_t ucp_proto_multi_init(const ucp_proto_multi_init_params_t *params, | ||
const char *perf_name, | ||
ucp_proto_perf_t **perf_p, | ||
|
@@ -59,8 +73,7 @@ ucs_status_t ucp_proto_multi_init(const ucp_proto_multi_init_params_t *params, | |
¶ms->super, params->first.lane_type, params->first.tl_cap_flags, | ||
1, 0, lanes); | ||
if (num_lanes == 0) { | ||
ucs_trace("no lanes for %s", | ||
ucp_proto_id_field(params->super.super.proto_id, name)); | ||
ucs_trace("no lanes for %s", perf_name); | ||
return UCS_ERR_NO_ELEM; | ||
} | ||
|
||
|
@@ -86,6 +99,16 @@ ucs_status_t ucp_proto_multi_init(const ucp_proto_multi_init_params_t *params, | |
max_bandwidth = ucs_max(max_bandwidth, lane_perf->bandwidth); | ||
} | ||
|
||
/* Sort lanes by bandwidth */ | ||
if (num_lanes > 1) { | ||
/* If type of the first lane is not the same as in the middle, then | ||
* exclude this lane from sorting */ | ||
lane = (params->first.lane_type == params->middle.lane_type) ? 0 : 1; | ||
/* Sort lanes array by lanes_perf bandwidth */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there is already similar comment on line 101 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
ucs_qsort_r(lanes + lane, num_lanes - lane, sizeof(ucp_lane_index_t), | ||
ucp_proto_multi_compare_tl_perf, lanes_perf); | ||
} | ||
|
||
/* Select the lanes to use, and calculate their aggregate performance */ | ||
perf.bandwidth = 0; | ||
perf.send_pre_overhead = 0; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,8 +66,11 @@ ucp_proto_multi_max_payload(ucp_request_t *req, | |
size_t max_frag = lpriv->max_frag - hdr_size; | ||
size_t max_payload; | ||
|
||
ucs_assertv(lpriv->max_frag > hdr_size, "max_frag=%zu hdr_size=%zu", | ||
lpriv->max_frag, hdr_size); | ||
/* If header is greater than max_frag - that's ok, we allow it, but we send | ||
* only the header data and keep the payload empty */ | ||
if (lpriv->max_frag <= hdr_size) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe smth like
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, good idea There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Apparently I'm reverting this change, because signed type There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AFAIR There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As I see in ucp_am_send_nbx_check_header_length(ucp_worker_h worker, size_t header_length)
{
if (ENABLE_PARAMS_CHECK && (header_length > worker->max_am_header)) { There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in this case, better not calculate There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
return 0; | ||
} | ||
|
||
/* Do not split very small sends to chunks, it's not worth it, and | ||
generic datatype may not be able to pack to a smaller buffer */ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's not the same I'd keep proto_name here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok