Commit eef0c70a authored by Min Si's avatar Min Si Committed by Pavan Balaji
Browse files

Move outstanding_acks increment to flush sending step.



The outstanding_acks counter was increased at each sync call (such as
fence and flush). However, the counter had to be decreased again if
flush ack is not required. It is more straightforward if increasing it
only when the flush packet is issued (FLUSH flag piggyback or a separate
flush message).
Signed-off-by: default avatarXin Zhao <xinzhao3@illinois.edu>
Signed-off-by: Pavan Balaji's avatarPavan Balaji <balaji@anl.gov>
parent 82c2d652
......@@ -192,9 +192,6 @@ static inline int check_and_switch_target_state(MPID_Win * win_ptr, MPIDI_RMA_Ta
* function will clean it up. */
target->access_state = MPIDI_RMA_LOCK_GRANTED;
target->sync.outstanding_acks--;
MPIU_Assert(target->sync.outstanding_acks >= 0);
/* We are done with ending synchronization, unset target's sync_flag. */
target->sync.sync_flag = MPIDI_RMA_SYNC_NONE;
......@@ -214,23 +211,15 @@ static inline int check_and_switch_target_state(MPID_Win * win_ptr, MPIDI_RMA_Ta
case MPIDI_RMA_NONE:
if (target->sync.sync_flag == MPIDI_RMA_SYNC_FLUSH) {
if (target->pending_op_list_head == NULL) {
if (target->target_rank == rank) {
target->sync.outstanding_acks--;
MPIU_Assert(target->sync.outstanding_acks >= 0);
}
else {
if (target->target_rank != rank) {
if (target->put_acc_issued) {
target->sync.outstanding_acks++;
mpi_errno = send_flush_msg(target->target_rank, win_ptr);
if (mpi_errno != MPI_SUCCESS)
MPIU_ERR_POP(mpi_errno);
}
else {
/* We did not issue PUT/ACC since the last
* synchronization call, therefore here we
* don't need ACK back */
target->sync.outstanding_acks--;
MPIU_Assert(target->sync.outstanding_acks >= 0);
}
}
/* We are done with ending synchronization, unset target's sync_flag. */
......@@ -242,9 +231,6 @@ static inline int check_and_switch_target_state(MPID_Win * win_ptr, MPIDI_RMA_Ta
else if (target->sync.sync_flag == MPIDI_RMA_SYNC_UNLOCK) {
if (target->pending_op_list_head == NULL) {
if (target->target_rank == rank) {
target->sync.outstanding_acks--;
MPIU_Assert(target->sync.outstanding_acks >= 0);
mpi_errno = MPIDI_CH3I_Release_lock(win_ptr);
if (mpi_errno != MPI_SUCCESS)
MPIU_ERR_POP(mpi_errno);
......@@ -255,11 +241,12 @@ static inline int check_and_switch_target_state(MPID_Win * win_ptr, MPIDI_RMA_Ta
/* We did not issue PUT/ACC since the last
* synchronization call, therefore here we
* don't need ACK back */
target->sync.outstanding_acks--;
MPIU_Assert(target->sync.outstanding_acks >= 0);
flag = MPIDI_CH3_PKT_FLAG_RMA_UNLOCK_NO_ACK;
}
else {
target->sync.outstanding_acks++;
}
mpi_errno = send_unlock_msg(target->target_rank, win_ptr, flag);
if (mpi_errno != MPI_SUCCESS)
MPIU_ERR_POP(mpi_errno);
......@@ -354,6 +341,8 @@ static inline int issue_ops_target(MPID_Win * win_ptr, MPIDI_RMA_Target_t * targ
/* piggyback on last OP. */
if (target->sync.sync_flag == MPIDI_RMA_SYNC_FLUSH) {
flags |= MPIDI_CH3_PKT_FLAG_RMA_FLUSH;
target->sync.outstanding_acks++;
if (target->win_complete_flag)
flags |= MPIDI_CH3_PKT_FLAG_RMA_DECR_AT_COUNTER;
}
......@@ -680,7 +669,6 @@ int MPIDI_CH3I_RMA_Cleanup_target_aggressive(MPID_Win * win_ptr, MPIDI_RMA_Targe
curr_target = win_ptr->slots[i].target_list_head;
if (curr_target->sync.sync_flag < MPIDI_RMA_SYNC_FLUSH) {
curr_target->sync.sync_flag = MPIDI_RMA_SYNC_FLUSH;
curr_target->sync.outstanding_acks++;
}
/* Issue out all operations. */
......
......@@ -374,7 +374,6 @@ int MPIDI_Win_fence(int assert, MPID_Win * win_ptr)
/* set sync_flag in sync struct */
if (curr_target->sync.sync_flag < MPIDI_RMA_SYNC_FLUSH) {
curr_target->sync.sync_flag = MPIDI_RMA_SYNC_FLUSH;
curr_target->sync.outstanding_acks++;
}
curr_target = curr_target->next;
}
......@@ -753,7 +752,6 @@ int MPIDI_Win_complete(MPID_Win * win_ptr)
/* set sync_flag in sync struct */
if (curr_target->sync.sync_flag < MPIDI_RMA_SYNC_FLUSH) {
curr_target->sync.sync_flag = MPIDI_RMA_SYNC_FLUSH;
curr_target->sync.outstanding_acks++;
}
curr_target->win_complete_flag = 1;
}
......@@ -1088,7 +1086,6 @@ int MPIDI_Win_unlock(int dest, MPID_Win * win_ptr)
sync_flag = MPIDI_RMA_SYNC_UNLOCK;
if (target->sync.sync_flag < sync_flag) {
target->sync.sync_flag = sync_flag;
target->sync.outstanding_acks++;
}
/* Issue out all operations. */
......@@ -1210,7 +1207,6 @@ int MPIDI_Win_flush(int dest, MPID_Win * win_ptr)
/* Set sync_flag in sync struct. */
if (target->sync.sync_flag < MPIDI_RMA_SYNC_FLUSH) {
target->sync.sync_flag = MPIDI_RMA_SYNC_FLUSH;
target->sync.outstanding_acks++;
}
/* Issue out all operations. */
......@@ -1318,7 +1314,6 @@ int MPIDI_Win_flush_local(int dest, MPID_Win * win_ptr)
if (target->sync.upgrade_flush_local) {
if (target->sync.sync_flag < MPIDI_RMA_SYNC_FLUSH) {
target->sync.sync_flag = MPIDI_RMA_SYNC_FLUSH;
target->sync.outstanding_acks++;
}
}
else {
......@@ -1532,7 +1527,6 @@ int MPIDI_Win_unlock_all(MPID_Win * win_ptr)
while (curr_target != NULL) {
if (curr_target->sync.sync_flag < sync_flag) {
curr_target->sync.sync_flag = sync_flag;
curr_target->sync.outstanding_acks++;
}
curr_target = curr_target->next;
}
......@@ -1551,7 +1545,6 @@ int MPIDI_Win_unlock_all(MPID_Win * win_ptr)
if (curr_target != NULL) {
if (curr_target->sync.sync_flag < sync_flag) {
curr_target->sync.sync_flag = sync_flag;
curr_target->sync.outstanding_acks++;
}
}
else {
......@@ -1672,7 +1665,6 @@ int MPIDI_Win_flush_all(MPID_Win * win_ptr)
while (curr_target != NULL) {
if (curr_target->sync.sync_flag < MPIDI_RMA_SYNC_FLUSH) {
curr_target->sync.sync_flag = MPIDI_RMA_SYNC_FLUSH;
curr_target->sync.outstanding_acks++;
}
/* ENDING synchronization: correctly decrement the following counters. */
......@@ -1767,7 +1759,6 @@ int MPIDI_Win_flush_local_all(MPID_Win * win_ptr)
if (curr_target->sync.upgrade_flush_local) {
if (curr_target->sync.sync_flag < MPIDI_RMA_SYNC_FLUSH) {
curr_target->sync.sync_flag = MPIDI_RMA_SYNC_FLUSH;
curr_target->sync.outstanding_acks++;
}
upgrade_flush_local_cnt++;
}
......
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