Commit 3a05784f authored by Xin Zhao's avatar Xin Zhao
Browse files

Use int instead of size_t in RMA pkt header.

Use int instead of size_t in RMA pkt header to reduce
packet size.

No reviewer.
parent cc158ff2
......@@ -347,7 +347,7 @@ static int issue_put_op(MPIDI_RMA_Op_t * rma_op, MPID_Win *win_ptr,
MPID_Datatype_get_size_macro(rma_op->origin_datatype, origin_type_size);
MPIU_Assign_trunc(len, rma_op->origin_count * origin_type_size, size_t);
if (len == put_pkt->immed_len) {
if (len == (size_t)put_pkt->immed_len) {
/* All origin data is in packet header, issue the header. */
MPIU_THREAD_CS_ENTER(CH3COMM, vc);
mpi_errno = MPIDI_CH3_iStartMsg(vc, put_pkt, sizeof(*put_pkt), &(rma_op->request));
......@@ -408,7 +408,7 @@ static int issue_acc_op(MPIDI_RMA_Op_t *rma_op, MPID_Win *win_ptr,
MPID_Datatype_get_size_macro(rma_op->origin_datatype, origin_type_size);
MPIU_Assign_trunc(len, rma_op->origin_count * origin_type_size, size_t);
if (len == accum_pkt->immed_len) {
if (len == (size_t)accum_pkt->immed_len) {
/* All origin data is in packet header, issue the header. */
MPIU_THREAD_CS_ENTER(CH3COMM, vc);
mpi_errno = MPIDI_CH3_iStartMsg(vc, accum_pkt, sizeof(*accum_pkt), &(rma_op->request));
......@@ -493,7 +493,7 @@ static int issue_get_acc_op(MPIDI_RMA_Op_t *rma_op, MPID_Win *win_ptr,
MPID_Datatype_get_size_macro(rma_op->origin_datatype, origin_type_size);
MPIU_Assign_trunc(len, rma_op->origin_count * origin_type_size, size_t);
if (len == get_accum_pkt->immed_len) {
if (len == (size_t)get_accum_pkt->immed_len) {
/* All origin data is in packet header, issue the header. */
MPIU_THREAD_CS_ENTER(CH3COMM, vc);
mpi_errno = MPIDI_CH3_iStartMsg(vc, get_accum_pkt, sizeof(*get_accum_pkt), &(rma_op->request));
......
......@@ -444,7 +444,7 @@ typedef struct MPIDI_CH3_Pkt_put {
int lock_type;
int origin_rank;
/* Followings are to piggyback IMMED data */
size_t immed_len;
int immed_len;
char data[MPIDI_RMA_IMMED_BYTES];
} MPIDI_CH3_Pkt_put_t;
......@@ -481,7 +481,7 @@ typedef struct MPIDI_CH3_Pkt_accum {
int lock_type;
int origin_rank;
/* Followings are to piggyback IMMED data */
size_t immed_len;
int immed_len;
char data[MPIDI_RMA_IMMED_BYTES];
} MPIDI_CH3_Pkt_accum_t;
......@@ -503,7 +503,7 @@ typedef struct MPIDI_CH3_Pkt_get_accum {
int lock_type;
int origin_rank;
/* Followings are to piggback IMMED data */
size_t immed_len;
int immed_len;
char data[MPIDI_RMA_IMMED_BYTES];
} MPIDI_CH3_Pkt_get_accum_t;
......@@ -561,7 +561,7 @@ typedef struct MPIDI_CH3_Pkt_get_resp {
MPI_Win source_win_handle;
int target_rank;
/* Followings are to piggyback IMMED data */
size_t immed_len;
int immed_len;
char data[MPIDI_RMA_IMMED_BYTES];
} MPIDI_CH3_Pkt_get_resp_t;
......@@ -575,7 +575,7 @@ typedef struct MPIDI_CH3_Pkt_get_accum_resp {
MPI_Win source_win_handle;
int target_rank;
/* Followings are to piggyback IMMED data */
size_t immed_len;
int immed_len;
char data[MPIDI_RMA_IMMED_BYTES];
} MPIDI_CH3_Pkt_get_accum_resp_t;
......
......@@ -255,7 +255,7 @@ static inline int enqueue_lock_origin(MPID_Win *win_ptr, MPIDI_VC_t *vc,
MPID_Request *req = NULL;
MPI_Datatype target_dtp;
int target_count;
size_t immed_len = 0;
int immed_len = 0;
void *immed_data = NULL;
int complete = 0;
MPIDI_msg_sz_t data_len;
......@@ -302,7 +302,7 @@ static inline int enqueue_lock_origin(MPID_Win *win_ptr, MPIDI_VC_t *vc,
if (immed_len > 0) {
/* see if we can receive some data from packet header */
MPIU_Memcpy(req->dev.user_buf, immed_data, immed_len);
MPIU_Memcpy(req->dev.user_buf, immed_data, (size_t)immed_len);
req->dev.user_buf = (void*)((char*)req->dev.user_buf + immed_len);
req->dev.recv_data_sz -= immed_len;
}
......
......@@ -287,18 +287,18 @@ int MPIDI_CH3_ReqHandler_GaccumRecvComplete( MPIDI_VC_t *vc,
/* Try to copy target data into packet header. */
MPIU_Assign_trunc(get_accum_resp_pkt->immed_len,
MPIR_MIN(len, (MPIDI_RMA_IMMED_BYTES / type_size) * type_size),
size_t);
int);
if (get_accum_resp_pkt->immed_len > 0) {
void *src = resp_req->dev.user_buf;
void *dest = (void*) get_accum_resp_pkt->data;
/* copy data from origin buffer to immed area in packet header */
mpi_errno = immed_copy(src, dest, get_accum_resp_pkt->immed_len);
mpi_errno = immed_copy(src, dest, (size_t)get_accum_resp_pkt->immed_len);
if (mpi_errno != MPI_SUCCESS) MPIU_ERR_POP(mpi_errno);
}
}
if (len == get_accum_resp_pkt->immed_len) {
if (len == (size_t)get_accum_resp_pkt->immed_len) {
/* All origin data is in packet header, issue the header. */
iov[0].MPID_IOV_BUF = (MPID_IOV_BUF_CAST) get_accum_resp_pkt;
iov[0].MPID_IOV_LEN = sizeof(*get_accum_resp_pkt);
......@@ -914,18 +914,18 @@ static inline int perform_get_in_lock_queue(MPID_Win *win_ptr, MPIDI_Win_lock_qu
/* Try to copy target data into packet header. */
MPIU_Assign_trunc(get_resp_pkt->immed_len,
MPIR_MIN(len, (MPIDI_RMA_IMMED_BYTES / type_size) * type_size),
size_t);
int);
if (get_resp_pkt->immed_len > 0) {
void *src = get_pkt->addr;
void *dest = (void*) get_resp_pkt->data;
/* copy data from origin buffer to immed area in packet header */
mpi_errno = immed_copy(src, dest, get_resp_pkt->immed_len);
mpi_errno = immed_copy(src, dest, (size_t)get_resp_pkt->immed_len);
if (mpi_errno != MPI_SUCCESS) MPIU_ERR_POP(mpi_errno);
}
}
if (len == get_resp_pkt->immed_len) {
if (len == (size_t)get_resp_pkt->immed_len) {
/* All origin data is in packet header, issue the header. */
iov[0].MPID_IOV_BUF = (MPID_IOV_BUF_CAST) get_resp_pkt;
iov[0].MPID_IOV_LEN = sizeof(*get_resp_pkt);
......@@ -1066,18 +1066,18 @@ static inline int perform_get_acc_in_lock_queue(MPID_Win *win_ptr, MPIDI_Win_loc
/* Try to copy target data into packet header. */
MPIU_Assign_trunc(get_accum_resp_pkt->immed_len,
MPIR_MIN(len, (MPIDI_RMA_IMMED_BYTES / type_size) * type_size),
size_t);
int);
if (get_accum_resp_pkt->immed_len > 0) {
void *src = sreq->dev.user_buf;
void *dest = (void*) get_accum_resp_pkt->data;
/* copy data from origin buffer to immed area in packet header */
mpi_errno = immed_copy(src, dest, get_accum_resp_pkt->immed_len);
mpi_errno = immed_copy(src, dest, (size_t)get_accum_resp_pkt->immed_len);
if (mpi_errno != MPI_SUCCESS) MPIU_ERR_POP(mpi_errno);
}
}
if (len == get_accum_resp_pkt->immed_len) {
if (len == (size_t)get_accum_resp_pkt->immed_len) {
/* All origin data is in packet header, issue the header. */
iov[0].MPID_IOV_BUF = (MPID_IOV_BUF_CAST) get_accum_resp_pkt;
iov[0].MPID_IOV_LEN = sizeof(*get_accum_resp_pkt);
......@@ -1156,7 +1156,7 @@ static inline int perform_fop_in_lock_queue(MPID_Win *win_ptr, MPIDI_Win_lock_qu
/* copy data to resp pkt header */
void *src = fop_pkt->addr, *dest = fop_resp_pkt->data;
mpi_errno = immed_copy(src, dest, fop_resp_pkt->immed_len);
mpi_errno = immed_copy(src, dest, (size_t)fop_resp_pkt->immed_len);
if (mpi_errno != MPI_SUCCESS) MPIU_ERR_POP(mpi_errno);
/* Apply the op */
......
......@@ -186,12 +186,12 @@ int MPIDI_CH3I_Put(const void *origin_addr, int origin_count, MPI_Datatype
/* length of origin data that can fit into immed area in pkt header */
MPIU_Assign_trunc(put_pkt->immed_len,
MPIR_MIN(len, (MPIDI_RMA_IMMED_BYTES / origin_type_size) * origin_type_size),
size_t);
int);
if (put_pkt->immed_len > 0) {
void *src = new_ptr->origin_addr, *dest = put_pkt->data;
/* copy data from origin buffer to immed area in packet header */
mpi_errno = immed_copy(src, dest, put_pkt->immed_len);
mpi_errno = immed_copy(src, dest, (size_t)put_pkt->immed_len);
if (mpi_errno != MPI_SUCCESS) MPIU_ERR_POP(mpi_errno);
}
......@@ -536,12 +536,12 @@ int MPIDI_CH3I_Accumulate(const void *origin_addr, int origin_count, MPI_Datatyp
/* length of origin data that can fit into immed areas in packet header */
MPIU_Assign_trunc(accum_pkt->immed_len,
MPIR_MIN(len, (MPIDI_RMA_IMMED_BYTES / origin_type_size) * origin_type_size),
size_t);
int);
if (accum_pkt->immed_len > 0) {
void *src = new_ptr->origin_addr, *dest = accum_pkt->data;
/* copy data from origin buffer to immed area in packet header */
mpi_errno = immed_copy(src, dest, accum_pkt->immed_len);
mpi_errno = immed_copy(src, dest, (size_t)accum_pkt->immed_len);
if (mpi_errno != MPI_SUCCESS) MPIU_ERR_POP(mpi_errno);
}
......@@ -759,12 +759,12 @@ int MPIDI_CH3I_Get_accumulate(const void *origin_addr, int origin_count,
/* length of origin data that can fit into immed area in packet header */
MPIU_Assign_trunc(get_accum_pkt->immed_len,
MPIR_MIN(len, (MPIDI_RMA_IMMED_BYTES / origin_type_size) * origin_type_size),
size_t);
int);
if (get_accum_pkt->immed_len > 0) {
void *src = new_ptr->origin_addr, *dest = get_accum_pkt->data;
/* copy data from origin buffer to immed area in packet header */
mpi_errno = immed_copy(src, dest, get_accum_pkt->immed_len);
mpi_errno = immed_copy(src, dest, (size_t)get_accum_pkt->immed_len);
if (mpi_errno != MPI_SUCCESS) MPIU_ERR_POP(mpi_errno);
}
......@@ -1178,12 +1178,12 @@ int MPIDI_Fetch_and_op(const void *origin_addr, void *result_addr,
/* length of origin data that can fit into immed area in pkt header */
MPIU_Assign_trunc(fop_pkt->immed_len,
MPIR_MIN(len, (MPIDI_RMA_IMMED_BYTES / origin_type_size) * origin_type_size),
size_t);
int);
if (fop_pkt->immed_len > 0) {
void *src = new_ptr->origin_addr, *dest = fop_pkt->data;
/* copy data from origin buffer to immed area in packet header */
mpi_errno = immed_copy(src, dest, fop_pkt->immed_len);
mpi_errno = immed_copy(src, dest, (size_t)fop_pkt->immed_len);
if (mpi_errno != MPI_SUCCESS) MPIU_ERR_POP(mpi_errno);
}
}
......
......@@ -237,7 +237,7 @@ int MPIDI_CH3_PktHandler_Put(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt,
if (put_pkt->immed_len > 0) {
/* See if we can receive some data from packet header. */
MPIU_Memcpy(req->dev.user_buf, put_pkt->data, put_pkt->immed_len);
MPIU_Memcpy(req->dev.user_buf, put_pkt->data, (size_t)put_pkt->immed_len);
req->dev.user_buf = (void*)((char*)req->dev.user_buf + put_pkt->immed_len);
req->dev.recv_data_sz -= put_pkt->immed_len;
}
......@@ -426,18 +426,18 @@ int MPIDI_CH3_PktHandler_Get(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt,
/* Try to copy target data into packet header. */
MPIU_Assign_trunc(get_resp_pkt->immed_len,
MPIR_MIN(len, (MPIDI_RMA_IMMED_BYTES / type_size) * type_size),
size_t);
int);
if (get_resp_pkt->immed_len > 0) {
void *src = get_pkt->addr;
void *dest = (void*) get_resp_pkt->data;
/* copy data from origin buffer to immed area in packet header */
mpi_errno = immed_copy(src, dest, get_resp_pkt->immed_len);
mpi_errno = immed_copy(src, dest, (size_t)get_resp_pkt->immed_len);
if (mpi_errno != MPI_SUCCESS) MPIU_ERR_POP(mpi_errno);
}
}
if (len == get_resp_pkt->immed_len) {
if (len == (size_t)get_resp_pkt->immed_len) {
/* All origin data is in packet header, issue the header. */
iov[0].MPID_IOV_BUF = (MPID_IOV_BUF_CAST) get_resp_pkt;
iov[0].MPID_IOV_LEN = sizeof(*get_resp_pkt);
......@@ -608,7 +608,7 @@ int MPIDI_CH3_PktHandler_Accumulate(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt,
if (accum_pkt->immed_len > 0) {
/* See if we can receive some data from packet header. */
MPIU_Memcpy(req->dev.user_buf, accum_pkt->data, accum_pkt->immed_len);
MPIU_Memcpy(req->dev.user_buf, accum_pkt->data, (size_t)accum_pkt->immed_len);
req->dev.user_buf = (void*)((char*)req->dev.user_buf + accum_pkt->immed_len);
req->dev.recv_data_sz -= accum_pkt->immed_len;
}
......@@ -783,7 +783,7 @@ int MPIDI_CH3_PktHandler_GetAccumulate(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt,
if (get_accum_pkt->immed_len > 0) {
/* See if we can receive some data from packet header. */
MPIU_Memcpy(req->dev.user_buf, get_accum_pkt->data, get_accum_pkt->immed_len);
MPIU_Memcpy(req->dev.user_buf, get_accum_pkt->data, (size_t)get_accum_pkt->immed_len);
req->dev.user_buf = (void*)((char*)req->dev.user_buf + get_accum_pkt->immed_len);
req->dev.recv_data_sz -= get_accum_pkt->immed_len;
}
......@@ -1102,7 +1102,7 @@ int MPIDI_CH3_PktHandler_FOP(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt,
/* copy data to resp pkt header */
void *src = fop_pkt->addr, *dest = fop_resp_pkt->data;
mpi_errno = immed_copy(src, dest, fop_resp_pkt->immed_len);
mpi_errno = immed_copy(src, dest, (size_t)fop_resp_pkt->immed_len);
if (mpi_errno != MPI_SUCCESS) MPIU_ERR_POP(mpi_errno);
/* Apply the op */
......@@ -1182,7 +1182,7 @@ int MPIDI_CH3_PktHandler_FOPResp(MPIDI_VC_t * vc ATTRIBUTE((unused)),
/* Copy data to result buffer on orgin */
MPID_Request_get_ptr(fop_resp_pkt->request_handle, req);
MPIU_Memcpy(req->dev.user_buf, fop_resp_pkt->data, fop_resp_pkt->immed_len);
MPIU_Memcpy(req->dev.user_buf, fop_resp_pkt->data, (size_t)fop_resp_pkt->immed_len);
/* decrement ack_counter */
if (fop_resp_pkt->flags & MPIDI_CH3_PKT_FLAG_RMA_LOCK_GRANTED) {
......@@ -1263,7 +1263,7 @@ int MPIDI_CH3_PktHandler_Get_AccumResp(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt,
if (get_accum_resp_pkt->immed_len > 0) {
/* first copy IMMED data from pkt header to origin buffer */
MPIU_Memcpy(req->dev.user_buf, get_accum_resp_pkt->data, get_accum_resp_pkt->immed_len);
MPIU_Memcpy(req->dev.user_buf, get_accum_resp_pkt->data, (size_t)get_accum_resp_pkt->immed_len);
req->dev.user_buf = (void*)((char*)req->dev.user_buf + get_accum_resp_pkt->immed_len);
req->dev.recv_data_sz -= get_accum_resp_pkt->immed_len;
if (req->dev.recv_data_sz == 0)
......@@ -1398,7 +1398,7 @@ int MPIDI_CH3_PktHandler_GetResp(MPIDI_VC_t * vc ATTRIBUTE((unused)),
if (get_resp_pkt->immed_len > 0) {
/* first copy IMMED data from pkt header to origin buffer */
MPIU_Memcpy(req->dev.user_buf, get_resp_pkt->data, get_resp_pkt->immed_len);
MPIU_Memcpy(req->dev.user_buf, get_resp_pkt->data, (size_t)get_resp_pkt->immed_len);
req->dev.user_buf = (void*)((char*)req->dev.user_buf + get_resp_pkt->immed_len);
req->dev.recv_data_sz -= get_resp_pkt->immed_len;
if (req->dev.recv_data_sz == 0)
......
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