Skip to content

Commit

Permalink
typerep/yaksa: remove nolonger used fastpath_memcpy
Browse files Browse the repository at this point in the history
The checking of pointer attributes and datatype now is done in the main
code.
  • Loading branch information
hzhou committed Mar 9, 2021
1 parent 340e17d commit 219a91c
Showing 1 changed file with 0 additions and 59 deletions.
59 changes: 0 additions & 59 deletions src/mpi/datatype/typerep/src/typerep_yaksa_pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,65 +57,6 @@ typedef enum {
MEMCPY_DIR__UNPACK,
} memcpy_dir_e;

static inline bool fastpath_memcpy(const void *inbuf, void *outbuf, MPI_Datatype type,
MPI_Aint count, MPI_Aint offset, MPI_Aint max_bytes,
MPI_Aint * actual_bytes, memcpy_dir_e dir)
{
bool ret = false;

/* special case builtin types, over other contiguous types, to
* avoid the three pointer dereferences (for is_contig, size and
* true_lb) into the MPIR_Datatype structure */
if (HANDLE_IS_BUILTIN(type)) {
MPL_pointer_attr_t inattr, outattr;
MPIR_GPU_query_pointer_attr(inbuf, &inattr);
MPIR_GPU_query_pointer_attr(outbuf, &outattr);

if ((inattr.type == MPL_GPU_POINTER_UNREGISTERED_HOST ||
inattr.type == MPL_GPU_POINTER_REGISTERED_HOST) &&
(outattr.type == MPL_GPU_POINTER_UNREGISTERED_HOST ||
outattr.type == MPL_GPU_POINTER_REGISTERED_HOST)) {
MPI_Aint size = MPIR_Datatype_get_basic_size(type);
*actual_bytes = MPL_MIN(count * size - offset, max_bytes);
if (dir == MEMCPY_DIR__PACK)
MPIR_Memcpy(outbuf, (const char *) inbuf + offset, *actual_bytes);
else
MPIR_Memcpy((char *) outbuf + offset, inbuf, *actual_bytes);
ret = true;
}
} else {
MPIR_Datatype *dtp;
MPIR_Datatype_get_ptr(type, dtp);

if (dtp->is_contig) {
MPL_pointer_attr_t inattr, outattr;

if (dir == MEMCPY_DIR__PACK) {
MPIR_GPU_query_pointer_attr((const char *) inbuf + dtp->true_lb + offset, &inattr);
MPIR_GPU_query_pointer_attr(outbuf, &outattr);
} else {
MPIR_GPU_query_pointer_attr(inbuf, &inattr);
MPIR_GPU_query_pointer_attr((char *) outbuf + dtp->true_lb + offset, &outattr);
}

if ((inattr.type == MPL_GPU_POINTER_UNREGISTERED_HOST ||
inattr.type == MPL_GPU_POINTER_REGISTERED_HOST) &&
(outattr.type == MPL_GPU_POINTER_UNREGISTERED_HOST ||
outattr.type == MPL_GPU_POINTER_REGISTERED_HOST)) {
*actual_bytes = MPL_MIN(count * dtp->size - offset, max_bytes);
if (dir == MEMCPY_DIR__PACK)
MPIR_Memcpy(outbuf, (const char *) inbuf + dtp->true_lb + offset,
*actual_bytes);
else
MPIR_Memcpy((char *) outbuf + dtp->true_lb + offset, inbuf, *actual_bytes);
ret = true;
}
}
}

return ret;
}

int MPIR_Typerep_pack(const void *inbuf, MPI_Aint incount, MPI_Datatype datatype,
MPI_Aint inoffset, void *outbuf, MPI_Aint max_pack_bytes,
MPI_Aint * actual_pack_bytes)
Expand Down

0 comments on commit 219a91c

Please sign in to comment.