Commit 9ad72924 authored by Xin Zhao's avatar Xin Zhao Committed by Pavan Balaji
Browse files

Modify message of decrementing AT counter to send back FLUSH if necessary.


Signed-off-by: Pavan Balaji's avatarPavan Balaji <balaji@anl.gov>
parent 638ad778
...@@ -808,6 +808,8 @@ typedef struct MPIDI_CH3_Pkt_flush_ack { ...@@ -808,6 +808,8 @@ typedef struct MPIDI_CH3_Pkt_flush_ack {
typedef struct MPIDI_CH3_Pkt_decr_at_counter { typedef struct MPIDI_CH3_Pkt_decr_at_counter {
MPIDI_CH3_Pkt_type_t type; MPIDI_CH3_Pkt_type_t type;
MPI_Win target_win_handle; MPI_Win target_win_handle;
MPI_Win source_win_handle;
MPIDI_CH3_Pkt_flags_t flags;
} MPIDI_CH3_Pkt_decr_at_counter_t; } MPIDI_CH3_Pkt_decr_at_counter_t;
typedef struct MPIDI_CH3_Pkt_close { typedef struct MPIDI_CH3_Pkt_close {
......
...@@ -239,7 +239,7 @@ static inline int MPIDI_CH3I_Send_flush_ack_pkt(MPIDI_VC_t * vc, MPID_Win * win_ ...@@ -239,7 +239,7 @@ static inline int MPIDI_CH3I_Send_flush_ack_pkt(MPIDI_VC_t * vc, MPID_Win * win_
#define FUNCNAME send_decr_at_cnt_msg #define FUNCNAME send_decr_at_cnt_msg
#undef FCNAME #undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME) #define FCNAME MPIDI_QUOTE(FUNCNAME)
static inline int send_decr_at_cnt_msg(int dst, MPID_Win * win_ptr) static inline int send_decr_at_cnt_msg(int dst, MPID_Win * win_ptr, MPIDI_CH3_Pkt_flags_t flags)
{ {
MPIDI_CH3_Pkt_t upkt; MPIDI_CH3_Pkt_t upkt;
MPIDI_CH3_Pkt_decr_at_counter_t *decr_at_cnt_pkt = &upkt.decr_at_cnt; MPIDI_CH3_Pkt_decr_at_counter_t *decr_at_cnt_pkt = &upkt.decr_at_cnt;
...@@ -251,6 +251,8 @@ static inline int send_decr_at_cnt_msg(int dst, MPID_Win * win_ptr) ...@@ -251,6 +251,8 @@ static inline int send_decr_at_cnt_msg(int dst, MPID_Win * win_ptr)
MPIDI_Pkt_init(decr_at_cnt_pkt, MPIDI_CH3_PKT_DECR_AT_COUNTER); MPIDI_Pkt_init(decr_at_cnt_pkt, MPIDI_CH3_PKT_DECR_AT_COUNTER);
decr_at_cnt_pkt->target_win_handle = win_ptr->basic_info_table[dst].win_handle; decr_at_cnt_pkt->target_win_handle = win_ptr->basic_info_table[dst].win_handle;
decr_at_cnt_pkt->source_win_handle = win_ptr->handle;
decr_at_cnt_pkt->flags = flags;
MPIDI_Comm_get_vc_set_active(win_ptr->comm_ptr, dst, &vc); MPIDI_Comm_get_vc_set_active(win_ptr->comm_ptr, dst, &vc);
......
...@@ -2033,6 +2033,13 @@ int MPIDI_CH3_PktHandler_DecrAtCnt(MPIDI_VC_t * vc ATTRIBUTE((unused)), ...@@ -2033,6 +2033,13 @@ int MPIDI_CH3_PktHandler_DecrAtCnt(MPIDI_VC_t * vc ATTRIBUTE((unused)),
*buflen = sizeof(MPIDI_CH3_Pkt_t); *buflen = sizeof(MPIDI_CH3_Pkt_t);
*rreqp = NULL; *rreqp = NULL;
if (decr_at_cnt_pkt->flags & MPIDI_CH3_PKT_FLAG_RMA_FLUSH) {
mpi_errno = MPIDI_CH3I_Send_flush_ack_pkt(vc, win_ptr, decr_at_cnt_pkt->source_win_handle);
if (mpi_errno)
MPIU_ERR_POP(mpi_errno);
}
MPIDI_CH3_Progress_signal_completion(); MPIDI_CH3_Progress_signal_completion();
fn_exit: fn_exit:
......
...@@ -226,12 +226,23 @@ static inline int check_and_switch_target_state(MPID_Win * win_ptr, MPIDI_RMA_Ta ...@@ -226,12 +226,23 @@ static inline int check_and_switch_target_state(MPID_Win * win_ptr, MPIDI_RMA_Ta
case MPIDI_RMA_NONE: case MPIDI_RMA_NONE:
if (target->win_complete_flag) { if (target->win_complete_flag) {
if (target->pending_op_list_head == NULL) { if (target->pending_op_list_head == NULL) {
mpi_errno = send_decr_at_cnt_msg(target->target_rank, win_ptr); MPIDI_CH3_Pkt_flags_t flags = MPIDI_CH3_PKT_FLAG_NONE;
if (target->sync.sync_flag == MPIDI_RMA_SYNC_FLUSH && target->put_acc_issued) {
flags |= MPIDI_CH3_PKT_FLAG_RMA_FLUSH;
target->sync.outstanding_acks++;
}
mpi_errno = send_decr_at_cnt_msg(target->target_rank, win_ptr, flags);
if (mpi_errno != MPI_SUCCESS) if (mpi_errno != MPI_SUCCESS)
MPIU_ERR_POP(mpi_errno); MPIU_ERR_POP(mpi_errno);
/* We are done with ending synchronization, unset target's sync_flag. */
target->sync.sync_flag = MPIDI_RMA_SYNC_NONE;
(*made_progress) = 1;
} }
} }
if (target->sync.sync_flag == MPIDI_RMA_SYNC_FLUSH) { else if (target->sync.sync_flag == MPIDI_RMA_SYNC_FLUSH) {
if (target->pending_op_list_head == NULL) { if (target->pending_op_list_head == NULL) {
if (target->target_rank != rank) { if (target->target_rank != rank) {
if (target->put_acc_issued) { if (target->put_acc_issued) {
......
...@@ -849,7 +849,7 @@ int MPIDI_Win_complete(MPID_Win * win_ptr) ...@@ -849,7 +849,7 @@ int MPIDI_Win_complete(MPID_Win * win_ptr)
} }
else { else {
/* FIXME: do we need to wait for remote completion? */ /* FIXME: do we need to wait for remote completion? */
mpi_errno = send_decr_at_cnt_msg(dst, win_ptr); mpi_errno = send_decr_at_cnt_msg(dst, win_ptr, MPIDI_CH3_PKT_FLAG_NONE);
if (mpi_errno != MPI_SUCCESS) if (mpi_errno != MPI_SUCCESS)
MPIU_ERR_POP(mpi_errno); MPIU_ERR_POP(mpi_errno);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment