Commit dc9275be authored by Xin Zhao's avatar Xin Zhao
Browse files

Fix #1701 - cleanup code for zero-size data transfer.



Delete code for zero-size data transfer in packet handlers
of Put/Accumulate/Accumulate_Immed/Get_AccumulateResp/GetResp/
LockPutUnlock/LockAccumUnlock, because they are redundant.

(Note that packet handlers of LockPutUnlock and LockAccumUnlock
are for single operation optimization in passive RMA)

Zero-size data transfer has already been handled when issuing
RMA operations (L146, L258, L369 in src/mpid/ch3/src/ch3u_rma_ops.c
and L50 in src/mpid/ch3/src/ch3u_rma_acc_ops.c). RMA operation
routines will directly exit if data size is zero.
Signed-off-by: default avatarWesley Bland <wbland@mcs.anl.gov>
parent b9531d3d
......@@ -3398,13 +3398,6 @@ int MPIDI_CH3_PktHandler_Put( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt,
type_size);
req->dev.recv_data_sz = type_size * put_pkt->count;
if (req->dev.recv_data_sz == 0) {
MPIDI_CH3U_Request_complete( req );
*buflen = sizeof(MPIDI_CH3_Pkt_t);
*rreqp = NULL;
goto fn_exit;
}
mpi_errno = MPIDI_CH3U_Receive_data_found(req, data_buf, &data_len,
&complete);
MPIU_ERR_CHKANDJUMP1(mpi_errno, mpi_errno, MPI_ERR_OTHER, "**ch3|postrecv",
......@@ -3704,12 +3697,6 @@ int MPIDI_CH3_PktHandler_Accumulate( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt,
MPID_Datatype_get_size_macro(accum_pkt->datatype, type_size);
req->dev.recv_data_sz = type_size * accum_pkt->count;
if (req->dev.recv_data_sz == 0) {
MPIDI_CH3U_Request_complete(req);
*buflen = sizeof(MPIDI_CH3_Pkt_t);
*rreqp = NULL;
}
else {
mpi_errno = MPIDI_CH3U_Receive_data_found(req, data_buf, &data_len,
&complete);
MPIU_ERR_CHKANDJUMP1(mpi_errno, mpi_errno, MPI_ERR_OTHER, "**ch3|postrecv",
......@@ -3736,7 +3723,6 @@ int MPIDI_CH3_PktHandler_Accumulate( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt,
}
MPIU_INSTR_DURATION_END(rmapkt_acc_predef);
}
}
else
{
MPIDI_Request_set_type(req, MPIDI_REQUEST_TYPE_ACCUM_RESP_DERIVED_DT);
......@@ -3831,11 +3817,6 @@ int MPIDI_CH3_PktHandler_Accumulate_Immed( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt,
MPID_Datatype_get_extent_macro(accum_pkt->datatype, extent);
/* size == 0 should never happen */
if (accum_pkt->count == 0 || extent == 0) {
;
}
else {
MPIU_INSTR_DURATION_START(rmapkt_acc_immed_op);
if (win_ptr->shm_allocated == TRUE)
MPIDI_CH3I_SHM_MUTEX_LOCK(win_ptr);
......@@ -3864,7 +3845,6 @@ int MPIDI_CH3_PktHandler_Accumulate_Immed( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt,
MPIDI_CH3I_SHM_MUTEX_UNLOCK(win_ptr);
MPIU_INSTR_DURATION_END(rmapkt_acc_immed_op);
/* There are additional steps to take if this is a passive
target RMA or the last operation from the source */
......@@ -3876,7 +3856,6 @@ int MPIDI_CH3_PktHandler_Accumulate_Immed( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt,
accum_pkt->flags,
accum_pkt->source_win_handle);
if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
}
fn_exit:
MPIU_INSTR_DURATION_END(rmapkt_acc_immed);
......@@ -4187,15 +4166,6 @@ int MPIDI_CH3_PktHandler_Get_AccumResp( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt,
MPID_Datatype_get_size_macro(req->dev.datatype, type_size);
req->dev.recv_data_sz = type_size * req->dev.user_count;
/* FIXME: It is likely that this cannot happen (never perform
a get with a 0-sized item). In that case, change this
to an MPIU_Assert (and do the same for accumulate and put) */
if (req->dev.recv_data_sz == 0) {
MPIDI_CH3U_Request_complete( req );
*buflen = sizeof(MPIDI_CH3_Pkt_t);
*rreqp = NULL;
}
else {
*rreqp = req;
mpi_errno = MPIDI_CH3U_Receive_data_found(req, data_buf, &data_len, &complete);
MPIU_ERR_CHKANDJUMP1(mpi_errno, mpi_errno, MPI_ERR_OTHER, "**ch3|postrecv",
......@@ -4206,7 +4176,6 @@ int MPIDI_CH3_PktHandler_Get_AccumResp( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt,
}
/* return the number of bytes processed in this function */
*buflen = data_len + sizeof(MPIDI_CH3_Pkt_t);
}
fn_exit:
MPIU_INSTR_DURATION_END(rmapkt_get_accum);
......@@ -4393,12 +4362,6 @@ int MPIDI_CH3_PktHandler_LockPutUnlock( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt,
req->dev.lock_queue_entry = new_ptr;
}
if (req->dev.recv_data_sz == 0) {
*buflen = sizeof(MPIDI_CH3_Pkt_t);
MPIDI_CH3U_Request_complete(req);
*rreqp = NULL;
}
else {
int (*fcn)( MPIDI_VC_t *, struct MPID_Request *, int * );
fcn = req->dev.OnDataAvail;
mpi_errno = MPIDI_CH3U_Receive_data_found(req, data_buf, &data_len,
......@@ -4422,8 +4385,6 @@ int MPIDI_CH3_PktHandler_LockPutUnlock( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt,
/* return the number of bytes processed in this function */
*buflen = data_len + sizeof(MPIDI_CH3_Pkt_t);
}
if (mpi_errno != MPI_SUCCESS) {
MPIU_ERR_SETFATALANDJUMP1(mpi_errno,MPI_ERR_OTHER,
......@@ -4650,12 +4611,6 @@ int MPIDI_CH3_PktHandler_LockAccumUnlock( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt,
req->dev.lock_queue_entry = new_ptr;
*rreqp = req;
if (req->dev.recv_data_sz == 0) {
*buflen = sizeof(MPIDI_CH3_Pkt_t);
MPIDI_CH3U_Request_complete(req);
*rreqp = NULL;
}
else {
mpi_errno = MPIDI_CH3U_Receive_data_found(req, data_buf, &data_len,
&complete);
/* FIXME: Only change the handling of completion if
......@@ -4679,7 +4634,6 @@ int MPIDI_CH3_PktHandler_LockAccumUnlock( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt,
*rreqp = NULL;
}
}
}
fn_fail:
MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_CH3_PKTHANDLER_LOCKACCUMUNLOCK);
return mpi_errno;
......@@ -4714,15 +4668,6 @@ int MPIDI_CH3_PktHandler_GetResp( MPIDI_VC_t *vc ATTRIBUTE((unused)),
MPID_Datatype_get_size_macro(req->dev.datatype, type_size);
req->dev.recv_data_sz = type_size * req->dev.user_count;
/* FIXME: It is likely that this cannot happen (never perform
a get with a 0-sized item). In that case, change this
to an MPIU_Assert (and do the same for accumulate and put) */
if (req->dev.recv_data_sz == 0) {
MPIDI_CH3U_Request_complete( req );
*buflen = sizeof(MPIDI_CH3_Pkt_t);
*rreqp = NULL;
}
else {
*rreqp = req;
mpi_errno = MPIDI_CH3U_Receive_data_found(req, data_buf,
&data_len, &complete);
......@@ -4734,7 +4679,7 @@ int MPIDI_CH3_PktHandler_GetResp( MPIDI_VC_t *vc ATTRIBUTE((unused)),
}
/* return the number of bytes processed in this function */
*buflen = data_len + sizeof(MPIDI_CH3_Pkt_t);
}
fn_exit:
MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_CH3_PKTHANDLER_GETRESP);
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