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/WIREUP: Support EP reconfiguration for non wired-up scenarios #10337

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 29 additions & 30 deletions src/ucp/core/ucp_ep.c
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,7 @@ ucp_ep_create_to_worker_addr(ucp_worker_h worker,
ucp_tl_bitmap_t ep_tl_bitmap;
ucs_status_t status;
ucp_ep_h ep;
int is_am_replaced;

/* allocate endpoint */
status = ucp_ep_create_base(worker, ep_init_flags, remote_address->name,
Expand All @@ -836,7 +837,8 @@ ucp_ep_create_to_worker_addr(ucp_worker_h worker,

/* initialize transport endpoints */
status = ucp_wireup_init_lanes(ep, ep_init_flags, local_tl_bitmap,
remote_address, addr_indices);
remote_address, addr_indices,
&is_am_replaced);
if (status != UCS_OK) {
goto err_delete;
}
Expand Down Expand Up @@ -1859,40 +1861,39 @@ int ucp_ep_config_lane_is_peer_match(const ucp_ep_config_key_t *key1,
config_lane2->dst_md_index);
}

static ucp_lane_index_t
ucp_ep_config_find_match_lane(const ucp_ep_config_key_t *key1,
ucp_lane_index_t lane1,
const ucp_ep_config_key_t *key2)
ucp_lane_index_t
ucp_ep_config_find_match_lane(const ucp_ep_config_key_t *old_key,
const ucp_ep_config_key_t *new_key,
ucp_lane_index_t old_lane)
{
ucp_lane_index_t lane_idx;
ucp_lane_index_t new_lane;

for (lane_idx = 0; lane_idx < key2->num_lanes; ++lane_idx) {
if (ucp_ep_config_lane_is_peer_match(key1, lane1, key2, lane_idx)) {
return lane_idx;
for (new_lane = 0; new_lane < new_key->num_lanes; ++new_lane) {
if (ucp_ep_config_lane_is_peer_match(old_key, old_lane, new_key,
new_lane)) {
return new_lane;
}
}

return UCP_NULL_LANE;
}

static ucp_lane_index_t
ucp_ep_config_find_reusable_lane(const ucp_ep_config_key_t *key1,
const ucp_ep_config_key_t *key2, ucp_ep_h ep,
const ucp_unpacked_address_t *remote_address,
const unsigned *addr_indices,
ucp_lane_index_t old_lane)
static ucp_lane_index_t ucp_ep_config_find_reusable_lane(
const ucp_ep_config_key_t *old_key, const ucp_ep_config_key_t *new_key,
ucp_ep_h ep, const ucp_unpacked_address_t *remote_address,
const unsigned *addr_indices, ucp_lane_index_t old_lane)
{
ucp_context_h context = ep->worker->context;
ucp_rsc_index_t rsc_index = key1->lanes[old_lane].rsc_index;
ucp_rsc_index_t rsc_index = old_key->lanes[old_lane].rsc_index;
ucp_lane_index_t new_lane;
unsigned addr_index;
const ucp_address_entry_t *ae;

if (old_lane == key1->cm_lane) {
return key2->cm_lane;
if (old_lane == old_key->cm_lane) {
return new_key->cm_lane;
}

new_lane = ucp_ep_config_find_match_lane(key1, old_lane, key2);
new_lane = ucp_ep_config_find_match_lane(old_key, new_key, old_lane);
if (new_lane == UCP_NULL_LANE) {
/* No matching lane was found */
return UCP_NULL_LANE;
Expand All @@ -1919,26 +1920,24 @@ ucp_ep_config_find_reusable_lane(const ucp_ep_config_key_t *key1,

/* Go through the first configuration and check if the lanes selected
* for this configuration could be used for the second configuration */
void ucp_ep_config_lanes_intersect(const ucp_ep_config_key_t *key1,
const ucp_ep_config_key_t *key2,
void ucp_ep_config_lanes_intersect(const ucp_ep_config_key_t *old_key,
const ucp_ep_config_key_t *new_key,
const ucp_ep_h ep,
const ucp_unpacked_address_t *remote_address,
const unsigned *addr_indices,
ucp_lane_index_t *lane_map)
{
ucp_lane_index_t lane1_idx;
ucp_lane_index_t old_lane;

for (lane1_idx = 0; lane1_idx < key1->num_lanes; ++lane1_idx) {
lane_map[lane1_idx] = ucp_ep_config_find_reusable_lane(key1, key2, ep,
remote_address,
addr_indices,
lane1_idx);
for (old_lane = 0; old_lane < old_key->num_lanes; ++old_lane) {
lane_map[old_lane] = ucp_ep_config_find_reusable_lane(
old_key, new_key, ep, remote_address, addr_indices, old_lane);
}
}

static int ucp_ep_config_lane_is_equal(const ucp_ep_config_key_t *key1,
const ucp_ep_config_key_t *key2,
ucp_lane_index_t lane)
int ucp_ep_config_lane_is_equal(const ucp_ep_config_key_t *key1,
const ucp_ep_config_key_t *key2,
ucp_lane_index_t lane)
{
const ucp_ep_config_key_lane_t *config_lane1 = &key1->lanes[lane];
const ucp_ep_config_key_lane_t *config_lane2 = &key2->lanes[lane];
Expand Down
13 changes: 11 additions & 2 deletions src/ucp/core/ucp_ep.h
Original file line number Diff line number Diff line change
Expand Up @@ -749,13 +749,22 @@ int ucp_ep_config_lane_is_peer_match(const ucp_ep_config_key_t *key1,
const ucp_ep_config_key_t *key2,
ucp_lane_index_t lane2);

void ucp_ep_config_lanes_intersect(const ucp_ep_config_key_t *key1,
const ucp_ep_config_key_t *key2,
ucp_lane_index_t
ucp_ep_config_find_match_lane(const ucp_ep_config_key_t *old_key,
const ucp_ep_config_key_t *new_key,
ucp_lane_index_t old_lane);

void ucp_ep_config_lanes_intersect(const ucp_ep_config_key_t *old_key,
const ucp_ep_config_key_t *new_key,
const ucp_ep_h ep,
const ucp_unpacked_address_t *remote_address,
const unsigned *addr_indices,
ucp_lane_index_t *lane_map);

int ucp_ep_config_lane_is_equal(const ucp_ep_config_key_t *key1,
const ucp_ep_config_key_t *key2,
ucp_lane_index_t lane);

int ucp_ep_config_is_equal(const ucp_ep_config_key_t *key1,
const ucp_ep_config_key_t *key2);

Expand Down
Loading
Loading