Skip to content

Remove all ops with 3 buffers #9867

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion ompi/debuggers/predefined_gap_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ int main(int argc, char **argv) {
GAP_CHECK("o_flags", test_op, o_flags, o_name, 1)
GAP_CHECK("o_f_to_c_index", test_op, o_f_to_c_index, o_flags, 1)
GAP_CHECK("o_func", test_op, o_func, o_f_to_c_index, 1)
GAP_CHECK("o_3buff_instrinsic", test_op, o_3buff_intrinsic, o_func, 1)

/* Test Predefined datatype sizes */
printf("=============================================\n");
Expand Down
13 changes: 0 additions & 13 deletions ompi/mca/op/avx/op_avx_component.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,15 +237,12 @@ avx_component_init_query(bool enable_progress_threads,

#if OMPI_MCA_OP_HAVE_AVX512
extern ompi_op_base_handler_fn_t ompi_op_avx_functions_avx512[OMPI_OP_BASE_FORTRAN_OP_MAX][OMPI_OP_BASE_TYPE_MAX];
extern ompi_op_base_3buff_handler_fn_t ompi_op_avx_3buff_functions_avx512[OMPI_OP_BASE_FORTRAN_OP_MAX][OMPI_OP_BASE_TYPE_MAX];
#endif
#if OMPI_MCA_OP_HAVE_AVX2
extern ompi_op_base_handler_fn_t ompi_op_avx_functions_avx2[OMPI_OP_BASE_FORTRAN_OP_MAX][OMPI_OP_BASE_TYPE_MAX];
extern ompi_op_base_3buff_handler_fn_t ompi_op_avx_3buff_functions_avx2[OMPI_OP_BASE_FORTRAN_OP_MAX][OMPI_OP_BASE_TYPE_MAX];
#endif
#if OMPI_MCA_OP_HAVE_AVX
extern ompi_op_base_handler_fn_t ompi_op_avx_functions_avx[OMPI_OP_BASE_FORTRAN_OP_MAX][OMPI_OP_BASE_TYPE_MAX];
extern ompi_op_base_3buff_handler_fn_t ompi_op_avx_3buff_functions_avx[OMPI_OP_BASE_FORTRAN_OP_MAX][OMPI_OP_BASE_TYPE_MAX];
#endif
/*
* Query whether this component can be used for a specific op
Expand Down Expand Up @@ -274,35 +271,25 @@ avx_component_op_query(struct ompi_op_t *op, int *priority)
#if OMPI_MCA_OP_HAVE_AVX512
if( mca_op_avx_component.flags & OMPI_OP_AVX_HAS_AVX512F_FLAG ) {
module->opm_fns[i] = ompi_op_avx_functions_avx512[op->o_f_to_c_index][i];
module->opm_3buff_fns[i] = ompi_op_avx_3buff_functions_avx512[op->o_f_to_c_index][i];
}
#endif
#if OMPI_MCA_OP_HAVE_AVX2
if( mca_op_avx_component.flags & OMPI_OP_AVX_HAS_AVX2_FLAG ) {
if( NULL == module->opm_fns[i] ) {
module->opm_fns[i] = ompi_op_avx_functions_avx2[op->o_f_to_c_index][i];
}
if( NULL == module->opm_3buff_fns[i] ) {
module->opm_3buff_fns[i] = ompi_op_avx_3buff_functions_avx2[op->o_f_to_c_index][i];
}
}
#endif
#if OMPI_MCA_OP_HAVE_AVX
if( mca_op_avx_component.flags & OMPI_OP_AVX_HAS_AVX_FLAG ) {
if( NULL == module->opm_fns[i] ) {
module->opm_fns[i] = ompi_op_avx_functions_avx[op->o_f_to_c_index][i];
}
if( NULL == module->opm_3buff_fns[i] ) {
module->opm_3buff_fns[i] = ompi_op_avx_3buff_functions_avx[op->o_f_to_c_index][i];
}
}
#endif
if( NULL != module->opm_fns[i] ) {
OBJ_RETAIN(module);
}
if( NULL != module->opm_3buff_fns[i] ) {
OBJ_RETAIN(module);
}
}
break;
case OMPI_OP_BASE_FORTRAN_LAND:
Expand Down
649 changes: 0 additions & 649 deletions ompi/mca/op/avx/op_avx_functions.c

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions ompi/mca/op/base/functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ BEGIN_C_DECLS
*/
OMPI_DECLSPEC extern ompi_op_base_handler_fn_t
ompi_op_base_functions[OMPI_OP_BASE_FORTRAN_OP_MAX][OMPI_OP_BASE_TYPE_MAX];
OMPI_DECLSPEC extern ompi_op_base_3buff_handler_fn_t
ompi_op_base_3buff_functions[OMPI_OP_BASE_FORTRAN_OP_MAX][OMPI_OP_BASE_TYPE_MAX];

END_C_DECLS

Expand Down
2 changes: 0 additions & 2 deletions ompi/mca/op/base/op_base_frame.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,13 @@ static void module_constructor(ompi_op_base_module_t *m)
m->opm_enable = NULL;
m->opm_op = NULL;
memset(&(m->opm_fns), 0, sizeof(m->opm_fns));
memset(&(m->opm_3buff_fns), 0, sizeof(m->opm_3buff_fns));
}

static void module_constructor_1_0_0(ompi_op_base_module_1_0_0_t *m)
{
m->opm_enable = NULL;
m->opm_op = NULL;
memset(&(m->opm_fns), 0, sizeof(m->opm_fns));
memset(&(m->opm_3buff_fns), 0, sizeof(m->opm_3buff_fns));
}

OBJ_CLASS_INSTANCE(ompi_op_base_module_t, opal_object_t,
Expand Down
86 changes: 0 additions & 86 deletions ompi/mca/op/base/op_base_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -1632,89 +1632,3 @@ ompi_op_base_handler_fn_t ompi_op_base_functions[OMPI_OP_BASE_FORTRAN_OP_MAX][OM

};


ompi_op_base_3buff_handler_fn_t ompi_op_base_3buff_functions[OMPI_OP_BASE_FORTRAN_OP_MAX][OMPI_OP_BASE_TYPE_MAX] =
{
/* Corresponds to MPI_OP_NULL */
[OMPI_OP_BASE_FORTRAN_NULL] = {
/* Leaving this empty puts in NULL for all entries */
NULL,
},
/* Corresponds to MPI_MAX */
[OMPI_OP_BASE_FORTRAN_MAX] = {
C_INTEGER(max, 3buff),
FORTRAN_INTEGER(max, 3buff),
FLOATING_POINT(max, 3buff),
},
/* Corresponds to MPI_MIN */
[OMPI_OP_BASE_FORTRAN_MIN] = {
C_INTEGER(min, 3buff),
FORTRAN_INTEGER(min, 3buff),
FLOATING_POINT(min, 3buff),
},
/* Corresponds to MPI_SUM */
[OMPI_OP_BASE_FORTRAN_SUM] = {
C_INTEGER(sum, 3buff),
FORTRAN_INTEGER(sum, 3buff),
FLOATING_POINT(sum, 3buff),
COMPLEX(sum, 3buff),
},
/* Corresponds to MPI_PROD */
[OMPI_OP_BASE_FORTRAN_PROD] = {
C_INTEGER(prod, 3buff),
FORTRAN_INTEGER(prod, 3buff),
FLOATING_POINT(prod, 3buff),
COMPLEX(prod, 3buff),
},
/* Corresponds to MPI_LAND */
[OMPI_OP_BASE_FORTRAN_LAND] ={
C_INTEGER(land, 3buff),
LOGICAL(land, 3buff),
},
/* Corresponds to MPI_BAND */
[OMPI_OP_BASE_FORTRAN_BAND] = {
C_INTEGER(band, 3buff),
FORTRAN_INTEGER(band, 3buff),
BYTE(band, 3buff),
},
/* Corresponds to MPI_LOR */
[OMPI_OP_BASE_FORTRAN_LOR] = {
C_INTEGER(lor, 3buff),
LOGICAL(lor, 3buff),
},
/* Corresponds to MPI_BOR */
[OMPI_OP_BASE_FORTRAN_BOR] = {
C_INTEGER(bor, 3buff),
FORTRAN_INTEGER(bor, 3buff),
BYTE(bor, 3buff),
},
/* Corresponds to MPI_LXOR */
[OMPI_OP_BASE_FORTRAN_LXOR] = {
C_INTEGER(lxor, 3buff),
LOGICAL(lxor, 3buff),
},
/* Corresponds to MPI_BXOR */
[OMPI_OP_BASE_FORTRAN_BXOR] = {
C_INTEGER(bxor, 3buff),
FORTRAN_INTEGER(bxor, 3buff),
BYTE(bxor, 3buff),
},
/* Corresponds to MPI_MAXLOC */
[OMPI_OP_BASE_FORTRAN_MAXLOC] = {
TWOLOC(maxloc, 3buff),
},
/* Corresponds to MPI_MINLOC */
[OMPI_OP_BASE_FORTRAN_MINLOC] = {
TWOLOC(minloc, 3buff),
},
/* Corresponds to MPI_REPLACE */
[OMPI_OP_BASE_FORTRAN_REPLACE] = {
/* MPI_ACCUMULATE is handled differently than the other
reductions, so just zero out its function
impementations here to ensure that users don't invoke
MPI_REPLACE with any reduction operations other than
ACCUMULATE */
NULL,
},
};

19 changes: 2 additions & 17 deletions ompi/mca/op/base/op_base_op_select.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,11 @@ int ompi_op_base_op_select(ompi_op_t *op)
indicating that these are base functions with no corresponding
module. */
memset(&op->o_func, 0, sizeof(op->o_func));
memset(&op->o_3buff_intrinsic, 0, sizeof(op->o_3buff_intrinsic));
for (i = 0; i < OMPI_OP_BASE_TYPE_MAX; ++i) {
op->o_func.intrinsic.fns[i] =
ompi_op_base_functions[op->o_f_to_c_index][i];
op->o_func.intrinsic.modules[i] = module;
OBJ_RETAIN(module);
op->o_3buff_intrinsic.fns[i] =
ompi_op_base_3buff_functions[op->o_f_to_c_index][i];
op->o_3buff_intrinsic.modules[i] = module;
OBJ_RETAIN(module);
}

/* Offset the initial OBJ_NEW */
Expand Down Expand Up @@ -160,15 +155,6 @@ int ompi_op_base_op_select(ompi_op_t *op)
op->o_func.intrinsic.modules[i] = avail->ao_module;
OBJ_RETAIN(avail->ao_module);
}

/* 3-buffer variants */
if (NULL != avail->ao_module->opm_3buff_fns[i]) {
OBJ_RELEASE(op->o_func.intrinsic.modules[i]);
op->o_3buff_intrinsic.fns[i] =
avail->ao_module->opm_3buff_fns[i];
op->o_3buff_intrinsic.modules[i] = avail->ao_module;
OBJ_RETAIN(avail->ao_module);
}
}

