Commit 1962d3b1 authored by Xin Zhao's avatar Xin Zhao
Browse files

Re-organize progress engine functions.

Rewrite progress engine functions as following:

Basic functions:

(1) check_target_state: check to see if we can switch target state,
    issue synchronization messages if needed.
(2) issue_ops_target: issue al pending operations to this target.
(3) check_window_state: check to see if we can switch window state.
(4) issue_ops_win: issue all pending operations on this window.
    Currently it internally calls check_target_state and
    issue_ops_target, it should be optimized in future.

Progress making functions:

(1) Make_progress_target: make progress on one target, which
    internally call check_target_state and issue_ops_target.
(2) Make_progress_win: make progress on all targets on one window,
    which internally call check_window_state and issue_ops_win.
(3) Make_progress_global: make progress on all windows, which
    internally call make_progress_win.

No reviewer.
parent 7c533ef3
......@@ -115,7 +115,6 @@ static inline MPIDI_RMA_Target_t *MPIDI_CH3I_Win_target_alloc(MPID_Win * win_ptr
e->access_state = MPIDI_RMA_NONE;
e->lock_type = MPID_LOCK_NONE;
e->lock_mode = 0;
e->outstanding_lock = 0;
e->accumulated_ops_cnt = 0;
e->disable_flush_local = 0;
e->win_complete_flag = 0;
......
......@@ -85,7 +85,6 @@ typedef struct MPIDI_RMA_Target {
enum MPIDI_RMA_states access_state;
int lock_type; /* NONE, SHARED, EXCLUSIVE */
int lock_mode; /* e.g., MODE_NO_CHECK */
int outstanding_lock;
int accumulated_ops_cnt;
int disable_flush_local;
int win_complete_flag;
......
......@@ -339,21 +339,34 @@ static inline int enqueue_lock_origin(MPID_Win *win_ptr, MPIDI_VC_t *vc,
static inline int set_lock_sync_counter(MPID_Win *win_ptr, int target_rank)
{
MPIDI_RMA_Target_t *t = NULL;
int mpi_errno = MPI_SUCCESS;
if (win_ptr->outstanding_locks > 0) {
MPIU_Assert(win_ptr->states.access_state == MPIDI_RMA_PER_TARGET ||
win_ptr->states.access_state == MPIDI_RMA_LOCK_ALL_CALLED ||
win_ptr->states.access_state == MPIDI_RMA_LOCK_ALL_ISSUED);
if (win_ptr->states.access_state == MPIDI_RMA_LOCK_ALL_CALLED) {
MPIDI_VC_t *orig_vc = NULL, *target_vc = NULL;
MPIDI_Comm_get_vc(win_ptr->comm_ptr, win_ptr->comm_ptr->rank, &orig_vc);
MPIDI_Comm_get_vc(win_ptr->comm_ptr, target_rank, &target_vc);
if (win_ptr->comm_ptr->rank == target_rank ||
(win_ptr->shm_allocated == TRUE && orig_vc->node_id == target_vc->node_id)) {
win_ptr->outstanding_locks--;
MPIU_Assert(win_ptr->outstanding_locks >= 0);
goto fn_exit;
}
}
else if (win_ptr->states.access_state == MPIDI_RMA_LOCK_ALL_ISSUED) {
win_ptr->outstanding_locks--;
MPIU_Assert(win_ptr->outstanding_locks >= 0);
goto fn_exit;
}
else {
MPIDI_RMA_Target_t *t = NULL;
mpi_errno = MPIDI_CH3I_Win_find_target(win_ptr, target_rank, &t);
if (mpi_errno != MPI_SUCCESS) MPIU_ERR_POP(mpi_errno);
MPIU_Assert(t != NULL);
t->outstanding_lock--;
MPIU_Assert(t->outstanding_lock == 0);
}
mpi_errno = MPIDI_CH3I_Win_find_target(win_ptr, target_rank, &t);
if (mpi_errno != MPI_SUCCESS) MPIU_ERR_POP(mpi_errno);
MPIU_Assert(t != NULL);
t->access_state = MPIDI_RMA_LOCK_GRANTED;
fn_exit:
return mpi_errno;
......
This diff is collapsed.
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