@@ -1139,21 +1139,28 @@ int ompi_osc_ucx_rput(const void *origin_addr, int origin_count,
11391139 return ret ;
11401140 }
11411141
1142- ret = opal_common_ucx_wpmem_fence (mem );
1143- if (ret != OMPI_SUCCESS ) {
1144- OSC_UCX_VERBOSE (1 , "opal_common_ucx_mem_fence failed: %d" , ret );
1145- return OMPI_ERROR ;
1146- }
1147-
11481142 mca_osc_ucx_component .num_incomplete_req_ops ++ ;
1149- /* TODO: investigate whether ucp_worker_flush_nb is a better choice here */
1150- ret = opal_common_ucx_wpmem_fetch_nb (module -> state_mem , UCP_ATOMIC_FETCH_OP_FADD ,
1151- 0 , target , & (module -> req_result ),
1152- sizeof (uint64_t ), remote_addr & (~0x7 ),
1153- req_completion , ucx_req );
1143+ ret = opal_common_ucx_wpmem_flush_ep_nb (mem , target , req_completion , ucx_req );
1144+
11541145 if (ret != OMPI_SUCCESS ) {
11551146 OMPI_OSC_UCX_REQUEST_RETURN (ucx_req );
11561147 return ret ;
1148+
1149+ /* fallback to using an atomic op to acquire a request handle */
1150+ ret = opal_common_ucx_wpmem_fence (mem );
1151+ if (ret != OMPI_SUCCESS ) {
1152+ OSC_UCX_VERBOSE (1 , "opal_common_ucx_mem_fence failed: %d" , ret );
1153+ return OMPI_ERROR ;
1154+ }
1155+
1156+ ret = opal_common_ucx_wpmem_fetch_nb (mem , UCP_ATOMIC_FETCH_OP_FADD ,
1157+ 0 , target , & (module -> req_result ),
1158+ sizeof (uint64_t ), remote_addr & (~0x7 ),
1159+ req_completion , ucx_req );
1160+ if (ret != OMPI_SUCCESS ) {
1161+ OMPI_OSC_UCX_REQUEST_RETURN (ucx_req );
1162+ return ret ;
1163+ }
11571164 }
11581165
11591166 * request = & ucx_req -> super ;
@@ -1194,21 +1201,28 @@ int ompi_osc_ucx_rget(void *origin_addr, int origin_count,
11941201 return ret ;
11951202 }
11961203
1197- ret = opal_common_ucx_wpmem_fence (mem );
1198- if (ret != OMPI_SUCCESS ) {
1199- OSC_UCX_VERBOSE (1 , "opal_common_ucx_mem_fence failed: %d" , ret );
1200- return OMPI_ERROR ;
1201- }
1202-
12031204 mca_osc_ucx_component .num_incomplete_req_ops ++ ;
1204- /* TODO: investigate whether ucp_worker_flush_nb is a better choice here */
1205- ret = opal_common_ucx_wpmem_fetch_nb (module -> state_mem , UCP_ATOMIC_FETCH_OP_FADD ,
1206- 0 , target , & (module -> req_result ),
1207- sizeof (uint64_t ), remote_addr & (~0x7 ),
1208- req_completion , ucx_req );
1205+ ret = opal_common_ucx_wpmem_flush_ep_nb (mem , target , req_completion , ucx_req );
1206+
12091207 if (ret != OMPI_SUCCESS ) {
12101208 OMPI_OSC_UCX_REQUEST_RETURN (ucx_req );
12111209 return ret ;
1210+
1211+ /* fallback to using an atomic op to acquire a request handle */
1212+ ret = opal_common_ucx_wpmem_fence (mem );
1213+ if (ret != OMPI_SUCCESS ) {
1214+ OSC_UCX_VERBOSE (1 , "opal_common_ucx_mem_fence failed: %d" , ret );
1215+ return OMPI_ERROR ;
1216+ }
1217+
1218+ ret = opal_common_ucx_wpmem_fetch_nb (mem , UCP_ATOMIC_FETCH_OP_FADD ,
1219+ 0 , target , & (module -> req_result ),
1220+ sizeof (uint64_t ), remote_addr & (~0x7 ),
1221+ req_completion , ucx_req );
1222+ if (ret != OMPI_SUCCESS ) {
1223+ OMPI_OSC_UCX_REQUEST_RETURN (ucx_req );
1224+ return ret ;
1225+ }
12121226 }
12131227
12141228 * request = & ucx_req -> super ;
0 commit comments