Skip to content

Commit

Permalink
UCP/WIREUP: Use dst_dev_index instead of dst_md_index
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrygx committed Aug 31, 2020
1 parent cdd175c commit 4e1c626
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 49 deletions.
31 changes: 16 additions & 15 deletions src/ucp/core/ucp_ep.c
Original file line number Diff line number Diff line change
Expand Up @@ -1014,21 +1014,22 @@ void ucp_ep_destroy(ucp_ep_h ep)
return;
}

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 lane1,
ucp_lane_index_t lane2,
int compare_tl_only)
int ucp_ep_config_lane_tl_is_equal(const ucp_ep_config_key_t *key1,
const ucp_ep_config_key_t *key2,
ucp_lane_index_t lane1,
ucp_lane_index_t lane2)
{
return compare_tl_only ?
/* compare only TL configuration indexes */
((key1->lanes[lane1].rsc_index == key2->lanes[lane2].rsc_index) &&
(key1->lanes[lane1].dst_md_index == key2->lanes[lane2].dst_md_index) &&
(key1->lanes[lane1].path_index == key2->lanes[lane2].path_index)) :
/* compare the whole TL lane configurations, i.e. it should be
* the same TLs and they should point to the same proxy lane and
* have the same lane types */
!memcmp(&key1->lanes[lane1], &key2->lanes[lane2],
return (key1->lanes[lane1].rsc_index == key2->lanes[lane2].rsc_index) &&
(key1->lanes[lane1].dst_dev_index == key2->lanes[lane2].dst_dev_index) &&
(key1->lanes[lane1].path_index == key2->lanes[lane2].path_index);
}

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 lane1,
ucp_lane_index_t lane2)
{
return !memcmp(&key1->lanes[lane1], &key2->lanes[lane2],
sizeof(*key1->lanes));
}

Expand Down Expand Up @@ -1058,7 +1059,7 @@ int ucp_ep_config_is_equal(const ucp_ep_config_key_t *key1,
}