/* release the original module reference and the list item */
Expand All @@ -181,9 +167,8 @@ int ompi_op_base_op_select(ompi_op_t *op)

/* Sanity check: for intrinsic MPI_Ops, we should have exactly the
same pointers non-NULL as the corresponding initial table row
in ompi_op_base_functions / ompi_op_base_3buff_functions. The
values may be different, of course, but the pattern of
NULL/non-NULL should be exactly the same. */
in ompi_op_base_functions. The values may be different, of course,
but the pattern of NULL/non-NULL should be exactly the same. */
for (i = 0; i < OMPI_OP_BASE_TYPE_MAX; ++i) {
if ((NULL == ompi_op_base_functions[op->o_f_to_c_index][i] &&
NULL != op->o_func.intrinsic.fns[i]) ||
Expand Down
24 changes: 0 additions & 24 deletions ompi/mca/op/op.h
Original file line number Diff line number Diff line change
Expand Up @@ -266,17 +266,6 @@ typedef void (*ompi_op_base_handler_fn_1_0_0_t)(const void *, void *, int *,

typedef ompi_op_base_handler_fn_1_0_0_t ompi_op_base_handler_fn_t;

/*
* Typedef for 3-buffer (two input and one output) op functions.
*/
typedef void (*ompi_op_base_3buff_handler_fn_1_0_0_t)(const void *,
const void *,
void *, int *,
struct ompi_datatype_t **,
struct ompi_op_base_module_1_0_0_t *);

typedef ompi_op_base_3buff_handler_fn_1_0_0_t ompi_op_base_3buff_handler_fn_t;

/**
* Op component initialization
*
Expand Down Expand Up @@ -379,7 +368,6 @@ typedef struct ompi_op_base_module_1_0_0_t {
/** Function pointers for all the different datatypes to be used
with the MPI_Op that this module is used with */
ompi_op_base_handler_fn_1_0_0_t opm_fns[OMPI_OP_BASE_TYPE_MAX];
ompi_op_base_3buff_handler_fn_1_0_0_t opm_3buff_fns[OMPI_OP_BASE_TYPE_MAX];
} ompi_op_base_module_1_0_0_t;

/**
Expand All @@ -404,18 +392,6 @@ typedef struct ompi_op_base_op_fns_1_0_0_t {

typedef ompi_op_base_op_fns_1_0_0_t ompi_op_base_op_fns_t;

/**
* Struct that is used in op.h to hold all the function pointers and
* pointers to the corresopnding modules (so that we can properly
* RETAIN/RELEASE them)
*/
typedef struct ompi_op_base_op_3buff_fns_1_0_0_t {
ompi_op_base_3buff_handler_fn_1_0_0_t fns[OMPI_OP_BASE_TYPE_MAX];
ompi_op_base_module_t *modules[OMPI_OP_BASE_TYPE_MAX];
} ompi_op_base_op_3buff_fns_1_0_0_t;

typedef ompi_op_base_op_3buff_fns_1_0_0_t ompi_op_base_op_3buff_fns_t;

/*
* Macro for use in modules that are of type op v2.0.0
*/
Expand Down
7 changes: 0 additions & 7 deletions ompi/op/op.c
Original file line number Diff line number Diff line change
Expand Up @@ -460,8 +460,6 @@ static void ompi_op_construct(ompi_op_t *new_op)
for (i = 0; i < OMPI_OP_BASE_TYPE_MAX; ++i) {
new_op->o_func.intrinsic.fns[i] = NULL;
new_op->o_func.intrinsic.modules[i] = NULL;
new_op->o_3buff_intrinsic.fns[i] = NULL;
new_op->o_3buff_intrinsic.modules[i] = NULL;
}
}

Expand All @@ -488,10 +486,5 @@ static void ompi_op_destruct(ompi_op_t *op)
OBJ_RELEASE(op->o_func.intrinsic.modules[i]);
op->o_func.intrinsic.modules[i] = NULL;
}
op->o_3buff_intrinsic.fns[i] = NULL;
if( NULL != op->o_3buff_intrinsic.modules[i] ) {
OBJ_RELEASE(op->o_3buff_intrinsic.modules[i]);
op->o_3buff_intrinsic.modules[i] = NULL;
}
}
}
55 changes: 0 additions & 55 deletions ompi/op/op.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,6 @@ struct ompi_op_t {
int baseType;
} java_data;
} o_func;

