Skip to content

Commit d51426f

Browse files
author
Sergey Oblomov
committed
ATOMIC/MXM: fixed abstraction violation
- applied workaround for incorrect dynamic module dependency Signed-off-by: Sergey Oblomov <sergeyo@mellanox.com>
1 parent 9d3a799 commit d51426f

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
@@ -101,7 +101,7 @@ static inline void mca_atomic_mxm_req_init(mxm_send_req_t *sreq, int pe, void *t
101101

102102
nlong_order = mca_atomic_mxm_order(nlong);
103103

104-
mkey = mca_spml_ikrit_get_mkey(pe, target, MXM_PTL_RDMA, &remote_addr);
104+
mkey = mca_spml_ikrit_get_mkey(pe, target, MXM_PTL_RDMA, &remote_addr, mca_atomic_mxm_spml_self);
105105

106106
/* mxm request init */
107107
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 */
@@ -176,7 +178,8 @@ mca_spml_ikrit_t mca_spml_ikrit = {
176178
mca_spml_base_memuse_hook,
177179

178180
(void*)&mca_spml_ikrit
179-
}
181+
},
182+
mca_spml_ikrit_get_mkey_slow
180183
};
181184

182185
static void mca_spml_ikrit_cache_mkeys(sshmem_mkey_t *mkey, uint32_t seg, int dst_pe, int tr_id)
@@ -197,6 +200,7 @@ static void mca_spml_ikrit_cache_mkeys(sshmem_mkey_t *mkey, uint32_t seg, int ds
197200
}
198201
}
199202

203+
static
200204
mxm_mem_key_t *mca_spml_ikrit_get_mkey_slow(int pe, void *va, int ptl_id, void **rva)
201205
{
202206
sshmem_mkey_t *mkey;
@@ -578,7 +582,7 @@ static inline int mca_spml_ikrit_get_helper(mxm_send_req_t *sreq,
578582
void *rva;
579583
mxm_mem_key_t *mkey;
580584

581-
mkey = mca_spml_ikrit_get_mkey(src, src_addr, MXM_PTL_RDMA, &rva);
585+
mkey = mca_spml_ikrit_get_mkey(src, src_addr, MXM_PTL_RDMA, &rva, &mca_spml_ikrit);
582586

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

616-
if (NULL != mca_spml_ikrit_get_mkey(src, src_addr, MXM_PTL_SHM, &rva))
620+
if (NULL != mca_spml_ikrit_get_mkey(src, src_addr, MXM_PTL_SHM, &rva, &mca_spml_ikrit))
617621
return OSHMEM_ERROR;
618622

619623
SPML_VERBOSE_FASTPATH(100,
@@ -798,7 +802,7 @@ static inline int mca_spml_ikrit_put_internal(void* dst_addr,
798802
}
799803

800804
ptl_id = get_ptl_id(dst);
801-
mkey = mca_spml_ikrit_get_mkey(dst, dst_addr, ptl_id, &rva);
805+
mkey = mca_spml_ikrit_get_mkey(dst, dst_addr, ptl_id, &rva, &mca_spml_ikrit);
802806

803807
if (OPAL_UNLIKELY(NULL == mkey)) {
804808
memcpy((void *) (unsigned long) rva, src_addr, size);
@@ -885,7 +889,7 @@ int mca_spml_ikrit_put_simple(void* dst_addr,
885889
static int count;
886890

887891
ptl_id = get_ptl_id(dst);
888-
mkey = mca_spml_ikrit_get_mkey(dst, dst_addr, ptl_id, &rva);
892+
mkey = mca_spml_ikrit_get_mkey(dst, dst_addr, ptl_id, &rva, &mca_spml_ikrit);
889893

890894
SPML_VERBOSE_FASTPATH(100, "put: pe:%d ptl=%d dst=%p <- src: %p sz=%d. dst_rva=%p, %s",
891895
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)