diff --git a/src/mpid/ch4/src/ch4r_callbacks.c b/src/mpid/ch4/src/ch4r_callbacks.c index 2c7cdd8c4a9..89d5925907c 100644 --- a/src/mpid/ch4/src/ch4r_callbacks.c +++ b/src/mpid/ch4/src/ch4r_callbacks.c @@ -381,7 +381,7 @@ int MPIDIG_send_target_msg_cb(int handler_id, void *am_hdr, void **data, size_t /* MPIDI_CS_ENTER(); */ while (TRUE) { rreq = MPIDIG_dequeue_posted(hdr->src_rank, hdr->tag, hdr->context_id, - &MPIDIG_COMM(root_comm, posted_list)); + is_local, &MPIDIG_COMM(root_comm, posted_list)); #ifndef MPIDI_CH4_DIRECT_NETMOD if (rreq) { int is_cancelled; @@ -488,7 +488,7 @@ int MPIDIG_send_long_req_target_msg_cb(int handler_id, void *am_hdr, void **data /* MPIDI_CS_ENTER(); */ while (TRUE) { rreq = MPIDIG_dequeue_posted(hdr->src_rank, hdr->tag, hdr->context_id, - &MPIDIG_COMM(root_comm, posted_list)); + is_local, &MPIDIG_COMM(root_comm, posted_list)); #ifndef MPIDI_CH4_DIRECT_NETMOD if (rreq) { int is_cancelled; diff --git a/src/mpid/ch4/src/ch4r_recvq.h b/src/mpid/ch4/src/ch4r_recvq.h index b383112f7dc..2c3dce4898b 100644 --- a/src/mpid/ch4/src/ch4r_recvq.h +++ b/src/mpid/ch4/src/ch4r_recvq.h @@ -148,7 +148,7 @@ MPL_STATIC_INLINE_PREFIX MPIR_Request *MPIDIG_find_unexp(int rank, int tag, MPL_STATIC_INLINE_PREFIX MPIR_Request *MPIDIG_dequeue_posted(int rank, int tag, MPIR_Context_id_t context_id, - MPIDIG_rreq_t ** list) + int is_local, MPIDIG_rreq_t ** list) { MPIR_Request *req = NULL; MPIDIG_rreq_t *curr, *tmp; @@ -158,13 +158,18 @@ MPL_STATIC_INLINE_PREFIX MPIR_Request *MPIDIG_dequeue_posted(int rank, int tag, MPIR_T_PVAR_TIMER_START(RECVQ, time_failed_matching_postedq); DL_FOREACH_SAFE(*list, curr, tmp) { MPIR_T_PVAR_COUNTER_INC(RECVQ, posted_recvq_match_attempts, 1); - req = curr->request; - if (MPIDIG_match_posted(rank, tag, context_id, req)) { +#ifndef MPIDI_CH4_DIRECT_NETMOD + /* NOTE: extra negation to force logical comparisons */ + if (!MPIDI_REQUEST(curr->request, is_local) != !is_local) { + continue; + } +#endif + if (MPIDIG_match_posted(rank, tag, context_id, curr->request)) { + req = curr->request; DL_DELETE(*list, curr); MPIR_T_PVAR_LEVEL_DEC(RECVQ, posted_recvq_length, 1); break; } - req = NULL; } if (!req) MPIR_T_PVAR_TIMER_END(RECVQ, time_failed_matching_postedq); @@ -305,7 +310,7 @@ MPL_STATIC_INLINE_PREFIX MPIR_Request *MPIDIG_find_unexp(int rank, int tag, MPL_STATIC_INLINE_PREFIX MPIR_Request *MPIDIG_dequeue_posted(int rank, int tag, MPIR_Context_id_t context_id, - MPIDIG_rreq_t ** list) + int is_local, MPIDIG_rreq_t ** list) { MPIR_Request *req = NULL; MPIDIG_rreq_t *curr, *tmp;