UCP/WIREUP: Implement common copying of lanes function for futher re-use#5610
UCP/WIREUP: Implement common copying of lanes function for futher re-use#5610dmitrygx wants to merge 17 commits into
Conversation
|
@evgeny-leksikov @alinask @brminich could you review pls? |
00773c2 to
d96e4da
Compare
| continue; | ||
| } | ||
|
|
||
| uct_ep = ucp_wireup_extract_lane(from_ep, lane_idx); |
There was a problem hiding this comment.
how can we know if from_ep lane was the owner of uct_ep?
There was a problem hiding this comment.
we don't need to know whether it's owner or not
if we are changing ownership, to_ep will be owner, otherwise - from_ep is owner
There was a problem hiding this comment.
but if "from_ep" was NOT the owner, it means the "to_ep" should not be the owner as well, right?
There was a problem hiding this comment.
let's add assertion that from_ep is owner for the UCT EP - it is expected behavior
|
@brminich @evgeny-leksikov could you review pls? |
| w_ep->super.ucp_ep = ucp_ep; | ||
| } | ||
| if (change_ownership) { | ||
| to_is_owner = 1; |
There was a problem hiding this comment.
minor: can do shorter:
to_is_owner = change_ownership;
from_is_owner = !change_ownership;
|
|
||
| static void ucp_cm_client_restore_ep(ucp_wireup_ep_t *wireup_cm_ep, | ||
| ucp_ep_h ucp_ep) | ||
| static void ucp_cm_copy_ep_lanes(ucp_ep_h to_ep, ucp_ep_h from_ep, |
There was a problem hiding this comment.
pls document all the parameters. How the EPs has to be created and initialized before the call? if to_ep is not initialized, then maybe make it [out] parameter of ucp_cm_ep_dup?
There was a problem hiding this comment.
done, added the description
to_ep has to be initialized, so, no need to duplicate it here
There was a problem hiding this comment.
so in this case here should be 2 iterators and to_ep should be reconfigured since to_ep can have some lanes initialized.
There was a problem hiding this comment.
we have assert that to_ep doesn't have UCT_EPs for the lanes
There was a problem hiding this comment.
which is removed?
assert() doesn't work, since configurations are not equal:
- TMP EP has two lanes: CM lane and transport lane
- UCP EP has only one lane: CM lane
After we copy UCT EPs from TMP EP to UCP EP, it will do init_lanes() where new config will be selected
The new config could be equal to what we have in TMP EP, then UCT EPs copied to UCP EP will be re-used in the new config. In the current code, it has to be the same.
|
|
||
| status = ucp_wireup_ep_create(to_ep, &to_ep->uct_eps[lane_idx]); | ||
| if (status != UCS_OK) { | ||
| /* coverity[leaked_storage] */ |
There was a problem hiding this comment.
if we failed to create wireup_ep, what happens to the lane we extracted?
There was a problem hiding this comment.
added ucs_fatal() instead of continue;
|
@brminich @evgeny-leksikov @yosefe your comments were addressed, could you review pls? |
|
errors look relevant: |
@brminich fixed |
| } | ||
|
|
||
| ucp_proxy_ep_set_uct_ep(&wireup_ep->super, next_ep, 1); | ||
| ucp_wireup_ep_set_next_ep(uct_ep, next_ep, 1, 0); |
There was a problem hiding this comment.
ucp_wireup_ep_set_next_ep() does additional checks
| if (is_local_connected) { | ||
| wireup_ep->flags |= UCP_WIREUP_EP_FLAG_LOCAL_CONNECTED; | ||
| } |
There was a problem hiding this comment.
why need this? can just call ucp_proxy_ep_set_uct_ep instead like it is done now
There was a problem hiding this comment.
I wanted to use ucp_wireup_ep_set_next_ep() akways instead of:
if (local_conencted) {
ucp_wireup_ep_set_next_ep();
} else {
ucp_proxy_ep_set_uct_ep();
}| (from_wireup_ep->flags & | ||
| UCP_WIREUP_EP_FLAG_LOCAL_CONNECTED); | ||
|
|
||
| status = ucp_wireup_ep_create(to_ep, &to_ep->uct_eps[lane_idx]); |
There was a problem hiding this comment.
can we just take existing wireup ep, like it was done before?
There was a problem hiding this comment.
no, since we will need this to set who is the owner of the UCT EP- TMP EP or user's UCP EP
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
@brminich @evgeny-leksikov @yosefe could you review pls? |
| to_is_owner, is_local_connected); | ||
|
|
||
| if (from_wireup_ep == NULL) { | ||
| /* from_ep must be the owner of the UCT EP in this case */ |
There was a problem hiding this comment.
can you please elaborate? why?
| is_local_connected = (from_wireup_ep == NULL) || | ||
| (from_wireup_ep->flags & | ||
| UCP_WIREUP_EP_FLAG_LOCAL_CONNECTED); |
There was a problem hiding this comment.
should not we inherit other wireup flags? if yes - maybe set them outside of ucp_wireup_ep_set_next_ep or pass instead of is_local_connected?
|
@brminich @evgeny-leksikov @yosefe could you review pls? |
|
|
||
| if (from_wireup_ep == NULL) { | ||
| /* wireup EPs couldn't exist for the from_ep lanes if this is | ||
| * called on the server side of the conenction to copy the lanes |
There was a problem hiding this comment.
what does it mean? This function is not invoked on the server side
There was a problem hiding this comment.
yes, but it will be called
What
Implement common copying of lanes function for futher re-use.
Why ?
To shorten #5582 and simplify maintaining the main EP's and TMP EP's lanes that may point to the same WIREUP EP.
Using different WIRUEP EPs that point to the same UCT EPs (with different
is_ownerflag - depends on the state of WIREUP) makes it possible.How ?
is_ownerflag inucp_wireup_ep_set_next_ep()to mark WIREUP EPs that areowner/not ownerfor UCT EP that's under the hood.ucp_cm_client_restore_ep()byucp_cm_copy_ep_lanes()that copies lanes? creates new WIREUP EPs for lanes and changes ownership of UCT EPs if needed.