Commit 9042b828 authored by Xin Zhao's avatar Xin Zhao Committed by Pavan Balaji
Browse files

Delete poke_progress_engine in RMA sync calls and only keep self lock cases.



Originally we poke the progress engine at the end of RMA sync calls
if progress engine is never poked in this call before. The purpose
of this is to prevent possible deadlock problem. However, the deadlock
problem should only happen in self lock cases, if target is not myself,
it add unnecessary overhead to RMA sync calls. In this patch, we delete
those progress poking but only leave ones when target is myself.
Signed-off-by: Pavan Balaji's avatarPavan Balaji <balaji@anl.gov>
parent 97569a1a
......@@ -320,7 +320,6 @@ int MPIDI_Win_fence(int assert, MPID_Win * win_ptr)
int local_completed = 0, remote_completed = 0;
MPIDI_RMA_Target_t *curr_target = NULL;
mpir_errflag_t errflag = MPIR_ERR_NONE;
int progress_engine_triggered = 0;
int comm_size = win_ptr->comm_ptr->local_size;
int scalable_fence_enabled = 0;
int *rma_target_marks = NULL;
......@@ -369,10 +368,6 @@ int MPIDI_Win_fence(int assert, MPID_Win * win_ptr)
if (mpi_errno != MPI_SUCCESS)
MPIU_ERR_POP(mpi_errno);
MPIU_ERR_CHKANDJUMP(errflag, mpi_errno, MPI_ERR_OTHER, "**coll_fail");
/* Mark that we triggered the progress engine
* in this function call. */
progress_engine_triggered = 1;
}
mpi_errno = MPIR_Ibarrier_impl(win_ptr->comm_ptr, &(win_ptr->fence_sync_req));
......@@ -479,10 +474,6 @@ int MPIDI_Win_fence(int assert, MPID_Win * win_ptr)
mpi_errno = wait_progress_engine();
if (mpi_errno != MPI_SUCCESS)
MPIU_ERR_POP(mpi_errno);
/* Mark that we triggered the progress engine
* in this function call. */
progress_engine_triggered = 1;
}
} while ((scalable_fence_enabled && !remote_completed) ||
(!scalable_fence_enabled && !local_completed));
......@@ -498,10 +489,6 @@ int MPIDI_Win_fence(int assert, MPID_Win * win_ptr)
MPIU_ERR_POP(mpi_errno);
MPIU_ERR_CHKANDJUMP(errflag, mpi_errno, MPI_ERR_OTHER, "**coll_fail");
/* Mark that we triggered the progress engine
* in this function call. */
progress_engine_triggered = 1;
/* Set window access state properly. */
if (assert & MPI_MODE_NOSUCCEED) {
win_ptr->states.access_state = MPIDI_RMA_NONE;
......@@ -516,10 +503,6 @@ int MPIDI_Win_fence(int assert, MPID_Win * win_ptr)
mpi_errno = wait_progress_engine();
if (mpi_errno != MPI_SUCCESS)
MPIU_ERR_POP(mpi_errno);
/* Mark that we triggered the progress engine
* in this function call. */
progress_engine_triggered = 1;
}
if (assert & MPI_MODE_NOSUCCEED) {
......@@ -539,10 +522,6 @@ int MPIDI_Win_fence(int assert, MPID_Win * win_ptr)
if (mpi_errno != MPI_SUCCESS)
MPIU_ERR_POP(mpi_errno);
MPIU_ERR_CHKANDJUMP(errflag, mpi_errno, MPI_ERR_OTHER, "**coll_fail");
/* Mark that we triggered the progress engine
* in this function call. */
progress_engine_triggered = 1;
}
}
}
......@@ -562,21 +541,6 @@ int MPIDI_Win_fence(int assert, MPID_Win * win_ptr)
MPIU_Assert(win_ptr->active_req_cnt == 0);
if (!(assert & MPI_MODE_NOPRECEDE)) {
if (!progress_engine_triggered) {
/* In some cases (e.g. target is myself, or process on SHM),
* this function call does not go through the progress engine.
* Therefore, it is possible that this process never process
* events coming from other processes. This may cause deadlock in
* applications where the program execution on this process depends
* on the happening of events from other processes. Here we poke
* the progress engine once to avoid such issue. */
mpi_errno = poke_progress_engine();
if (mpi_errno != MPI_SUCCESS)
MPIU_ERR_POP(mpi_errno);
}
}
/* Ensure ordering of load/store operations. */
if (win_ptr->shm_allocated == TRUE) {
OPA_read_write_barrier();
......@@ -830,7 +794,6 @@ int MPIDI_Win_complete(MPID_Win * win_ptr)
int local_completed = 0, remote_completed = 0;
MPID_Comm *win_comm_ptr = win_ptr->comm_ptr;
MPIDI_RMA_Target_t *curr_target;
int progress_engine_triggered = 0;
int made_progress;
MPIDI_STATE_DECL(MPID_STATE_MPIDI_WIN_COMPLETE);
......@@ -851,10 +814,6 @@ int MPIDI_Win_complete(MPID_Win * win_ptr)
mpi_errno = wait_progress_engine();
if (mpi_errno != MPI_SUCCESS)
MPIU_ERR_POP(mpi_errno);
/* Mark that we triggered the progress engine
* in this function call. */
progress_engine_triggered = 1;
}
}
......@@ -903,10 +862,6 @@ int MPIDI_Win_complete(MPID_Win * win_ptr)
mpi_errno = wait_progress_engine();
if (mpi_errno != MPI_SUCCESS)
MPIU_ERR_POP(mpi_errno);
/* Mark that we triggered the progress engine
* in this function call. */
progress_engine_triggered = 1;
}
} while (!local_completed);
......@@ -932,19 +887,6 @@ int MPIDI_Win_complete(MPID_Win * win_ptr)
MPIU_Assert(win_ptr->active_req_cnt == 0);
if (!progress_engine_triggered) {
/* In some cases (e.g. target is myself, or process on SHM),
* this function call does not go through the progress engine.
* Therefore, it is possible that this process never process
* events coming from other processes. This may cause deadlock in
* applications where the program execution on this process depends
* on the happening of events from other processes. Here we poke
* the progress engine once to avoid such issue. */
mpi_errno = poke_progress_engine();
if (mpi_errno != MPI_SUCCESS)
MPIU_ERR_POP(mpi_errno);
}
fn_exit:
MPIDI_RMA_FUNC_EXIT(MPID_STATE_MPIDI_WIN_COMPLETE);
return mpi_errno;
......@@ -962,7 +904,6 @@ int MPIDI_Win_complete(MPID_Win * win_ptr)
#define FCNAME MPIDI_QUOTE(FUNCNAME)
int MPIDI_Win_wait(MPID_Win * win_ptr)
{
int progress_engine_triggered = 0;
int mpi_errno = MPI_SUCCESS;
MPIDI_STATE_DECL(MPID_STATE_MPIDI_WIN_WAIT);
......@@ -976,29 +917,12 @@ int MPIDI_Win_wait(MPID_Win * win_ptr)
mpi_errno = wait_progress_engine();
if (mpi_errno != MPI_SUCCESS)
MPIU_ERR_POP(mpi_errno);
/* Mark that we triggered the progress engine
* in this function call. */
progress_engine_triggered = 1;
}
finish_wait:
/* Set window exposure state properly. */
win_ptr->states.exposure_state = MPIDI_RMA_NONE;
if (!progress_engine_triggered) {
/* In some cases (e.g. target is myself, or process on SHM),
* this function call does not go through the progress engine.
* Therefore, it is possible that this process never process
* events coming from other processes. This may cause deadlock in
* applications where the program execution on this process depends
* on the happening of events from other processes. Here we poke
* the progress engine once to avoid such issue. */
mpi_errno = poke_progress_engine();
if (mpi_errno != MPI_SUCCESS)
MPIU_ERR_POP(mpi_errno);
}
/* Ensure ordering of load/store operations. */
if (win_ptr->shm_allocated == TRUE) {
OPA_read_write_barrier();
......@@ -1177,7 +1101,6 @@ int MPIDI_Win_unlock(int dest, MPID_Win * win_ptr)
int local_completed ATTRIBUTE((unused)) = 0, remote_completed = 0;
MPIDI_RMA_Target_t *target = NULL;
enum MPIDI_RMA_sync_types sync_flag;
int progress_engine_triggered = 0;
int mpi_errno = MPI_SUCCESS;
MPIDI_STATE_DECL(MPID_STATE_MPIDI_WIN_UNLOCK);
......@@ -1231,14 +1154,23 @@ int MPIDI_Win_unlock(int dest, MPID_Win * win_ptr)
mpi_errno = wait_progress_engine();
if (mpi_errno != MPI_SUCCESS)
MPIU_ERR_POP(mpi_errno);
/* Mark that we triggered the progress engine
* in this function call. */
progress_engine_triggered = 1;
}
} while (!remote_completed);
finish_unlock:
if (win_ptr->comm_ptr->rank == dest) {
/* In some cases (e.g. target is myself),
* this function call does not go through the progress engine.
* Therefore, it is possible that this process never process
* events coming from other processes. This may cause deadlock in
* applications where the program execution on this process depends
* on the happening of events from other processes. Here we poke
* the progress engine once to avoid such issue. */
mpi_errno = poke_progress_engine();
if (mpi_errno != MPI_SUCCESS)
MPIU_ERR_POP(mpi_errno);
}
win_ptr->lock_epoch_count--;
if (win_ptr->lock_epoch_count == 0) {
/* Set window access state properly. */
......@@ -1260,19 +1192,6 @@ int MPIDI_Win_unlock(int dest, MPID_Win * win_ptr)
MPIU_ERR_POP(mpi_errno);
}
if (!progress_engine_triggered) {
/* In some cases (e.g. target is myself, or process on SHM),
* this function call does not go through the progress engine.
* Therefore, it is possible that this process never process
* events coming from other processes. This may cause deadlock in
* applications where the program execution on this process depends
* on the happening of events from other processes. Here we poke
* the progress engine once to avoid such issue. */
mpi_errno = poke_progress_engine();
if (mpi_errno != MPI_SUCCESS)
MPIU_ERR_POP(mpi_errno);
}
fn_exit:
MPIDI_RMA_FUNC_EXIT(MPID_STATE_MPIDI_WIN_UNLOCK);
return mpi_errno;
......@@ -1293,7 +1212,6 @@ int MPIDI_Win_flush(int dest, MPID_Win * win_ptr)
int local_completed ATTRIBUTE((unused)) = 0, remote_completed = 0;
int rank = win_ptr->comm_ptr->rank;
MPIDI_RMA_Target_t *target = NULL;
int progress_engine_triggered = 0;
int mpi_errno = MPI_SUCCESS;
MPIDI_STATE_DECL(MPID_STATE_MPIDI_WIN_FLUSH);
......@@ -1352,22 +1270,12 @@ int MPIDI_Win_flush(int dest, MPID_Win * win_ptr)
mpi_errno = wait_progress_engine();
if (mpi_errno != MPI_SUCCESS)
MPIU_ERR_POP(mpi_errno);
/* Mark that we triggered the progress engine
* in this function call. */
progress_engine_triggered = 1;
}
} while (!remote_completed);
finish_flush:
if (target != NULL) {
/* ENDING synchronization: correctly decrement the following counters. */
win_ptr->accumulated_ops_cnt -= target->accumulated_ops_cnt;
target->accumulated_ops_cnt = 0;
}
if (!progress_engine_triggered) {
/* In some cases (e.g. target is myself, or process on SHM),
if (win_ptr->comm_ptr->rank == dest) {
/* In some cases (e.g. target is myself),
* this function call does not go through the progress engine.
* Therefore, it is possible that this process never process
* events coming from other processes. This may cause deadlock in
......@@ -1379,6 +1287,12 @@ int MPIDI_Win_flush(int dest, MPID_Win * win_ptr)
MPIU_ERR_POP(mpi_errno);
}
if (target != NULL) {
/* ENDING synchronization: correctly decrement the following counters. */
win_ptr->accumulated_ops_cnt -= target->accumulated_ops_cnt;
target->accumulated_ops_cnt = 0;
}
fn_exit:
MPIDI_RMA_FUNC_EXIT(MPID_STATE_MPIDI_WIN_FLUSH);
return mpi_errno;
......@@ -1399,7 +1313,6 @@ int MPIDI_Win_flush_local(int dest, MPID_Win * win_ptr)
int local_completed = 0, remote_completed = 0;
int rank = win_ptr->comm_ptr->rank;
MPIDI_RMA_Target_t *target = NULL;
int progress_engine_triggered = 0;
int mpi_errno = MPI_SUCCESS;
MPIDI_STATE_DECL(MPID_STATE_MPIDI_WIN_FLUSH_LOCAL);
......@@ -1465,10 +1378,6 @@ int MPIDI_Win_flush_local(int dest, MPID_Win * win_ptr)
mpi_errno = wait_progress_engine();
if (mpi_errno != MPI_SUCCESS)
MPIU_ERR_POP(mpi_errno);
/* Mark that we triggered the progress engine
* in this function call. */
progress_engine_triggered = 1;
}
} while ((target->sync.upgrade_flush_local && !remote_completed) ||
(!target->sync.upgrade_flush_local && !local_completed));
......@@ -1483,19 +1392,6 @@ int MPIDI_Win_flush_local(int dest, MPID_Win * win_ptr)
target->accumulated_ops_cnt = 0;
}
if (!progress_engine_triggered) {
/* In some cases (e.g. target is myself, or process on SHM),
* this function call does not go through the progress engine.
* Therefore, it is possible that this process never process
* events coming from other processes. This may cause deadlock in
* applications where the program execution on this process depends
* on the happening of events from other processes. Here we poke
* the progress engine once to avoid such issue. */
mpi_errno = poke_progress_engine();
if (mpi_errno != MPI_SUCCESS)
MPIU_ERR_POP(mpi_errno);
}
fn_exit:
MPIDI_RMA_FUNC_EXIT(MPID_STATE_MPIDI_WIN_FLUSH_LOCAL);
return mpi_errno;
......@@ -1602,7 +1498,6 @@ int MPIDI_Win_unlock_all(MPID_Win * win_ptr)
int local_completed = 0, remote_completed = 0;
int rank = win_ptr->comm_ptr->rank;
MPIDI_RMA_Target_t *curr_target = NULL;
int progress_engine_triggered = 0;
enum MPIDI_RMA_sync_types sync_flag;
int mpi_errno = MPI_SUCCESS;
MPIDI_STATE_DECL(MPID_STATE_MPIDI_WIN_UNLOCK_ALL);
......@@ -1707,10 +1602,6 @@ int MPIDI_Win_unlock_all(MPID_Win * win_ptr)
mpi_errno = wait_progress_engine();
if (mpi_errno != MPI_SUCCESS)
MPIU_ERR_POP(mpi_errno);
/* Mark that we triggered the progress engine
* in this function call. */
progress_engine_triggered = 1;
}
} while (!remote_completed);
......@@ -1736,19 +1627,6 @@ int MPIDI_Win_unlock_all(MPID_Win * win_ptr)
MPIU_Assert(win_ptr->active_req_cnt == 0);
if (!progress_engine_triggered) {
/* In some cases (e.g. target is myself, or process on SHM),
* this function call does not go through the progress engine.
* Therefore, it is possible that this process never process
* events coming from other processes. This may cause deadlock in
* applications where the program execution on this process depends
* on the happening of events from other processes. Here we poke
* the progress engine once to avoid such issue. */
mpi_errno = poke_progress_engine();
if (mpi_errno != MPI_SUCCESS)
MPIU_ERR_POP(mpi_errno);
}
fn_exit:
MPIDI_RMA_FUNC_EXIT(MPID_STATE_MPIDI_WIN_UNLOCK_ALL);
return mpi_errno;
......@@ -1768,7 +1646,6 @@ int MPIDI_Win_flush_all(MPID_Win * win_ptr)
int i, made_progress = 0;
int local_completed = 0, remote_completed = 0;
MPIDI_RMA_Target_t *curr_target = NULL;
int progress_engine_triggered = 0;
int mpi_errno = MPI_SUCCESS;
MPIDI_STATE_DECL(MPIDI_STATE_MPIDI_WIN_FLUSH_ALL);
......@@ -1814,10 +1691,6 @@ int MPIDI_Win_flush_all(MPID_Win * win_ptr)
mpi_errno = wait_progress_engine();
if (mpi_errno != MPI_SUCCESS)
MPIU_ERR_POP(mpi_errno);
/* Mark that we triggered the progress engine
* in this function call. */
progress_engine_triggered = 1;
}
} while (!remote_completed);
......@@ -1827,19 +1700,6 @@ int MPIDI_Win_flush_all(MPID_Win * win_ptr)
MPIU_Assert(win_ptr->active_req_cnt == 0);
if (!progress_engine_triggered) {
/* In some cases (e.g. target is myself, or process on SHM),
* this function call does not go through the progress engine.
* Therefore, it is possible that this process never process
* events coming from other processes. This may cause deadlock in
* applications where the program execution on this process depends
* on the happening of events from other processes. Here we poke
* the progress engine once to avoid such issue. */
mpi_errno = poke_progress_engine();
if (mpi_errno != MPI_SUCCESS)
MPIU_ERR_POP(mpi_errno);
}
fn_exit:
MPIDI_RMA_FUNC_EXIT(MPIDI_STATE_MPIDI_WIN_FLUSH_ALL);
return mpi_errno;
......@@ -1861,7 +1721,6 @@ int MPIDI_Win_flush_local_all(MPID_Win * win_ptr)
MPIDI_RMA_Target_t *curr_target = NULL;
int enable_flush_local_cnt = 0, upgrade_flush_local_cnt = 0;
int remote_completed_cnt = 0, local_completed_cnt = 0;
int progress_engine_triggered = 0;
int mpi_errno = MPI_SUCCESS;
MPIDI_STATE_DECL(MPID_STATE_MPIDI_WIN_FLUSH_LOCAL_ALL);
......@@ -1941,10 +1800,6 @@ int MPIDI_Win_flush_local_all(MPID_Win * win_ptr)
mpi_errno = wait_progress_engine();
if (mpi_errno != MPI_SUCCESS)
MPIU_ERR_POP(mpi_errno);
/* Mark that we triggered the progress engine
* in this function call. */
progress_engine_triggered = 1;
}
} while (remote_completed_cnt < upgrade_flush_local_cnt ||
local_completed_cnt < enable_flush_local_cnt);
......@@ -1962,19 +1817,6 @@ int MPIDI_Win_flush_local_all(MPID_Win * win_ptr)
/* ENDING synchronization: correctly decrement the following counter. */
win_ptr->accumulated_ops_cnt = 0;
if (!progress_engine_triggered) {
/* In some cases (e.g. target is myself, or process on SHM),
* this function call does not go through the progress engine.
* Therefore, it is possible that this process never process
* events coming from other processes. This may cause deadlock in
* applications where the program execution on this process depends
* on the happening of events from other processes. Here we poke
* the progress engine once to avoid such issue. */
mpi_errno = poke_progress_engine();
if (mpi_errno != MPI_SUCCESS)
MPIU_ERR_POP(mpi_errno);
}
fn_exit:
MPIDI_RMA_FUNC_EXIT(MPID_STATE_MPIDI_WIN_FLUSH_LOCAL_ALL);
return 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