4545#endif
4646
4747static
48- spml_ucx_mkey_t * mca_spml_ucx_get_mkey_slow (int pe , void * va , void * * rva );
48+ spml_ucx_mkey_t * mca_spml_ucx_get_mkey_slow (shmem_ctx_t ctx , int pe , void * va , void * * rva );
4949
5050mca_spml_ucx_t mca_spml_ucx = {
5151 .super = {
@@ -309,11 +309,11 @@ int mca_spml_ucx_add_procs(ompi_proc_t** procs, size_t nprocs)
309309
310310
311311static
312- spml_ucx_mkey_t * mca_spml_ucx_get_mkey_slow (int pe , void * va , void * * rva )
312+ spml_ucx_mkey_t * mca_spml_ucx_get_mkey_slow (shmem_ctx_t ctx , int pe , void * va , void * * rva )
313313{
314314 sshmem_mkey_t * r_mkey ;
315315
316- r_mkey = mca_memheap_base_get_cached_mkey (pe , va , 0 , rva );
316+ r_mkey = mca_memheap_base_get_cached_mkey (ctx , pe , va , 0 , rva );
317317 if (OPAL_UNLIKELY (!r_mkey )) {
318318 SPML_UCX_ERROR ("pe=%d: %p is not address of symmetric variable" ,
319319 pe , va );
@@ -351,31 +351,24 @@ void *mca_spml_ucx_rmkey_ptr(const void *dst_addr, sshmem_mkey_t *mkey, int pe)
351351#endif
352352}
353353
354- static void mca_spml_ucx_cache_mkey (mca_spml_ucx_ctx_t * ucx_ctx , sshmem_mkey_t * mkey , uint32_t segno , int dst_pe )
355- {
356- ucp_peer_t * peer ;
357-
358- peer = & (ucx_ctx -> ucp_peers [dst_pe ]);
359- mkey_segment_init (& peer -> mkeys [segno ].super , mkey , segno );
360- }
361-
362- void mca_spml_ucx_rmkey_unpack (sshmem_mkey_t * mkey , uint32_t segno , int pe , int tr_id )
354+ void mca_spml_ucx_rmkey_unpack (shmem_ctx_t ctx , sshmem_mkey_t * mkey , uint32_t segno , int pe , int tr_id )
363355{
364356 spml_ucx_mkey_t * ucx_mkey ;
357+ mca_spml_ucx_ctx_t * ucx_ctx = (mca_spml_ucx_ctx_t * )ctx ;
365358 ucs_status_t err ;
366359
367- ucx_mkey = & mca_spml_ucx_ctx_default . ucp_peers [pe ].mkeys [segno ].key ;
360+ ucx_mkey = & ucx_ctx -> ucp_peers [pe ].mkeys [segno ].key ;
368361
369- err = ucp_ep_rkey_unpack (mca_spml_ucx_ctx_default . ucp_peers [pe ].ucp_conn ,
370- mkey -> u .data ,
362+ err = ucp_ep_rkey_unpack (ucx_ctx -> ucp_peers [pe ].ucp_conn ,
363+ mkey -> u .data ,
371364 & ucx_mkey -> rkey );
372365 if (UCS_OK != err ) {
373366 SPML_UCX_ERROR ("failed to unpack rkey: %s" , ucs_status_string (err ));
374367 goto error_fatal ;
375368 }
376369
377370 mkey -> spml_context = ucx_mkey ;
378- mca_spml_ucx_cache_mkey (& mca_spml_ucx_ctx_default , mkey , segno , pe );
371+ mca_spml_ucx_cache_mkey (ucx_ctx , mkey , segno , pe );
379372 return ;
380373
381374error_fatal :
@@ -636,7 +629,7 @@ int mca_spml_ucx_get(shmem_ctx_t ctx, void *src_addr, size_t size, void *dst_add
636629 ucs_status_t status ;
637630#endif
638631
639- ucx_mkey = mca_spml_ucx_get_mkey (ucx_ctx , src , src_addr , & rva , & mca_spml_ucx );
632+ ucx_mkey = mca_spml_ucx_get_mkey (ctx , src , src_addr , & rva , & mca_spml_ucx );
640633#if HAVE_DECL_UCP_GET_NB
641634 request = ucp_get_nb (ucx_ctx -> ucp_peers [src ].ucp_conn , dst_addr , size ,
642635 (uint64_t )rva , ucx_mkey -> rkey , opal_common_ucx_empty_complete_cb );
@@ -655,7 +648,7 @@ int mca_spml_ucx_get_nb(shmem_ctx_t ctx, void *src_addr, size_t size, void *dst_
655648 spml_ucx_mkey_t * ucx_mkey ;
656649 mca_spml_ucx_ctx_t * ucx_ctx = (mca_spml_ucx_ctx_t * )ctx ;
657650
658- ucx_mkey = mca_spml_ucx_get_mkey (ucx_ctx , src , src_addr , & rva , & mca_spml_ucx );
651+ ucx_mkey = mca_spml_ucx_get_mkey (ctx , src , src_addr , & rva , & mca_spml_ucx );
659652 status = ucp_get_nbi (ucx_ctx -> ucp_peers [src ].ucp_conn , dst_addr , size ,
660653 (uint64_t )rva , ucx_mkey -> rkey );
661654
@@ -673,7 +666,7 @@ int mca_spml_ucx_put(shmem_ctx_t ctx, void* dst_addr, size_t size, void* src_add
673666 ucs_status_t status ;
674667#endif
675668
676- ucx_mkey = mca_spml_ucx_get_mkey (ucx_ctx , dst , dst_addr , & rva , & mca_spml_ucx );
669+ ucx_mkey = mca_spml_ucx_get_mkey (ctx , dst , dst_addr , & rva , & mca_spml_ucx );
677670#if HAVE_DECL_UCP_PUT_NB
678671 request = ucp_put_nb (ucx_ctx -> ucp_peers [dst ].ucp_conn , src_addr , size ,
679672 (uint64_t )rva , ucx_mkey -> rkey , opal_common_ucx_empty_complete_cb );
@@ -692,7 +685,7 @@ int mca_spml_ucx_put_nb(shmem_ctx_t ctx, void* dst_addr, size_t size, void* src_
692685 spml_ucx_mkey_t * ucx_mkey ;
693686 mca_spml_ucx_ctx_t * ucx_ctx = (mca_spml_ucx_ctx_t * )ctx ;
694687
695- ucx_mkey = mca_spml_ucx_get_mkey (ucx_ctx , dst , dst_addr , & rva , & mca_spml_ucx );
688+ ucx_mkey = mca_spml_ucx_get_mkey (ctx , dst , dst_addr , & rva , & mca_spml_ucx );
696689 status = ucp_put_nbi (ucx_ctx -> ucp_peers [dst ].ucp_conn , src_addr , size ,
697690 (uint64_t )rva , ucx_mkey -> rkey );
698691
0 commit comments