diff --git a/src/mpid/ch4/include/mpidpost.h b/src/mpid/ch4/include/mpidpost.h index 0776e979d9e..af4dd7ba0fe 100644 --- a/src/mpid/ch4/include/mpidpost.h +++ b/src/mpid/ch4/include/mpidpost.h @@ -28,6 +28,7 @@ MPL_STATIC_INLINE_PREFIX void MPID_Request_create_hook(MPIR_Request * req) req->dev.type = MPIDI_REQ_TYPE_NONE; #ifndef MPIDI_CH4_DIRECT_NETMOD req->dev.anysrc_partner = NULL; + req->dev.is_local = 0; #endif MPIR_FUNC_EXIT; diff --git a/src/mpid/ch4/shm/ipc/src/ipc_p2p.h b/src/mpid/ch4/shm/ipc/src/ipc_p2p.h index 299e9ee39b2..a7d52e3f5e9 100644 --- a/src/mpid/ch4/shm/ipc/src/ipc_p2p.h +++ b/src/mpid/ch4/shm/ipc/src/ipc_p2p.h @@ -203,6 +203,7 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_IPCI_send_lmt(const void *buf, MPI_Aint count MPIDIG_REQUEST(sreq, u.ipc.peer_rank) = rank; MPIDIG_REQUEST(sreq, u.ipc.peer_req) = NULL; MPIDIG_REQUEST(sreq, u.ipc.src_dt_ptr) = NULL; + MPIDI_REQUEST_SET_LOCAL(sreq, 1, NULL); MPIDI_SHM_REQUEST(sreq, ipc.ipc_type) = ipc_attr->ipc_type; /* Allocate am_hdr and fill ipc_hdr */ diff --git a/src/mpid/ch4/src/ch4_progress.h b/src/mpid/ch4/src/ch4_progress.h index 67a244a23b0..8dee4dd4d46 100644 --- a/src/mpid/ch4/src/ch4_progress.h +++ b/src/mpid/ch4/src/ch4_progress.h @@ -64,8 +64,7 @@ extern MPL_TLS int no_progress_counter; MPL_STATIC_INLINE_PREFIX int MPIDI_do_global_progress(void) { - if ((MPIDI_global.n_vcis == 1 || !MPIR_CVAR_CH4_GLOBAL_PROGRESS) && - !MPIR_CVAR_CH4_PROGRESS_THROTTLE) { + if (!MPIR_CVAR_CH4_GLOBAL_PROGRESS && !MPIR_CVAR_CH4_PROGRESS_THROTTLE) { return 0; } else { global_vci_poll_count++; @@ -88,7 +87,7 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_do_global_progress(void) #ifdef MPIDI_CH4_DIRECT_NETMOD #define MPIDI_PROGRESS(vci, is_global) \ do { \ - if (state->flag & MPIDI_PROGRESS_NM && (is_global || !made_progress)) { \ + if (is_global || (state->flag & MPIDI_PROGRESS_NM && !made_progress)) { \ MPIDI_THREAD_CS_ENTER_VCI_OPTIONAL(vci); \ mpi_errno = MPIDI_NM_progress(vci, &made_progress); \ MPIDI_THREAD_CS_EXIT_VCI_OPTIONAL(vci); \ @@ -99,13 +98,13 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_do_global_progress(void) #else #define MPIDI_PROGRESS(vci, is_global) \ do { \ - if (state->flag & MPIDI_PROGRESS_SHM && (is_global || !made_progress)) { \ + if (is_global || (state->flag & MPIDI_PROGRESS_SHM && !made_progress)) { \ MPID_THREAD_CS_ENTER(VCI, MPIDI_VCI_LOCK(vci)); \ mpi_errno = MPIDI_SHM_progress(vci, &made_progress); \ MPID_THREAD_CS_EXIT(VCI, MPIDI_VCI_LOCK(vci)); \ MPIR_ERR_CHECK(mpi_errno); \ } \ - if (state->flag & MPIDI_PROGRESS_NM && (is_global || !made_progress)) { \ + if (is_global || (state->flag & MPIDI_PROGRESS_NM && !made_progress)) { \ MPIDI_THREAD_CS_ENTER_VCI_OPTIONAL(vci); \ mpi_errno = MPIDI_NM_progress(vci, &made_progress); \ MPIDI_THREAD_CS_EXIT_VCI_OPTIONAL(vci); \ diff --git a/src/mpid/ch4/src/ch4_wait.h b/src/mpid/ch4/src/ch4_wait.h index d6456a26c2b..d46321e4b02 100644 --- a/src/mpid/ch4/src/ch4_wait.h +++ b/src/mpid/ch4/src/ch4_wait.h @@ -11,18 +11,27 @@ MPL_STATIC_INLINE_PREFIX void MPIDI_set_progress_vci(MPIR_Request * req, MPID_Progress_state * state) { - state->flag = MPIDI_PROGRESS_ALL; /* TODO: check request is_local/anysource */ + state->flag = MPIDI_PROGRESS_ALL; int vci = MPIDI_Request_get_vci(req); state->vci_count = 1; state->vci[0] = vci; + +#ifndef MPIDI_CH4_DIRECT_NETMOD + if (!req->dev.anysrc_partner && MPIDI_REQUEST(req, is_local)) { + state->flag &= ~MPIDI_PROGRESS_NM; + } +#endif } MPL_STATIC_INLINE_PREFIX void MPIDI_set_progress_vci_n(int n, MPIR_Request ** reqs, MPID_Progress_state * state) { - state->flag = MPIDI_PROGRESS_ALL; /* TODO: check request is_local/anysource */ + state->flag = MPIDI_PROGRESS_ALL; +#ifndef MPIDI_CH4_DIRECT_NETMOD + state->flag &= ~MPIDI_PROGRESS_NM; +#endif int idx = 0; for (int i = 0; i < n; i++) { @@ -45,6 +54,11 @@ MPL_STATIC_INLINE_PREFIX void MPIDI_set_progress_vci_n(int n, MPIR_Request ** re if (!found) { state->vci[idx++] = vci; } +#ifndef MPIDI_CH4_DIRECT_NETMOD + if (!MPIDI_REQUEST(reqs[i], is_local) || reqs[i]->dev.anysrc_partner) { + state->flag |= MPIDI_PROGRESS_NM; + } +#endif } state->vci_count = idx; }