Commit 88d34091 authored by Xin Zhao's avatar Xin Zhao
Browse files

Split shared request handler.



ReqHandler_GaccumLikeSendComplete is used for GACC-like operations,
including GACC, CAS and FOP. Here we split it into following three
functions:

ReqHandler_GaccumSendComplete
ReqHandler_CASSendComplete
ReqHandler_FOPSendComplete

It is convenient for us to add different actions in future for those
three kinds of operations.
Signed-off-by: Pavan Balaji's avatarPavan Balaji <balaji@anl.gov>
parent 8b1a69b9
......@@ -1923,8 +1923,12 @@ int MPIDI_CH3_ReqHandler_SendReloadIOV( MPIDI_VC_t *vc, MPID_Request *sreq,
int *complete );
int MPIDI_CH3_ReqHandler_GetSendComplete( MPIDI_VC_t *, MPID_Request *,
int * );
int MPIDI_CH3_ReqHandler_GaccumLikeSendComplete( MPIDI_VC_t *, MPID_Request *,
int * );
int MPIDI_CH3_ReqHandler_GaccumSendComplete( MPIDI_VC_t *, MPID_Request *,
int * );
int MPIDI_CH3_ReqHandler_CASSendComplete( MPIDI_VC_t *, MPID_Request *,
int * );
int MPIDI_CH3_ReqHandler_FOPSendComplete( MPIDI_VC_t *, MPID_Request *,
int * );
/* Request-based operation handler */
int MPIDI_CH3_ReqHandler_ReqOpsComplete(MPIDI_VC_t *, MPID_Request *,
int *);
......
......@@ -214,8 +214,8 @@ int MPIDI_CH3_ReqHandler_GaccumRecvComplete( MPIDI_VC_t *vc,
MPID_Segment_free(seg);
}
resp_req->dev.OnFinal = MPIDI_CH3_ReqHandler_GaccumLikeSendComplete;
resp_req->dev.OnDataAvail = MPIDI_CH3_ReqHandler_GaccumLikeSendComplete;
resp_req->dev.OnFinal = MPIDI_CH3_ReqHandler_GaccumSendComplete;
resp_req->dev.OnDataAvail = MPIDI_CH3_ReqHandler_GaccumSendComplete;
resp_req->dev.target_win_handle = rreq->dev.target_win_handle;
resp_req->dev.flags = rreq->dev.flags;
......
......@@ -72,18 +72,18 @@ int MPIDI_CH3_ReqHandler_GetSendComplete( MPIDI_VC_t *vc ATTRIBUTE((unused)),
}
#undef FUNCNAME
#define FUNCNAME MPIDI_CH3_ReqHandler_GaccumLikeSendComplete
#define FUNCNAME MPIDI_CH3_ReqHandler_GaccumSendComplete
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
int MPIDI_CH3_ReqHandler_GaccumLikeSendComplete( MPIDI_VC_t *vc,
int MPIDI_CH3_ReqHandler_GaccumSendComplete( MPIDI_VC_t *vc,
MPID_Request *rreq,
int *complete )
{
int mpi_errno = MPI_SUCCESS;
MPID_Win *win_ptr;
MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3_REQHANDLER_GACCUMLIKESENDCOMPLETE);
MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3_REQHANDLER_GACCUMSENDCOMPLETE);
MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3_REQHANDLER_GACCUMLIKESENDCOMPLETE);
MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3_REQHANDLER_GACCUMSENDCOMPLETE);
/* This function is triggered when sending back process of GACC/FOP/CAS
is finished. Only GACC used user_buf. FOP and CAS can fit all data
in response packet. */
......@@ -101,12 +101,90 @@ int MPIDI_CH3_ReqHandler_GaccumLikeSendComplete( MPIDI_VC_t *vc,
win_ptr->at_completion_counter--;
MPIU_Assert(win_ptr->at_completion_counter >= 0);
MPIDI_CH3U_Request_complete(rreq);
*complete = TRUE;
fn_exit:
MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_CH3_REQHANDLER_GACCUMSENDCOMPLETE);
return mpi_errno;
fn_fail:
goto fn_exit;
}
#undef FUNCNAME
#define FUNCNAME MPIDI_CH3_ReqHandler_CASSendComplete
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
int MPIDI_CH3_ReqHandler_CASSendComplete( MPIDI_VC_t *vc,
MPID_Request *rreq,
int *complete )
{
int mpi_errno = MPI_SUCCESS;
MPID_Win *win_ptr;
MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3_REQHANDLER_CASSENDCOMPLETE);
MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3_REQHANDLER_CASSENDCOMPLETE);
/* This function is triggered when sending back process of GACC/FOP/CAS
is finished. Only GACC used user_buf. FOP and CAS can fit all data
in response packet. */
if (rreq->dev.user_buf != NULL)
MPIU_Free(rreq->dev.user_buf);
MPID_Win_get_ptr(rreq->dev.target_win_handle, win_ptr);
mpi_errno = finish_op_on_target(win_ptr, vc, MPIDI_CH3_PKT_CAS,
rreq->dev.flags, rreq->dev.source_win_handle);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
/* here we decrement the Active Target counter to guarantee the GET-like
operation are completed when counter reaches zero. */
win_ptr->at_completion_counter--;
MPIU_Assert(win_ptr->at_completion_counter >= 0);
MPIDI_CH3U_Request_complete(rreq);
*complete = TRUE;
fn_exit:
MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_CH3_REQHANDLER_CASSENDCOMPLETE);
return mpi_errno;
fn_fail:
goto fn_exit;
}
#undef FUNCNAME
#define FUNCNAME MPIDI_CH3_ReqHandler_FOPSendComplete
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
int MPIDI_CH3_ReqHandler_FOPSendComplete( MPIDI_VC_t *vc,
MPID_Request *rreq,
int *complete )
{
int mpi_errno = MPI_SUCCESS;
MPID_Win *win_ptr;
MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3_REQHANDLER_FOPSENDCOMPLETE);
MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3_REQHANDLER_FOPSENDCOMPLETE);
/* This function is triggered when sending back process of GACC/FOP/CAS
is finished. Only GACC used user_buf. FOP and CAS can fit all data
in response packet. */
if (rreq->dev.user_buf != NULL)
MPIU_Free(rreq->dev.user_buf);
MPID_Win_get_ptr(rreq->dev.target_win_handle, win_ptr);
mpi_errno = finish_op_on_target(win_ptr, vc, MPIDI_CH3_PKT_FOP,
rreq->dev.flags, rreq->dev.source_win_handle);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
/* here we decrement the Active Target counter to guarantee the GET-like
operation are completed when counter reaches zero. */
win_ptr->at_completion_counter--;
MPIU_Assert(win_ptr->at_completion_counter >= 0);
MPIDI_CH3U_Request_complete(rreq);
*complete = TRUE;
fn_exit:
MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_CH3_REQHANDLER_GACCUMLIKESENDCOMPLETE);
MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_CH3_REQHANDLER_FOPSENDCOMPLETE);
return mpi_errno;
fn_fail:
......
......@@ -923,7 +923,7 @@ int MPIDI_CH3_PktHandler_CAS(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt,
(it is initialized to NULL by lower layer) */
req->dev.target_win_handle = cas_pkt->target_win_handle;
req->dev.flags = cas_pkt->flags;
req->dev.OnDataAvail = MPIDI_CH3_ReqHandler_GaccumLikeSendComplete;
req->dev.OnDataAvail = MPIDI_CH3_ReqHandler_CASSendComplete;
/* here we increment the Active Target counter to guarantee the GET-like
operation are completed when counter reaches zero. */
......@@ -1081,7 +1081,7 @@ int MPIDI_CH3_PktHandler_FOP(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt,
(it is initialized to NULL by lower layer) */
resp_req->dev.target_win_handle = fop_pkt->target_win_handle;
resp_req->dev.flags = fop_pkt->flags;
resp_req->dev.OnDataAvail = MPIDI_CH3_ReqHandler_GaccumLikeSendComplete;
resp_req->dev.OnDataAvail = MPIDI_CH3_ReqHandler_FOPSendComplete;
/* here we increment the Active Target counter to guarantee the GET-like
operation are completed when counter reaches zero. */
......
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