Skip to content

Commit 7f26c6c

Browse files
authored
Merge pull request #5401 from hoopoepg/topic/fixed-ucx-abstraction-viola-v3.0
MCA/ATOMICS/UCX: workaround for abstraction violation - v3.0
2 parents f378cfa + 067ccb0 commit 7f26c6c

File tree

5 files changed

+23
-14
lines changed

5 files changed

+23
-14
lines changed

oshmem/mca/atomic/ucx/atomic_ucx_cswap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ int mca_atomic_ucx_cswap(void *target,
3030
spml_ucx_mkey_t *ucx_mkey;
3131
uint64_t rva;
3232

33-
ucx_mkey = mca_spml_ucx_get_mkey(pe, target, (void *)&rva);
33+
ucx_mkey = mca_spml_ucx_get_mkey(pe, target, (void *)&rva, mca_spml_self);
3434
if (NULL == cond) {
3535
switch (nlong) {
3636
case 4:

oshmem/mca/atomic/ucx/atomic_ucx_fadd.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ int mca_atomic_ucx_fadd(void *target,
2929
spml_ucx_mkey_t *ucx_mkey;
3030
uint64_t rva;
3131

32-
ucx_mkey = mca_spml_ucx_get_mkey(pe, target, (void *)&rva);
33-
32+
ucx_mkey = mca_spml_ucx_get_mkey(pe, target, (void *)&rva, mca_spml_self);
3433
if (NULL == prev) {
3534
switch (nlong) {
3635
case 4:

oshmem/mca/spml/ucx/Makefile.am

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ mcacomponentdir = $(ompilibdir)
3434
mcacomponent_LTLIBRARIES = $(component_install)
3535
mca_spml_ucx_la_SOURCES = $(ucx_sources)
3636
mca_spml_ucx_la_LIBADD = $(top_builddir)/oshmem/liboshmem.la \
37-
$(spml_ucx_LIBS)
37+
$(spml_ucx_LIBS) \
38+
$(top_builddir)/oshmem/mca/spml/libmca_spml.la
3839
mca_spml_ucx_la_LDFLAGS = -module -avoid-version $(spml_ucx_LDFLAGS)
3940

4041
noinst_LTLIBRARIES = $(component_noinst)

oshmem/mca/spml/ucx/spml_ucx.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@
4343
#define SPML_UCX_PUT_DEBUG 0
4444
#endif
4545

46+
static
47+
spml_ucx_mkey_t * mca_spml_ucx_get_mkey_slow(int pe, void *va, void **rva);
48+
4649
mca_spml_ucx_t mca_spml_ucx = {
4750
{
4851
/* Init mca_spml_base_module_t */
@@ -73,7 +76,9 @@ mca_spml_ucx_t mca_spml_ucx = {
7376
NULL, /* ucp_peers */
7477
0, /* using_mem_hooks */
7578
1, /* num_disconnect */
76-
0 /* heap_reg_nb */
79+
0, /* heap_reg_nb */
80+
0, /* enabled */
81+
mca_spml_ucx_get_mkey_slow
7782
};
7883

7984
int mca_spml_ucx_enable(bool enable)
@@ -328,6 +333,7 @@ int mca_spml_ucx_add_procs(ompi_proc_t** procs, size_t nprocs)
328333
}
329334

330335

336+
static
331337
spml_ucx_mkey_t * mca_spml_ucx_get_mkey_slow(int pe, void *va, void **rva)
332338
{
333339
sshmem_mkey_t *r_mkey;
@@ -530,7 +536,7 @@ int mca_spml_ucx_get(void *src_addr, size_t size, void *dst_addr, int src)
530536
ucs_status_t status;
531537
spml_ucx_mkey_t *ucx_mkey;
532538

533-
ucx_mkey = mca_spml_ucx_get_mkey(src, src_addr, &rva);
539+
ucx_mkey = mca_spml_ucx_get_mkey(src, src_addr, &rva, &mca_spml_ucx);
534540
status = ucp_get(mca_spml_ucx.ucp_peers[src].ucp_conn, dst_addr, size,
535541
(uint64_t)rva, ucx_mkey->rkey);
536542

@@ -543,7 +549,7 @@ int mca_spml_ucx_get_nb(void *src_addr, size_t size, void *dst_addr, int src, vo
543549
ucs_status_t status;
544550
spml_ucx_mkey_t *ucx_mkey;
545551

546-
ucx_mkey = mca_spml_ucx_get_mkey(src, src_addr, &rva);
552+
ucx_mkey = mca_spml_ucx_get_mkey(src, src_addr, &rva, &mca_spml_ucx);
547553
status = ucp_get_nbi(mca_spml_ucx.ucp_peers[src].ucp_conn, dst_addr, size,
548554
(uint64_t)rva, ucx_mkey->rkey);
549555

@@ -556,7 +562,7 @@ int mca_spml_ucx_put(void* dst_addr, size_t size, void* src_addr, int dst)
556562
ucs_status_t status;
557563
spml_ucx_mkey_t *ucx_mkey;
558564

559-
ucx_mkey = mca_spml_ucx_get_mkey(dst, dst_addr, &rva);
565+
ucx_mkey = mca_spml_ucx_get_mkey(dst, dst_addr, &rva, &mca_spml_ucx);
560566
status = ucp_put(mca_spml_ucx.ucp_peers[dst].ucp_conn, src_addr, size,
561567
(uint64_t)rva, ucx_mkey->rkey);
562568

@@ -569,7 +575,7 @@ int mca_spml_ucx_put_nb(void* dst_addr, size_t size, void* src_addr, int dst, vo
569575
ucs_status_t status;
570576
spml_ucx_mkey_t *ucx_mkey;
571577

572-
ucx_mkey = mca_spml_ucx_get_mkey(dst, dst_addr, &rva);
578+
ucx_mkey = mca_spml_ucx_get_mkey(dst, dst_addr, &rva, &mca_spml_ucx);
573579
status = ucp_put_nbi(mca_spml_ucx.ucp_peers[dst].ucp_conn, src_addr, size,
574580
(uint64_t)rva, ucx_mkey->rkey);
575581

oshmem/mca/spml/ucx/spml_ucx.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ struct ucp_peer {
5858
};
5959
typedef struct ucp_peer ucp_peer_t;
6060

61+
typedef spml_ucx_mkey_t * (*mca_spml_ucx_get_mkey_slow_fn_t)(int pe, void *va, void **rva);
62+
6163
struct mca_spml_ucx {
6264
mca_spml_base_module_t super;
6365
ucp_context_h ucp_context;
@@ -68,6 +70,8 @@ struct mca_spml_ucx {
6870

6971
int priority; /* component priority */
7072
bool enabled;
73+
74+
mca_spml_ucx_get_mkey_slow_fn_t get_mkey_slow;
7175
};
7276
typedef struct mca_spml_ucx mca_spml_ucx_t;
7377

@@ -120,17 +124,16 @@ extern int mca_spml_ucx_quiet(void);
120124
extern int spml_ucx_progress(void);
121125

122126

123-
spml_ucx_mkey_t * mca_spml_ucx_get_mkey_slow(int pe, void *va, void **rva);
124-
125127
static inline spml_ucx_mkey_t *
126-
mca_spml_ucx_get_mkey(int pe, void *va, void **rva)
128+
mca_spml_ucx_get_mkey(int pe, void *va, void **rva, mca_spml_ucx_t* module)
127129
{
128130
spml_ucx_cached_mkey_t *mkey;
129131

130-
mkey = mca_spml_ucx.ucp_peers[pe].mkeys;
132+
mkey = module->ucp_peers[pe].mkeys;
131133
mkey = (spml_ucx_cached_mkey_t *)map_segment_find_va(&mkey->super.super, sizeof(*mkey), va);
132134
if (OPAL_UNLIKELY(NULL == mkey)) {
133-
return mca_spml_ucx_get_mkey_slow(pe, va, rva);
135+
assert(module->get_mkey_slow);
136+
return module->get_mkey_slow(pe, va, rva);
134137
}
135138
*rva = map_segment_va2rva(&mkey->super, va);
136139
return &mkey->key;

0 commit comments

Comments
 (0)