Commit f8e19f56 authored by James Dinan's avatar James Dinan
Browse files

[svn-r10179] Removed source_win_handle from CAS packet.

The source_win_handle is used to inform the target that the RMA access epoch
has ended.  This was removed from the CAS packet to save space and was replaced
with another packet type, MPIDI_CH3_PKT_CAS_UNLOCK, which conveys the same
information.
parent 45dd4014
......@@ -114,6 +114,7 @@ typedef enum MPIDI_CH3_Pkt_type
MPIDI_CH3_PKT_ACCUM_IMMED, /* optimization for short accumulate */
/* FIXME: Add PUT, GET_IMMED packet types */
MPIDI_CH3_PKT_CAS,
MPIDI_CH3_PKT_CAS_UNLOCK,
MPIDI_CH3_PKT_CAS_RESP,
MPIDI_CH3_PKT_FLOW_CNTL_UPDATE, /* FIXME: Unused */
MPIDI_CH3_PKT_CLOSE,
......@@ -287,17 +288,17 @@ MPIDI_CH3_Pkt_accum_immed_t;
typedef struct MPIDI_CH3_Pkt_cas
{
MPIDI_CH3_Pkt_type_t type;
void *addr;
MPI_Datatype datatype;
void *addr;
MPI_Request request_handle;
/* FIXME: do we need both handles? */
MPI_Win target_win_handle; /* Used in the last RMA operation in each
* epoch for decrementing rma op counter in
* active target rma and for unlocking window
* in passive target rma. Otherwise set to NULL*/
MPI_Win source_win_handle; /* Used in the last RMA operation in an
* epoch in the case of passive target rma
* with shared locks. Otherwise set to NULL*/
* epoch for decrementing rma op counter in
* active target rma and for unlocking window
* in passive target rma. Otherwise set to NULL*/
/* source_win_handle is omitted here to reduce
* the packet size. If this is the last CAS
* packet, the type will be set to CAS_UNLOCK */
MPIDI_CH3_CAS_Immed_u origin_data;
MPIDI_CH3_CAS_Immed_u compare_data;
}
......
......@@ -590,6 +590,8 @@ int MPIDI_CH3_PktHandler_Init( MPIDI_CH3_PktHandler_Fcn *pktArray[],
MPIDI_CH3_PktHandler_Accumulate_Immed;
pktArray[MPIDI_CH3_PKT_CAS] =
MPIDI_CH3_PktHandler_CAS;
pktArray[MPIDI_CH3_PKT_CAS_UNLOCK] =
MPIDI_CH3_PktHandler_CAS;
pktArray[MPIDI_CH3_PKT_CAS_RESP] =
MPIDI_CH3_PktHandler_CASResp;
/* End of default RMA operations */
......
......@@ -871,11 +871,17 @@ static int MPIDI_CH3I_Send_immed_rmw_msg(MPIDI_RMA_ops *rma_op,
MPIU_Assert(len <= sizeof(MPIDI_CH3_CAS_Immed_u));
MPIDI_Pkt_init(cas_pkt, MPIDI_CH3_PKT_CAS);
/* If this is the last operation, it also unlocks the window
at the target. */
if (rma_op->next == NULL) {
MPIDI_Pkt_init(cas_pkt, MPIDI_CH3_PKT_CAS_UNLOCK);
} else {
MPIDI_Pkt_init(cas_pkt, MPIDI_CH3_PKT_CAS);
}
cas_pkt->addr = (char *) win_ptr->base_addrs[rma_op->target_rank] + rma_op->target_disp;
cas_pkt->datatype = rma_op->target_datatype;
cas_pkt->target_win_handle = target_win_handle;
cas_pkt->source_win_handle = source_win_handle;
cas_pkt->request_handle = resp_req->handle;
MPIU_Memcpy( (void *) &cas_pkt->origin_data, rma_op->origin_addr, len );
......@@ -2014,8 +2020,10 @@ static int MPIDI_CH3I_Do_passive_target_rma(MPID_Win *win_ptr,
to the end of the list and do it last, in which case an rma done
pkt is not needed. If there is no get, rma done pkt is needed */
if (win_ptr->rma_ops_list_tail->type == MPIDI_RMA_GET) {
/* last operation is a get. no need to wait for rma done pkt */
if (win_ptr->rma_ops_list_tail->type == MPIDI_RMA_GET ||
win_ptr->rma_ops_list_tail->type == MPIDI_RMA_COMPARE_AND_SWAP) {
/* last operation sends a response message. no need to wait
for an additional rma done pkt */
*wait_for_rma_done_pkt = 0;
}
else {
......@@ -3168,7 +3176,7 @@ int MPIDI_CH3_PktHandler_CAS( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt,
win_ptr->my_pt_rma_puts_accs++;
/* Send RMA done packet? FIXME: Can the cas_resp handler handle this? */
if (cas_pkt->source_win_handle != MPI_WIN_NULL) {
if (cas_pkt->type == MPIDI_CH3_PKT_CAS_UNLOCK) {
/* Last RMA operation from source. If active
target RMA, decrement window counter. If
passive target RMA, release lock on window and
......@@ -3182,11 +3190,6 @@ int MPIDI_CH3_PktHandler_CAS( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt,
MPIDI_CH3_Progress_signal_completion();
}
else {
if ((win_ptr->current_lock_type == MPI_LOCK_SHARED) ||
(/*rreq->dev.single_op_opt*/ 0 == 1)) {
mpi_errno = MPIDI_CH3I_Send_pt_rma_done_pkt(vc, cas_pkt->source_win_handle);
if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
}
mpi_errno = MPIDI_CH3I_Release_lock(win_ptr);
/* Without the following signal_completion call, we
sometimes hang */
......
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