4242#endif
4343
4444static
45- spml_ucx_mkey_t * mca_spml_ucx_get_mkey_slow (int pe , void * va , void * * rva );
45+ spml_ucx_mkey_t * mca_spml_ucx_get_mkey_slow (shmem_ctx_t ctx , int pe , void * va , void * * rva );
4646
4747mca_spml_ucx_t mca_spml_ucx = {
4848 .super = {
@@ -306,11 +306,11 @@ int mca_spml_ucx_add_procs(ompi_proc_t** procs, size_t nprocs)
306306
307307
308308static
309- spml_ucx_mkey_t * mca_spml_ucx_get_mkey_slow (int pe , void * va , void * * rva )
309+ spml_ucx_mkey_t * mca_spml_ucx_get_mkey_slow (shmem_ctx_t ctx , int pe , void * va , void * * rva )
310310{
311311 sshmem_mkey_t * r_mkey ;
312312
313- r_mkey = mca_memheap_base_get_cached_mkey (pe , va , 0 , rva );
313+ r_mkey = mca_memheap_base_get_cached_mkey (ctx , pe , va , 0 , rva );
314314 if (OPAL_UNLIKELY (!r_mkey )) {
315315 SPML_UCX_ERROR ("pe=%d: %p is not address of symmetric variable" ,
316316 pe , va );
@@ -348,31 +348,24 @@ void *mca_spml_ucx_rmkey_ptr(const void *dst_addr, sshmem_mkey_t *mkey, int pe)
348348#endif
349349}
350350
351- static void mca_spml_ucx_cache_mkey (mca_spml_ucx_ctx_t * ucx_ctx , sshmem_mkey_t * mkey , uint32_t segno , int dst_pe )
352- {
353- ucp_peer_t * peer ;
354-
355- peer = & (ucx_ctx -> ucp_peers [dst_pe ]);
356- mkey_segment_init (& peer -> mkeys [segno ].super , mkey , segno );
357- }
358-
359- void mca_spml_ucx_rmkey_unpack (sshmem_mkey_t * mkey , uint32_t segno , int pe , int tr_id )
351+ void mca_spml_ucx_rmkey_unpack (shmem_ctx_t ctx , sshmem_mkey_t * mkey , uint32_t segno , int pe , int tr_id )
360352{
361353 spml_ucx_mkey_t * ucx_mkey ;
354+ mca_spml_ucx_ctx_t * ucx_ctx = (mca_spml_ucx_ctx_t * )ctx ;
362355 ucs_status_t err ;
363356
364- ucx_mkey = & mca_spml_ucx_ctx_default . ucp_peers [pe ].mkeys [segno ].key ;
357+ ucx_mkey = & ucx_ctx -> ucp_peers [pe ].mkeys [segno ].key ;
365358
366- err = ucp_ep_rkey_unpack (mca_spml_ucx_ctx_default . ucp_peers [pe ].ucp_conn ,
367- mkey -> u .data ,
359+ err = ucp_ep_rkey_unpack (ucx_ctx -> ucp_peers [pe ].ucp_conn ,
360+ mkey -> u .data ,
368361 & ucx_mkey -> rkey );
369362 if (UCS_OK != err ) {
370363 SPML_UCX_ERROR ("failed to unpack rkey: %s" , ucs_status_string (err ));
371364 goto error_fatal ;
372365 }
373366
374367 mkey -> spml_context = ucx_mkey ;
375- mca_spml_ucx_cache_mkey (& mca_spml_ucx_ctx_default , mkey , segno , pe );
368+ mca_spml_ucx_cache_mkey (ucx_ctx , mkey , segno , pe );
376369 return ;
377370
378371error_fatal :
@@ -633,7 +626,7 @@ int mca_spml_ucx_get(shmem_ctx_t ctx, void *src_addr, size_t size, void *dst_add
633626 ucs_status_t status ;
634627#endif
635628
636- ucx_mkey = mca_spml_ucx_get_mkey (ucx_ctx , src , src_addr , & rva , & mca_spml_ucx );
629+ ucx_mkey = mca_spml_ucx_get_mkey (ctx , src , src_addr , & rva , & mca_spml_ucx );
637630#if HAVE_DECL_UCP_GET_NB
638631 request = ucp_get_nb (ucx_ctx -> ucp_peers [src ].ucp_conn , dst_addr , size ,
639632 (uint64_t )rva , ucx_mkey -> rkey , opal_common_ucx_empty_complete_cb );
@@ -652,7 +645,7 @@ int mca_spml_ucx_get_nb(shmem_ctx_t ctx, void *src_addr, size_t size, void *dst_
652645 spml_ucx_mkey_t * ucx_mkey ;
653646 mca_spml_ucx_ctx_t * ucx_ctx = (mca_spml_ucx_ctx_t * )ctx ;
654647
655- ucx_mkey = mca_spml_ucx_get_mkey (ucx_ctx , src , src_addr , & rva , & mca_spml_ucx );
648+ ucx_mkey = mca_spml_ucx_get_mkey (ctx , src , src_addr , & rva , & mca_spml_ucx );
656649 status = ucp_get_nbi (ucx_ctx -> ucp_peers [src ].ucp_conn , dst_addr , size ,
657650 (uint64_t )rva , ucx_mkey -> rkey );
658651
@@ -670,7 +663,7 @@ int mca_spml_ucx_put(shmem_ctx_t ctx, void* dst_addr, size_t size, void* src_add
670663 ucs_status_t status ;
671664#endif
672665
673- ucx_mkey = mca_spml_ucx_get_mkey (ucx_ctx , dst , dst_addr , & rva , & mca_spml_ucx );
666+ ucx_mkey = mca_spml_ucx_get_mkey (ctx , dst , dst_addr , & rva , & mca_spml_ucx );
674667#if HAVE_DECL_UCP_PUT_NB
675668 request = ucp_put_nb (ucx_ctx -> ucp_peers [dst ].ucp_conn , src_addr , size ,
676669 (uint64_t )rva , ucx_mkey -> rkey , opal_common_ucx_empty_complete_cb );
@@ -689,7 +682,7 @@ int mca_spml_ucx_put_nb(shmem_ctx_t ctx, void* dst_addr, size_t size, void* src_
689682 spml_ucx_mkey_t * ucx_mkey ;
690683 mca_spml_ucx_ctx_t * ucx_ctx = (mca_spml_ucx_ctx_t * )ctx ;
691684
692- ucx_mkey = mca_spml_ucx_get_mkey (ucx_ctx , dst , dst_addr , & rva , & mca_spml_ucx );
685+ ucx_mkey = mca_spml_ucx_get_mkey (ctx , dst , dst_addr , & rva , & mca_spml_ucx );
693686 status = ucp_put_nbi (ucx_ctx -> ucp_peers [dst ].ucp_conn , src_addr , size ,
694687 (uint64_t )rva , ucx_mkey -> rkey );
695688
0 commit comments