-
Notifications
You must be signed in to change notification settings - Fork 434
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/WIREUP: Implement common copying of lanes function for futher re-use #5610
Changes from 4 commits
d96e4da
9f70f8d
9b9e72d
224b244
312321a
2754df7
d8c27f1
469168c
d698bf6
ed8a029
4f3c94e
be70c93
27d718c
ec96435
5d2aa0a
863b57d
4c78ae0
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 |
---|---|---|
|
@@ -195,7 +195,7 @@ static ssize_t ucp_cm_client_priv_pack_cb(void *arg, | |
goto out; | ||
} | ||
|
||
ucp_wireup_ep_set_next_ep(tmp_ep->uct_eps[lane_idx], tl_ep); | ||
ucp_wireup_ep_set_next_ep(tmp_ep->uct_eps[lane_idx], tl_ep, 1); | ||
} else { | ||
ucs_assert(ucp_worker_is_tl_2iface(worker, rsc_idx)); | ||
} | ||
|
@@ -251,24 +251,56 @@ ucp_cm_client_connect_prog_arg_free(ucp_cm_client_connect_progress_arg_t *arg) | |
ucs_free(arg); | ||
} | ||
|
||
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, | ||
int change_ownership) | ||
{ | ||
ucp_ep_h tmp_ep = wireup_cm_ep->tmp_ep; | ||
ucp_wireup_ep_t *w_ep; | ||
int to_is_owner, from_is_owner; | ||
ucp_lane_index_t lane_idx; | ||
ucs_status_t status; | ||
uct_ep_h uct_ep; | ||
|
||
for (lane_idx = 0; lane_idx < ucp_ep_num_lanes(tmp_ep); ++lane_idx) { | ||
if (tmp_ep->uct_eps[lane_idx] != NULL) { | ||
ucs_assert(ucp_ep->uct_eps[lane_idx] == NULL); | ||
ucp_ep->uct_eps[lane_idx] = tmp_ep->uct_eps[lane_idx]; | ||
w_ep = ucs_derived_of(ucp_ep->uct_eps[lane_idx], ucp_wireup_ep_t); | ||
w_ep->super.ucp_ep = ucp_ep; | ||
} | ||
if (change_ownership) { | ||
to_is_owner = 1; | ||
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. minor: can do shorter:
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 |
||
from_is_owner = 0; | ||
} else { | ||
to_is_owner = 0; | ||
from_is_owner = 1; | ||
} | ||
|
||
ucp_ep_destroy_base(tmp_ep); /* not needed anymore */ | ||
wireup_cm_ep->tmp_ep = NULL; | ||
for (lane_idx = 0; lane_idx < ucp_ep_num_lanes(from_ep); ++lane_idx) { | ||
if ((lane_idx == ucp_ep_get_cm_lane(from_ep)) || | ||
(from_ep->uct_eps[lane_idx] == NULL)) { | ||
continue; | ||
} | ||
|
||
ucs_assert(to_ep->uct_eps[lane_idx] == NULL); | ||
|
||
uct_ep = ucp_wireup_extract_lane(from_ep, lane_idx); | ||
brminich marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if (uct_ep == NULL) { | ||
continue; | ||
} | ||
|
||
status = ucp_wireup_ep_create(to_ep, &to_ep->uct_eps[lane_idx]); | ||
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. can we just take existing wireup ep, like it was done before? 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. no, since we will need this to set who is the owner of the UCT EP- TMP EP or user's UCP EP |
||
if (status != UCS_OK) { | ||
/* coverity[leaked_storage] */ | ||
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. if we failed to create wireup_ep, what happens to the lane we extracted? 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. added |
||
continue; | ||
} | ||
|
||
ucs_assert(!ucp_wireup_ep_test(from_ep->uct_eps[lane_idx]) || | ||
ucp_wireup_ep(from_ep->uct_eps[lane_idx])->super.is_owner); | ||
|
||
ucp_wireup_ep_set_next_ep(to_ep->uct_eps[lane_idx], | ||
uct_ep, to_is_owner); | ||
|
||
if (from_ep->uct_eps[lane_idx] == NULL) { | ||
/* from_ep must be the owner EP in this case */ | ||
ucs_assert(from_is_owner); | ||
from_ep->uct_eps[lane_idx] = uct_ep; | ||
} else { | ||
ucp_wireup_ep_set_next_ep(from_ep->uct_eps[lane_idx], | ||
uct_ep, from_is_owner); | ||
} | ||
} | ||
} | ||
|
||
/* | ||
|
@@ -281,7 +313,7 @@ static unsigned ucp_cm_client_connect_progress(void *arg) | |
ucp_worker_h worker = ucp_ep->worker; | ||
ucp_context_h context = worker->context; | ||
uct_ep_h uct_cm_ep = ucp_ep_get_cm_uct_ep(ucp_ep); | ||
ucp_wireup_ep_t *wireup_ep; | ||
ucp_wireup_ep_t *cm_wireup_ep; | ||
ucp_unpacked_address_t addr; | ||
uint64_t tl_bitmap; | ||
ucp_rsc_index_t dev_index; | ||
|
@@ -292,9 +324,9 @@ static unsigned ucp_cm_client_connect_progress(void *arg) | |
|
||
UCS_ASYNC_BLOCK(&worker->async); | ||
|
||
wireup_ep = ucp_ep_get_cm_wireup_ep(ucp_ep); | ||
ucs_assert(wireup_ep != NULL); | ||
ucs_assert(wireup_ep->ep_init_flags & UCP_EP_INIT_CM_WIREUP_CLIENT); | ||
cm_wireup_ep = ucp_ep_get_cm_wireup_ep(ucp_ep); | ||
ucs_assert(cm_wireup_ep != NULL); | ||
ucs_assert(cm_wireup_ep->ep_init_flags & UCP_EP_INIT_CM_WIREUP_CLIENT); | ||
|
||
status = ucp_address_unpack(worker, progress_arg->sa_data + 1, | ||
UCP_ADDRESS_PACK_FLAG_IFACE_ADDR | | ||
|
@@ -317,14 +349,14 @@ static unsigned ucp_cm_client_connect_progress(void *arg) | |
ucp_ep_update_remote_id(ucp_ep, progress_arg->sa_data->ep_id); | ||
|
||
/* Get tl bitmap from tmp_ep, because it contains initial configuration. */ | ||
tl_bitmap = ucp_ep_get_tl_bitmap(wireup_ep->tmp_ep); | ||
tl_bitmap = ucp_ep_get_tl_bitmap(cm_wireup_ep->tmp_ep); | ||
ucs_assert(tl_bitmap != 0); | ||
rsc_index = ucs_ffs64(tl_bitmap); | ||
dev_index = context->tl_rscs[rsc_index].dev_index; | ||
|
||
/* Restore initial configuration from tmp_ep created for packing local | ||
* addresses. */ | ||
ucp_cm_client_restore_ep(wireup_ep, ucp_ep); | ||
ucp_cm_copy_ep_lanes(ucp_ep, cm_wireup_ep->tmp_ep, 1); | ||
|
||
#ifdef ENABLE_ASSERT | ||
ucs_for_each_bit(rsc_index, tl_bitmap) { | ||
|
@@ -333,7 +365,7 @@ static unsigned ucp_cm_client_connect_progress(void *arg) | |
#endif | ||
|
||
tl_bitmap = ucp_context_dev_idx_tl_bitmap(context, dev_index); | ||
status = ucp_wireup_init_lanes(ucp_ep, wireup_ep->ep_init_flags, | ||
status = ucp_wireup_init_lanes(ucp_ep, cm_wireup_ep->ep_init_flags, | ||
tl_bitmap, &addr, addr_indices); | ||
if (status != UCS_OK) { | ||
goto out_free_addr; | ||
|
@@ -357,7 +389,7 @@ static unsigned ucp_cm_client_connect_progress(void *arg) | |
ucs_free(addr.address_list); | ||
out: | ||
if (status != UCS_OK) { | ||
ucp_worker_set_ep_failed(worker, ucp_ep, &wireup_ep->super.super, | ||
ucp_worker_set_ep_failed(worker, ucp_ep, &cm_wireup_ep->super.super, | ||
ucp_ep_get_cm_lane(ucp_ep), status); | ||
} | ||
|
||
|
@@ -640,7 +672,7 @@ ucs_status_t ucp_ep_client_cm_connect_start(ucp_ep_h ucp_ep, | |
return status; | ||
} | ||
|
||
ucp_wireup_ep_set_next_ep(&wireup_ep->super.super, cm_ep); | ||
ucp_wireup_ep_set_next_ep(&wireup_ep->super.super, cm_ep, 1); | ||
ucp_ep_flush_state_reset(ucp_ep); | ||
|
||
return UCS_OK; | ||
|
@@ -966,7 +998,7 @@ ucs_status_t ucp_ep_cm_connect_server_lane(ucp_ep_h ep, | |
return status; | ||
} | ||
|
||
ucp_wireup_ep_set_next_ep(ep->uct_eps[lane], uct_ep); | ||
ucp_wireup_ep_set_next_ep(ep->uct_eps[lane], uct_ep, 1); | ||
return UCS_OK; | ||
} | ||
|
||
|
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.
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 ofucp_cm_ep_dup
?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.
done, added the description
to_ep has to be initialized, so, no need to duplicate it 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.
so in this case here should be 2 iterators and
to_ep
should be reconfigured sinceto_ep
can have some lanes initialized.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.
we have assert that
to_ep
doesn't have UCT_EPs for the lanesThere 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
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.
which is removed?
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.
assert()
doesn't work, since configurations are not equal:After we copy UCT EPs from TMP EP to UCP EP, it will do
init_lanes()
where new config will be selectedThe 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.