/** 3-buffer functions, which is only for intrinsic ops. No need
for the C/C++/Fortran user-defined functions. */
ompi_op_base_op_3buff_fns_t o_3buff_intrinsic;
};

/**
Expand Down Expand Up @@ -602,57 +598,6 @@ static inline void ompi_op_reduce(ompi_op_t * op, void *source,
return;
}

static inline void ompi_3buff_op_user (ompi_op_t *op, void * restrict source1, void * restrict source2,
void * restrict result, int count, struct ompi_datatype_t *dtype)
{
ompi_datatype_copy_content_same_ddt (dtype, count, result, source1);
op->o_func.c_fn (source2, result, &count, &dtype);
}

/**
* Perform a reduction operation.
*
* @param op The operation (IN)
* @param source Source1 (input) buffer (IN)
* @param source Source2 (input) buffer (IN)
* @param target Target (output) buffer (IN/OUT)
* @param count Number of elements (IN)
* @param dtype MPI datatype (IN)
*
* @returns void As with MPI user-defined reduction functions, there
* is no return code from this function.
*
* Perform a reduction operation with count elements of type dtype in
* the buffers source and target. The target buffer obtains the
* result (i.e., the original values in the target buffer are reduced
* with the values in the source buffer and the result is stored in
* the target buffer).
*
* This function will *only* be invoked on intrinsic MPI_Ops.
*
* Otherwise, this function is the same as ompi_op_reduce.
*/
static inline void ompi_3buff_op_reduce(ompi_op_t * op, void *source1,
void *source2, void *target,
int count, ompi_datatype_t * dtype)
{
void *restrict src1;
void *restrict src2;
void *restrict tgt;
src1 = source1;
src2 = source2;
tgt = target;

if (OPAL_LIKELY(ompi_op_is_intrinsic (op))) {
op->o_3buff_intrinsic.fns[ompi_op_ddt_map[dtype->id]](src1, src2,
tgt, &count,
&dtype,
op->o_3buff_intrinsic.modules[ompi_op_ddt_map[dtype->id]]);
} else {
ompi_3buff_op_user (op, src1, src2, tgt, count, dtype);
}
}

END_C_DECLS

#endif /* OMPI_OP_H */