Skip to content

Commit 5e5f6e6

Browse files
author
Sergey Oblomov
committed
ATOMIC/MXM: fixed abstraction violation
- applied workaround for incorrect dynamic module dependency Signed-off-by: Sergey Oblomov <[email protected]> (cherry picked from commit d51426f)
1 parent b023448 commit 5e5f6e6

File tree

4 files changed

+22
-13
lines changed

4 files changed

+22
-13
lines changed

oshmem/mca/atomic/mxm/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ mcacomponentdir = $(oshmemlibdir)
3535
mcacomponent_LTLIBRARIES = $(component_install)
3636
mca_atomic_mxm_la_SOURCES = $(mxm_sources)
3737
mca_atomic_mxm_la_LIBADD = $(top_builddir)/oshmem/liboshmem.la \
38-
$(atomic_mxm_LIBS)
38+
$(atomic_mxm_LIBS) $(top_builddir)/oshmem/mca/spml/libmca_spml.la
3939
mca_atomic_mxm_la_LDFLAGS = -module -avoid-version $(atomic_mxm_LDFLAGS)
4040

4141
noinst_LTLIBRARIES = $(component_noinst)

oshmem/mca/atomic/mxm/atomic_mxm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ static inline void mca_atomic_mxm_req_init(mxm_send_req_t *sreq, int pe, void *t
9393

9494
nlong_order = mca_atomic_mxm_order(nlong);
9595

96-
mkey = mca_spml_ikrit_get_mkey(pe, target, MXM_PTL_RDMA, &remote_addr);
96+
mkey = mca_spml_ikrit_get_mkey(pe, target, MXM_PTL_RDMA, &remote_addr, mca_atomic_mxm_spml_self);
9797

9898
/* mxm request init */
9999
sreq->base.state = MXM_REQ_NEW;

oshmem/mca/spml/ikrit/spml_ikrit.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ int mca_spml_ikrit_put_simple(void* dst_addr,
151151

152152
static void mca_spml_ikrit_cache_mkeys(sshmem_mkey_t *, uint32_t seg, int remote_pe, int tr_id);
153153

154+
static mxm_mem_key_t *mca_spml_ikrit_get_mkey_slow(int pe, void *va, int ptl_id, void **rva);
155+
154156
mca_spml_ikrit_t mca_spml_ikrit = {
155157
{
156158
/* Init mca_spml_base_module_t */
@@ -175,7 +177,8 @@ mca_spml_ikrit_t mca_spml_ikrit = {
175177
mca_spml_base_memuse_hook,
176178

177179
(void*)&mca_spml_ikrit
178-
}
180+
},
181+
mca_spml_ikrit_get_mkey_slow
179182
};
180183

181184
static void mca_spml_ikrit_cache_mkeys(sshmem_mkey_t *mkey, uint32_t seg, int dst_pe, int tr_id)
@@ -196,6 +199,7 @@ static void mca_spml_ikrit_cache_mkeys(sshmem_mkey_t *mkey, uint32_t seg, int ds
196199
}
197200
}
198201

202+
static
199203
mxm_mem_key_t *mca_spml_ikrit_get_mkey_slow(int pe, void *va, int ptl_id, void **rva)
200204
{
201205
sshmem_mkey_t *mkey;
@@ -577,7 +581,7 @@ static inline int mca_spml_ikrit_get_helper(mxm_send_req_t *sreq,
577581
void *rva;
578582
mxm_mem_key_t *mkey;
579583

580-
mkey = mca_spml_ikrit_get_mkey(src, src_addr, MXM_PTL_RDMA, &rva);
584+
mkey = mca_spml_ikrit_get_mkey(src, src_addr, MXM_PTL_RDMA, &rva, &mca_spml_ikrit);
581585

582586
SPML_VERBOSE_FASTPATH(100,
583587
"get: pe:%d ptl=%d src=%p -> dst: %p sz=%d. src_rva=%p",
@@ -612,7 +616,7 @@ static inline int mca_spml_ikrit_get_shm(void *src_addr,
612616
if (ptl_id != MXM_PTL_SHM)
613617
return OSHMEM_ERROR;
614618

615-
if (NULL != mca_spml_ikrit_get_mkey(src, src_addr, MXM_PTL_SHM, &rva))
619+
if (NULL != mca_spml_ikrit_get_mkey(src, src_addr, MXM_PTL_SHM, &rva, &mca_spml_ikrit))
616620
return OSHMEM_ERROR;
617621

618622
SPML_VERBOSE_FASTPATH(100,
@@ -797,7 +801,7 @@ static inline int mca_spml_ikrit_put_internal(void* dst_addr,
797801
}
798802

799803
ptl_id = get_ptl_id(dst);
800-
mkey = mca_spml_ikrit_get_mkey(dst, dst_addr, ptl_id, &rva);
804+
mkey = mca_spml_ikrit_get_mkey(dst, dst_addr, ptl_id, &rva, &mca_spml_ikrit);
801805

802806
if (OPAL_UNLIKELY(NULL == mkey)) {
803807
memcpy((void *) (unsigned long) rva, src_addr, size);
@@ -884,7 +888,7 @@ int mca_spml_ikrit_put_simple(void* dst_addr,
884888
static int count;
885889

886890
ptl_id = get_ptl_id(dst);
887-
mkey = mca_spml_ikrit_get_mkey(dst, dst_addr, ptl_id, &rva);
891+
mkey = mca_spml_ikrit_get_mkey(dst, dst_addr, ptl_id, &rva, &mca_spml_ikrit);
888892

889893
SPML_VERBOSE_FASTPATH(100, "put: pe:%d ptl=%d dst=%p <- src: %p sz=%d. dst_rva=%p, %s",
890894
dst, ptl_id, dst_addr, src_addr, (int)size, (void *)rva);

oshmem/mca/spml/ikrit/spml_ikrit.h

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,13 @@ struct mxm_peer {
8181

8282
typedef struct mxm_peer mxm_peer_t;
8383

84+
typedef mxm_mem_key_t *(*mca_spml_ikrit_get_mkey_slow_fn_t)(int pe, void *va, int ptl_id, void **rva);
85+
8486
struct mca_spml_ikrit_t {
8587
mca_spml_base_module_t super;
8688

89+
mca_spml_ikrit_get_mkey_slow_fn_t get_mkey_slow;
90+
8791
mxm_context_opts_t *mxm_ctx_opts;
8892
mxm_ep_opts_t *mxm_ep_opts;
8993
mxm_ep_opts_t *mxm_ep_hw_rdma_opts;
@@ -173,25 +177,26 @@ extern int mca_spml_ikrit_del_procs(ompi_proc_t** procs, size_t nprocs);
173177
extern int mca_spml_ikrit_fence(void);
174178
extern int spml_ikrit_progress(void);
175179

176-
mxm_mem_key_t *mca_spml_ikrit_get_mkey_slow(int pe, void *va, int ptl_id, void **rva);
177-
178180
/* the functionreturns NULL if data can be directly copied via shared memory
179181
* else it returns mxm mem key
180182
*
181183
* the function will abort() if va is not symmetric var address.
182184
*/
183-
static inline mxm_mem_key_t *mca_spml_ikrit_get_mkey(int pe, void *va, int ptl_id, void **rva)
185+
static inline mxm_mem_key_t *mca_spml_ikrit_get_mkey(int pe, void *va, int ptl_id, void **rva,
186+
mca_spml_ikrit_t *module)
184187
{
185188
spml_ikrit_mkey_t *mkey;
186189

187190
if (OPAL_UNLIKELY(MXM_PTL_RDMA != ptl_id)) {
188-
return mca_spml_ikrit_get_mkey_slow(pe, va, ptl_id, rva);
191+
assert(module->get_mkey_slow);
192+
return module->get_mkey_slow(pe, va, ptl_id, rva);
189193
}
190194

191-
mkey = mca_spml_ikrit.mxm_peers[pe].mkeys;
195+
mkey = module->mxm_peers[pe].mkeys;
192196
mkey = (spml_ikrit_mkey_t *)map_segment_find_va(&mkey->super.super, sizeof(*mkey), va);
193197
if (OPAL_UNLIKELY(NULL == mkey)) {
194-
return mca_spml_ikrit_get_mkey_slow(pe, va, ptl_id, rva);
198+
assert(module->get_mkey_slow);
199+
return module->get_mkey_slow(pe, va, ptl_id, rva);
195200
}
196201
*rva = map_segment_va2rva(&mkey->super, va);
197202
return &mkey->key;

0 commit comments

Comments
 (0)