for (lane = 0; lane < key1->num_lanes; ++lane) {
if (!ucp_ep_config_lane_is_equal(key1, key2, lane, lane, 0))
if (!ucp_ep_config_lane_is_equal(key1, key2, lane, lane))
{
return 0;
}
Expand Down
38 changes: 19 additions & 19 deletions src/ucp/core/ucp_ep.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,23 +113,24 @@ enum {
*/
struct ucp_ep_config_key {

ucp_lane_index_t num_lanes; /* Number of active lanes */
ucp_lane_index_t num_lanes; /* Number of active lanes */

struct {
ucp_rsc_index_t rsc_index; /* Resource index */
ucp_lane_index_t proxy_lane; /* UCP_NULL_LANE - no proxy
otherwise - in which lane the real
transport endpoint is stored */
ucp_md_index_t dst_md_index; /* Destination memory domain index */
uint8_t path_index; /* Device path index */
ucp_lane_type_mask_t lane_types; /* Which types of operations this lane
was selected for */
ucp_rsc_index_t rsc_index; /* Resource index */
ucp_lane_index_t proxy_lane; /* UCP_NULL_LANE - no proxy
otherwise - in which lane the real
transport endpoint is stored */
ucp_md_index_t dst_md_index; /* Destination memory domain index */
ucp_rsc_index_t dst_dev_index; /* Destination device index */
uint8_t path_index; /* Device path index */
ucp_lane_type_mask_t lane_types; /* Which types of operations this lane
was selected for */
} lanes[UCP_MAX_LANES];

ucp_lane_index_t am_lane; /* Lane for AM (can be NULL) */
ucp_lane_index_t tag_lane; /* Lane for tag matching offload (can be NULL) */
ucp_lane_index_t wireup_lane; /* Lane for wireup messages (can be NULL) */
ucp_lane_index_t cm_lane; /* Lane for holding a CM connection (can be NULL) */
ucp_lane_index_t am_lane; /* Lane for AM (can be NULL) */
ucp_lane_index_t tag_lane; /* Lane for tag matching offload (can be NULL) */
ucp_lane_index_t wireup_lane; /* Lane for wireup messages (can be NULL) */
ucp_lane_index_t cm_lane; /* Lane for holding a CM connection (can be NULL) */

/* Lanes for remote memory access, sorted by priority, highest first */
ucp_lane_index_t rma_lanes[UCP_MAX_LANES];
Expand Down Expand Up @@ -450,7 +451,7 @@ struct ucp_wireup_sockaddr_data {
uint8_t addr_mode; /**< The attached address format
defined by
UCP_WIREUP_SA_DATA_xx */
uint8_t dev_index; /**< Device address index used to
ucp_rsc_index_t dev_index; /**< Device address index used to
build remote address in
UCP_WIREUP_SA_DATA_CM_ADDR
mode */
Expand Down Expand Up @@ -536,11 +537,10 @@ ucs_status_t ucp_ep_config_init(ucp_worker_h worker, ucp_ep_config_t *config,

void ucp_ep_config_cleanup(ucp_worker_h worker, ucp_ep_config_t *config);

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 lane1,
ucp_lane_index_t lane2,
int compare_tl_only);
int ucp_ep_config_lane_tl_is_equal(const ucp_ep_config_key_t *key1,
const ucp_ep_config_key_t *key2,
ucp_lane_index_t lane1,
ucp_lane_index_t lane2);

int ucp_ep_config_is_equal(const ucp_ep_config_key_t *key1,
const ucp_ep_config_key_t *key2);
Expand Down
34 changes: 22 additions & 12 deletions src/ucp/wireup/select.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ typedef struct {
unsigned path_index;
ucp_lane_index_t proxy_lane;
ucp_md_index_t dst_md_index;
ucp_rsc_index_t dst_dev_index;
ucp_lane_type_mask_t lane_types;
double score[UCP_LANE_TYPE_LAST];
} ucp_wireup_lane_desc_t;
Expand Down Expand Up @@ -471,6 +472,7 @@ static inline double ucp_wireup_tl_iface_latency(ucp_context_h context,
static UCS_F_NOINLINE ucs_status_t
ucp_wireup_add_lane_desc(const ucp_wireup_select_info_t *select_info,
ucp_md_index_t dst_md_index,
ucp_rsc_index_t dst_dev_index,
ucp_lane_type_t lane_type, int is_proxy,
ucp_wireup_select_context_t *select_ctx)
{
Expand All @@ -490,9 +492,12 @@ ucp_wireup_add_lane_desc(const ucp_wireup_select_info_t *select_info,
(lane_desc->path_index == select_info->path_index))
{
lane = lane_desc - select_ctx->lane_descs;
ucs_assertv_always(dst_md_index == lane_desc->dst_md_index,
ucs_assertv_always(dst_dev_index == lane_desc->dst_dev_index,
"lane[%d].dst_md_index=%d, dst_md_index=%d",
lane, lane_desc->dst_md_index, dst_md_index);
ucs_assertv_always(dst_md_index == lane_desc->dst_md_index,
"lane[%d].dst_dev_index=%d, dst_dev_index=%d",
lane, lane_desc->dst_dev_index, dst_dev_index);
ucs_assertv_always(!(lane_desc->lane_types & UCS_BIT(lane_type)),
"lane[%d]=0x%x |= 0x%x", lane, lane_desc->lane_types,
lane_type);
Expand Down Expand Up @@ -532,12 +537,13 @@ ucp_wireup_add_lane_desc(const ucp_wireup_select_info_t *select_info,
lane_desc = &select_ctx->lane_descs[select_ctx->num_lanes];
++select_ctx->num_lanes;

lane_desc->rsc_index = select_info->rsc_index;
lane_desc->addr_index = select_info->addr_index;
lane_desc->path_index = select_info->path_index;
lane_desc->proxy_lane = proxy_lane;
lane_desc->dst_md_index = dst_md_index;
lane_desc->lane_types = UCS_BIT(lane_type);
lane_desc->rsc_index = select_info->rsc_index;
lane_desc->addr_index = select_info->addr_index;
lane_desc->path_index = select_info->path_index;
lane_desc->proxy_lane = proxy_lane;
lane_desc->dst_md_index = dst_md_index;
lane_desc->dst_dev_index = dst_dev_index;
lane_desc->lane_types = UCS_BIT(lane_type);
for (lane_type_iter = 0; lane_type_iter < UCP_LANE_TYPE_LAST;
++lane_type_iter) {
lane_desc->score[lane_type_iter] = 0.0;
Expand Down Expand Up @@ -566,6 +572,7 @@ ucp_wireup_add_lane(const ucp_wireup_select_params_t *select_params,
int is_proxy = 0;
ucp_md_index_t dst_md_index;
uint64_t remote_event_flags;
ucp_rsc_index_t dst_dev_index;

if ((lane_type == UCP_LANE_TYPE_AM) || (lane_type == UCP_LANE_TYPE_AM_BW) ||
(lane_type == UCP_LANE_TYPE_TAG)) {
Expand All @@ -580,10 +587,12 @@ ucp_wireup_add_lane(const ucp_wireup_select_params_t *select_params,
remote_event_flags);
}

dst_md_index = select_params->address->address_list
[select_info->addr_index].md_index;
return ucp_wireup_add_lane_desc(select_info, dst_md_index, lane_type,
is_proxy, select_ctx);
dst_md_index = select_params->address->address_list
[select_info->addr_index].md_index;
dst_dev_index = select_params->address->address_list
[select_info->addr_index].dev_index;
return ucp_wireup_add_lane_desc(select_info, dst_md_index, dst_dev_index,
lane_type, is_proxy, select_ctx);
}

static int ucp_wireup_compare_score(const void *elem1, const void *elem2,
Expand Down Expand Up @@ -834,7 +843,8 @@ ucp_wireup_add_cm_lane(const ucp_wireup_select_params_t *select_params,

/* server is not a proxy because it can create all lanes connected */
return ucp_wireup_add_lane_desc(&select_info, UCP_NULL_RESOURCE,
UCP_LANE_TYPE_CM, 0, select_ctx);
UCP_NULL_RESOURCE, UCP_LANE_TYPE_CM,
0, select_ctx);
}

static ucs_status_t
Expand Down
6 changes: 3 additions & 3 deletions src/ucp/wireup/wireup.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,9 @@ ucp_wireup_ep_configs_use_same_lane(ucp_ep_config_key_t *ep_config_key,

for (another_lane = 0; another_lane < another_ep_config_key->num_lanes;
++another_lane) {
if (ucp_ep_config_lane_is_equal(ep_config_key,
another_ep_config_key,
lane, another_lane, 1)) {
if (ucp_ep_config_lane_tl_is_equal(ep_config_key,
another_ep_config_key,
lane, another_lane)) {
return another_lane;
}
}
Expand Down

0 comments on commit 4e1c626

Please sign in to comment.