Commit 299ede6e authored by Xin Zhao's avatar Xin Zhao Committed by Pavan Balaji
Browse files

Remove "is_dt" flag from op structure.



Originally we use is_dt flag stored in op structure
to track if derived datatypes are involved in the
current RMA operation. The flag is actually not
needed and we can directly check datatypes in the
current operation. Here we remove is_dt flag from
the op structure.
Signed-off-by: Pavan Balaji's avatarPavan Balaji <balaji@anl.gov>
parent 35a05b3c
......@@ -50,10 +50,12 @@ static inline MPIDI_RMA_Op_t *MPIDI_CH3I_Win_op_alloc(MPID_Win * win_ptr)
e->reqs = NULL;
e->reqs_size = 0;
e->ureq = NULL;
e->is_dt = 0;
e->piggyback_lock_candidate = 0;
e->issued_stream_count = 0;
e->origin_datatype = MPI_DATATYPE_NULL;
e->result_datatype = MPI_DATATYPE_NULL;
return e;
}
......
......@@ -70,7 +70,6 @@ typedef struct MPIDI_RMA_Op {
MPIDI_CH3_Pkt_t pkt;
MPIDI_RMA_Pool_type_t pool_type;
int is_dt;
int piggyback_lock_candidate;
int issued_stream_count; /* when >= 0, it specifies number of stream units that have been issued;
......
......@@ -640,9 +640,24 @@ static inline int adjust_op_piggybacked_with_lock(MPID_Win * win_ptr,
&(target->pending_op_list_tail), op);
}
else {
MPI_Datatype target_datatype;
int is_derived = FALSE;
MPIDI_CH3I_RMA_Ops_unlink(&(target->pending_op_list),
&(target->pending_op_list_tail), op);
if (op->is_dt) {
MPIDI_CH3_PKT_RMA_GET_TARGET_DATATYPE(op->pkt, target_datatype, mpi_errno);
if ((target_datatype != MPI_DATATYPE_NULL &&
!MPIR_DATATYPE_IS_PREDEFINED(target_datatype)) ||
(op->origin_datatype != MPI_DATATYPE_NULL &&
!MPIR_DATATYPE_IS_PREDEFINED(op->origin_datatype)) ||
(op->result_datatype != MPI_DATATYPE_NULL &&
!MPIR_DATATYPE_IS_PREDEFINED(op->result_datatype))) {
is_derived = TRUE;
}
if (is_derived) {
MPIDI_CH3I_RMA_Ops_append(&(target->dt_op_list),
&(target->dt_op_list_tail), op);
}
......
......@@ -145,12 +145,10 @@ int MPIDI_CH3I_Put(const void *origin_addr, int origin_count, MPI_Datatype
if (!MPIR_DATATYPE_IS_PREDEFINED(origin_datatype)) {
MPID_Datatype_get_ptr(origin_datatype, dtp);
MPID_Datatype_add_ref(dtp);
op_ptr->is_dt = 1;
}
if (!MPIR_DATATYPE_IS_PREDEFINED(target_datatype)) {
MPID_Datatype_get_ptr(target_datatype, dtp);
MPID_Datatype_add_ref(dtp);
op_ptr->is_dt = 1;
}
MPID_Datatype_is_contig(origin_datatype, &is_origin_contig);
......@@ -160,13 +158,15 @@ int MPIDI_CH3I_Put(const void *origin_addr, int origin_count, MPI_Datatype
MPIU_Assign_trunc(len, origin_count * origin_type_size, size_t);
/* Judge if we can use IMMED data packet */
if (!op_ptr->is_dt && is_origin_contig && is_target_contig) {
if (MPIR_DATATYPE_IS_PREDEFINED(origin_datatype) &&
MPIR_DATATYPE_IS_PREDEFINED(target_datatype) && is_origin_contig && is_target_contig) {
if (len <= MPIDI_RMA_IMMED_BYTES)
use_immed_pkt = TRUE;
}
/* Judge if this operation is an piggyback candidate */
if (!op_ptr->is_dt) {
if (MPIR_DATATYPE_IS_PREDEFINED(origin_datatype) &&
MPIR_DATATYPE_IS_PREDEFINED(target_datatype)) {
/* FIXME: currently we only piggyback LOCK flag with op using predefined datatypes
* for both origin and target data. We should extend this optimization to derived
* datatypes as well. */
......@@ -336,12 +336,10 @@ int MPIDI_CH3I_Get(void *origin_addr, int origin_count, MPI_Datatype
if (!MPIR_DATATYPE_IS_PREDEFINED(origin_datatype)) {
MPID_Datatype_get_ptr(origin_datatype, dtp);
MPID_Datatype_add_ref(dtp);
op_ptr->is_dt = 1;
}
if (!MPIR_DATATYPE_IS_PREDEFINED(target_datatype)) {
MPID_Datatype_get_ptr(target_datatype, dtp);
MPID_Datatype_add_ref(dtp);
op_ptr->is_dt = 1;
}
MPID_Datatype_is_contig(origin_datatype, &is_origin_contig);
......@@ -351,13 +349,15 @@ int MPIDI_CH3I_Get(void *origin_addr, int origin_count, MPI_Datatype
MPIU_Assign_trunc(len, target_count * target_type_size, size_t);
/* Judge if we can use IMMED data response packet */
if (!op_ptr->is_dt && is_origin_contig && is_target_contig) {
if (MPIR_DATATYPE_IS_PREDEFINED(origin_datatype) &&
MPIR_DATATYPE_IS_PREDEFINED(target_datatype) && is_origin_contig && is_target_contig) {
if (len <= MPIDI_RMA_IMMED_BYTES)
use_immed_resp_pkt = TRUE;
}
/* Judge if this operation is an piggyback candidate. */
if (!op_ptr->is_dt) {
if (MPIR_DATATYPE_IS_PREDEFINED(origin_datatype) &&
MPIR_DATATYPE_IS_PREDEFINED(target_datatype)) {
/* FIXME: currently we only piggyback LOCK flag with op using predefined datatypes
* for both origin and target data. We should extend this optimization to derived
* datatypes as well. */
......@@ -518,11 +518,9 @@ int MPIDI_CH3I_Accumulate(const void *origin_addr, int origin_count, MPI_Datatyp
* reference counts */
if (!MPIR_DATATYPE_IS_PREDEFINED(origin_datatype)) {
MPID_Datatype_get_ptr(origin_datatype, origin_dtp);
op_ptr->is_dt = 1;
}
if (!MPIR_DATATYPE_IS_PREDEFINED(target_datatype)) {
MPID_Datatype_get_ptr(target_datatype, target_dtp);
op_ptr->is_dt = 1;
}
MPID_Datatype_get_size_macro(origin_datatype, origin_type_size);
......@@ -562,13 +560,15 @@ int MPIDI_CH3I_Accumulate(const void *origin_addr, int origin_count, MPI_Datatyp
MPID_Datatype_is_contig(target_datatype, &is_target_contig);
/* Judge if we can use IMMED data packet */
if (!op_ptr->is_dt && is_origin_contig && is_target_contig) {
if (MPIR_DATATYPE_IS_PREDEFINED(origin_datatype) &&
MPIR_DATATYPE_IS_PREDEFINED(target_datatype) && is_origin_contig && is_target_contig) {
if (len <= MPIDI_RMA_IMMED_BYTES)
use_immed_pkt = TRUE;
}
/* Judge if this operation is an piggyback candidate. */
if (!op_ptr->is_dt) {
if (MPIR_DATATYPE_IS_PREDEFINED(origin_datatype) &&
MPIR_DATATYPE_IS_PREDEFINED(target_datatype)) {
/* FIXME: currently we only piggyback LOCK flag with op using predefined datatypes
* for both origin and target data. We should extend this optimization to derived
* datatypes as well. */
......@@ -746,12 +746,10 @@ int MPIDI_CH3I_Get_accumulate(const void *origin_addr, int origin_count,
if (!MPIR_DATATYPE_IS_PREDEFINED(result_datatype)) {
MPID_Datatype_get_ptr(result_datatype, dtp);
MPID_Datatype_add_ref(dtp);
op_ptr->is_dt = 1;
}
if (!MPIR_DATATYPE_IS_PREDEFINED(target_datatype)) {
MPID_Datatype_get_ptr(target_datatype, dtp);
MPID_Datatype_add_ref(dtp);
op_ptr->is_dt = 1;
}
MPID_Datatype_get_size_macro(target_datatype, target_type_size);
......@@ -761,13 +759,16 @@ int MPIDI_CH3I_Get_accumulate(const void *origin_addr, int origin_count,
MPID_Datatype_is_contig(target_datatype, &is_target_contig);
/* Judge if we can use IMMED data response packet */
if (!op_ptr->is_dt && is_result_contig && is_target_contig) {
if (MPIR_DATATYPE_IS_PREDEFINED(result_datatype) &&
MPIR_DATATYPE_IS_PREDEFINED(target_datatype) &&
is_result_contig && is_target_contig) {
if (len <= MPIDI_RMA_IMMED_BYTES)
use_immed_resp_pkt = TRUE;
}
/* Judge if this operation is a piggyback candidate */
if (!op_ptr->is_dt) {
if (MPIR_DATATYPE_IS_PREDEFINED(result_datatype) &&
MPIR_DATATYPE_IS_PREDEFINED(target_datatype)) {
/* FIXME: currently we only piggyback LOCK flag with op using predefined datatypes
* for both origin and target data. We should extend this optimization to derived
* datatypes as well. */
......@@ -817,15 +818,12 @@ int MPIDI_CH3I_Get_accumulate(const void *origin_addr, int origin_count,
* reference counts */
if (!MPIR_DATATYPE_IS_PREDEFINED(origin_datatype)) {
MPID_Datatype_get_ptr(origin_datatype, origin_dtp);
op_ptr->is_dt = 1;
}
if (!MPIR_DATATYPE_IS_PREDEFINED(result_datatype)) {
MPID_Datatype_get_ptr(result_datatype, target_dtp);
op_ptr->is_dt = 1;
}
if (!MPIR_DATATYPE_IS_PREDEFINED(target_datatype)) {
MPID_Datatype_get_ptr(target_datatype, result_dtp);
op_ptr->is_dt = 1;
}
MPID_Datatype_get_size_macro(origin_datatype, origin_type_size);
......@@ -869,13 +867,18 @@ int MPIDI_CH3I_Get_accumulate(const void *origin_addr, int origin_count,
MPID_Datatype_is_contig(result_datatype, &is_result_contig);
/* Judge if we can use IMMED data packet */
if (!op_ptr->is_dt && is_origin_contig && is_target_contig && is_result_contig) {
if (MPIR_DATATYPE_IS_PREDEFINED(origin_datatype) &&
MPIR_DATATYPE_IS_PREDEFINED(result_datatype) &&
MPIR_DATATYPE_IS_PREDEFINED(target_datatype) &&
is_origin_contig && is_target_contig && is_result_contig) {
if (orig_len <= MPIDI_RMA_IMMED_BYTES)
use_immed_pkt = TRUE;
}
/* Judge if this operation is a piggyback candidate */
if (!op_ptr->is_dt) {
if (MPIR_DATATYPE_IS_PREDEFINED(origin_datatype) &&
MPIR_DATATYPE_IS_PREDEFINED(result_datatype) &&
MPIR_DATATYPE_IS_PREDEFINED(target_datatype)) {
/* FIXME: currently we only piggyback LOCK flag with op using predefined datatypes
* for origin, target and result data. We should extend this optimization to derived
* datatypes as well. */
......
......@@ -409,11 +409,26 @@ static inline int issue_ops_target(MPID_Win * win_ptr, MPIDI_RMA_Target_t * targ
&(target->pending_op_list_tail), curr_op);
}
else {
MPI_Datatype target_datatype;
int is_derived = FALSE;
/* Sending is not completed immediately. */
MPIDI_CH3I_RMA_Ops_unlink(&(target->pending_op_list),
&(target->pending_op_list_tail), curr_op);
if (curr_op->is_dt) {
MPIDI_CH3_PKT_RMA_GET_TARGET_DATATYPE(curr_op->pkt, target_datatype, mpi_errno);
if ((target_datatype != MPI_DATATYPE_NULL &&
!MPIR_DATATYPE_IS_PREDEFINED(target_datatype)) ||
(curr_op->origin_datatype != MPI_DATATYPE_NULL &&
!MPIR_DATATYPE_IS_PREDEFINED(curr_op->origin_datatype)) ||
(curr_op->result_datatype != MPI_DATATYPE_NULL &&
!MPIR_DATATYPE_IS_PREDEFINED(curr_op->result_datatype))) {
is_derived = TRUE;
}
if (is_derived) {
MPIDI_CH3I_RMA_Ops_append(&(target->dt_op_list),
&(target->dt_op_list_tail), curr_op);
}
......
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