Skip to content

Commit e041400

Browse files
xinzhao3Tomislav Janjusic
authored andcommitted
ompi/oshmem/spml/ucx:delete oob path of getting rkeys in spml ucx
Signed-off-by: Tomislav Janjusic <tomislavj@mellanox.com>
1 parent e1c1ab0 commit e041400

File tree

2 files changed

+12
-54
lines changed

2 files changed

+12
-54
lines changed

oshmem/mca/spml/ucx/spml_ucx.c

Lines changed: 11 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@
4141
#define SPML_UCX_PUT_DEBUG 0
4242
#endif
4343

44-
static
45-
spml_ucx_mkey_t * mca_spml_ucx_get_mkey_slow(shmem_ctx_t ctx, int pe, void *va, void **rva);
46-
4744
mca_spml_ucx_t mca_spml_ucx = {
4845
.super = {
4946
/* Init mca_spml_base_module_t */
@@ -77,7 +74,7 @@ mca_spml_ucx_t mca_spml_ucx = {
7774
.num_disconnect = 1,
7875
.heap_reg_nb = 0,
7976
.enabled = 0,
80-
.get_mkey_slow = mca_spml_ucx_get_mkey_slow
77+
.get_mkey_slow = NULL
8178
};
8279

8380
OBJ_CLASS_INSTANCE(mca_spml_ucx_ctx_list_item_t, opal_list_item_t, NULL, NULL);
@@ -310,37 +307,6 @@ int mca_spml_ucx_add_procs(ompi_proc_t** procs, size_t nprocs)
310307

311308
}
312309

313-
314-
static
315-
spml_ucx_mkey_t * mca_spml_ucx_get_mkey_slow(shmem_ctx_t ctx, int pe, void *va, void **rva)
316-
{
317-
sshmem_mkey_t *r_mkey;
318-
spml_ucx_mkey_t *ucx_mkey;
319-
uint32_t segno;
320-
mca_spml_ucx_ctx_t *ucx_ctx = (mca_spml_ucx_ctx_t *)ctx;
321-
ucs_status_t err;
322-
323-
r_mkey = mca_memheap_base_get_cached_mkey(ctx, pe, va, 0, rva);
324-
if (OPAL_UNLIKELY(!r_mkey)) {
325-
SPML_UCX_ERROR("pe=%d: %p is not address of symmetric variable",
326-
pe, va);
327-
oshmem_shmem_abort(-1);
328-
return NULL;
329-
}
330-
331-
segno = memheap_find_segnum(va);
332-
ucx_mkey = &ucx_ctx->ucp_peers[pe].mkeys[segno].key;
333-
334-
if (ucx_mkey->rkey == NULL) {
335-
err = ucp_ep_rkey_unpack(ucx_ctx->ucp_peers[pe].ucp_conn,
336-
r_mkey->u.data,
337-
&ucx_mkey->rkey);
338-
mca_spml_ucx_cache_mkey(ucx_ctx, r_mkey, segno, pe); /* make sure it is properly cached */
339-
}
340-
341-
return ucx_mkey;
342-
}
343-
344310
void mca_spml_ucx_rmkey_free(sshmem_mkey_t *mkey)
345311
{
346312
spml_ucx_mkey_t *ucx_mkey;
@@ -592,24 +558,19 @@ int mca_spml_ucx_ctx_create(long options, shmem_ctx_t *ctx)
592558
}
593559

594560
for (j = 0; j < MCA_MEMHEAP_SEG_COUNT; j++) {
595-
ctx_item->ctx.ucp_peers[i].mkeys[j].key.rkey = NULL;
561+
mkey = &memheap_map->mem_segs[j].mkeys_cache[i][0];
562+
ucx_mkey = &ctx_item->ctx.ucp_peers[i].mkeys[j].key;
563+
err = ucp_ep_rkey_unpack(ctx_item->ctx.ucp_peers[i].ucp_conn,
564+
mkey->u.data,
565+
&ucx_mkey->rkey);
566+
if (UCS_OK != err) {
567+
SPML_UCX_ERROR("failed to unpack rkey");
568+
goto error2;
569+
}
570+
mca_spml_ucx_cache_mkey(&ctx_item->ctx, mkey, j, i);
596571
}
597572
}
598573

599-
for (i = 0; i < MCA_MEMHEAP_SEG_COUNT; i++) {
600-
mkey = &memheap_map->mem_segs[i].mkeys_cache[my_pe][0];
601-
ucx_mkey = &ctx_item->ctx.ucp_peers[my_pe].mkeys[i].key;
602-
err = ucp_ep_rkey_unpack(ctx_item->ctx.ucp_peers[my_pe].ucp_conn,
603-
mkey->u.data,
604-
&ucx_mkey->rkey);
605-
if (UCS_OK != err) {
606-
SPML_UCX_ERROR("failed to unpack rkey");
607-
goto error2;
608-
}
609-
610-
mca_spml_ucx_cache_mkey(&ctx_item->ctx, mkey, i, my_pe);
611-
}
612-
613574
SHMEM_MUTEX_LOCK(mca_spml_ucx.internal_mutex);
614575

615576
opal_list_append(&(mca_spml_ucx.ctx_list), &ctx_item->super);

oshmem/mca/spml/ucx/spml_ucx.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,7 @@ mca_spml_ucx_get_mkey(shmem_ctx_t ctx, int pe, void *va, void **rva, mca_spml_uc
169169

170170
mkey = ucx_ctx->ucp_peers[pe].mkeys;
171171
mkey = (spml_ucx_cached_mkey_t *)map_segment_find_va(&mkey->super.super, sizeof(*mkey), va);
172-
if (OPAL_UNLIKELY(NULL == mkey)) {
173-
assert(module->get_mkey_slow);
174-
return module->get_mkey_slow(ctx, pe, va, rva);
175-
}
172+
assert(mkey != NULL);
176173
*rva = map_segment_va2rva(&mkey->super, va);
177174
return &mkey->key;
178175
}

0 commit comments

Comments
 (0)