Skip to content
Merged
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
24 changes: 12 additions & 12 deletions opal/datatype/opal_convertor.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
* All rights reserved.
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
* Copyright (c) 2011 NVIDIA Corporation. All rights reserved.
* Copyright (c) 2013-2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2013-2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2017 Intel, Inc. All rights reserved
* $COPYRIGHT$
*
Expand Down Expand Up @@ -330,7 +330,7 @@ static inline int opal_convertor_create_stack_with_pos_contig( opal_convertor_t*
dt_stack_t* pStack; /* pointer to the position on the stack */
const opal_datatype_t* pData = pConvertor->pDesc;
dt_elem_desc_t* pElems;
uint32_t count;
size_t count;
ptrdiff_t extent;

pStack = pConvertor->pStack;
Expand All @@ -340,7 +340,7 @@ static inline int opal_convertor_create_stack_with_pos_contig( opal_convertor_t*
*/
pElems = pConvertor->use_desc->desc;

count = (uint32_t)(starting_point / pData->size);
count = starting_point / pData->size;
extent = pData->ub - pData->lb;

pStack[0].type = OPAL_DATATYPE_LOOP; /* the first one is always the loop */
Expand All @@ -349,7 +349,7 @@ static inline int opal_convertor_create_stack_with_pos_contig( opal_convertor_t*
pStack[0].disp = count * extent;

/* now compute the number of pending bytes */
count = (uint32_t)(starting_point - count * pData->size);
count = starting_point - count * pData->size;
/**
* We save the current displacement starting from the begining
* of this data.
Expand Down Expand Up @@ -563,7 +563,7 @@ size_t opal_convertor_compute_remote_size( opal_convertor_t* pConvertor )

int32_t opal_convertor_prepare_for_recv( opal_convertor_t* convertor,
const struct opal_datatype_t* datatype,
int32_t count,
size_t count,
const void* pUserBuf )
{
/* Here I should check that the data is not overlapping */
Expand Down Expand Up @@ -605,7 +605,7 @@ int32_t opal_convertor_prepare_for_recv( opal_convertor_t* convertor,

int32_t opal_convertor_prepare_for_send( opal_convertor_t* convertor,
const struct opal_datatype_t* datatype,
int32_t count,
size_t count,
const void* pUserBuf )
{
convertor->flags |= CONVERTOR_SEND;
Expand Down Expand Up @@ -699,11 +699,11 @@ int opal_convertor_clone( const opal_convertor_t* source,

void opal_convertor_dump( opal_convertor_t* convertor )
{
opal_output( 0, "Convertor %p count %d stack position %d bConverted %ld\n"
"\tlocal_size %ld remote_size %ld flags %X stack_size %d pending_length %d\n"
opal_output( 0, "Convertor %p count %" PRIsize_t" stack position %d bConverted %" PRIsize_t "\n"
"\tlocal_size %ld remote_size %ld flags %X stack_size %d pending_length %" PRIsize_t "\n"
"\tremote_arch %u local_arch %u\n",
(void*)convertor,
convertor->count, convertor->stack_pos, (unsigned long)convertor->bConverted,
convertor->count, convertor->stack_pos, convertor->bConverted,
(unsigned long)convertor->local_size, (unsigned long)convertor->remote_size,
convertor->flags, convertor->stack_size, convertor->partial_length,
convertor->remoteArch, opal_local_arch );
Expand Down Expand Up @@ -734,8 +734,8 @@ void opal_datatype_dump_stack( const dt_stack_t* pStack, int stack_pos,
{
opal_output( 0, "\nStack %p stack_pos %d name %s\n", (void*)pStack, stack_pos, name );
for( ; stack_pos >= 0; stack_pos-- ) {
opal_output( 0, "%d: pos %d count %d disp %ld ", stack_pos, pStack[stack_pos].index,
(int)pStack[stack_pos].count, (long)pStack[stack_pos].disp );
opal_output( 0, "%d: pos %d count %" PRIsize_t " disp %ld ", stack_pos, pStack[stack_pos].index,
pStack[stack_pos].count, pStack[stack_pos].disp );
if( pStack->index != -1 )
opal_output( 0, "\t[desc count %lu disp %ld extent %ld]\n",
(unsigned long)pDesc[pStack[stack_pos].index].elem.count,
Expand Down
28 changes: 16 additions & 12 deletions opal/datatype/opal_convertor.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
* All rights reserved.
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
* Copyright (c) 2014 NVIDIA Corporation. All rights reserved.
* Copyright (c) 2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2017-2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2017 Intel, Inc. All rights reserved
* $COPYRIGHT$
*
Expand Down Expand Up @@ -74,6 +74,7 @@ struct opal_convertor_master_t;
struct dt_stack_t {
int32_t index; /**< index in the element description */
int16_t type; /**< the type used for the last pack/unpack (original or OPAL_DATATYPE_UINT1) */
int16_t padding;
size_t count; /**< number of times we still have to do it */
ptrdiff_t disp; /**< actual displacement depending on the count field */
};
Expand All @@ -93,30 +94,33 @@ struct opal_convertor_t {
const opal_datatype_t* pDesc; /**< the datatype description associated with the convertor */
const dt_type_desc_t* use_desc; /**< the version used by the convertor (normal or optimized) */
opal_datatype_count_t count; /**< the total number of full datatype elements */

/* --- cacheline boundary (64 bytes - if 64bits arch and !OPAL_ENABLE_DEBUG) --- */
uint32_t stack_size; /**< size of the allocated stack */
/* --- cacheline 1 boundary (64 bytes) --- */
unsigned char* pBaseBuf; /**< initial buffer as supplied by the user */
dt_stack_t* pStack; /**< the local stack for the actual conversion */
convertor_advance_fct_t fAdvance; /**< pointer to the pack/unpack functions */

/* --- cacheline boundary (96 bytes - if 64bits arch and !OPAL_ENABLE_DEBUG) --- */
struct opal_convertor_master_t* master; /**< the master convertor */

/* All others fields get modified for every call to pack/unpack functions */
uint32_t stack_pos; /**< the actual position on the stack */
uint32_t partial_length; /**< amount of data left over from the last unpack */
size_t partial_length; /**< amount of data left over from the last unpack */
size_t bConverted; /**< # of bytes already converted */

/* --- cacheline boundary (128 bytes - if 64bits arch and !OPAL_ENABLE_DEBUG) --- */
uint32_t checksum; /**< checksum computed by pack/unpack operation */
uint32_t csum_ui1; /**< partial checksum computed by pack/unpack operation */
size_t csum_ui2; /**< partial checksum computed by pack/unpack operation */
/* --- cacheline 2 boundary (128 bytes) --- */

/* --- fields are no more aligned on cacheline --- */
dt_stack_t static_stack[DT_STATIC_STACK_SIZE]; /**< local stack for small datatypes */
/* --- cacheline 3 boundary (192 bytes) was 56 bytes ago --- */

#if OPAL_CUDA_SUPPORT
memcpy_fct_t cbmemcpy; /**< memcpy or cuMemcpy */
void * stream; /**< CUstream for async copy */
#endif
/* size: 248, cachelines: 4, members: 20 */
/* last cacheline: 56 bytes */
};
OPAL_DECLSPEC OBJ_CLASS_DECLARATION( opal_convertor_t );

Expand Down Expand Up @@ -251,12 +255,12 @@ static inline void opal_convertor_get_offset_pointer( const opal_convertor_t* pC
*/
OPAL_DECLSPEC int32_t opal_convertor_prepare_for_send( opal_convertor_t* convertor,
const struct opal_datatype_t* datatype,
int32_t count,
size_t count,
const void* pUserBuf);

static inline int32_t opal_convertor_copy_and_prepare_for_send( const opal_convertor_t* pSrcConv,
const struct opal_datatype_t* datatype,
int32_t count,
size_t count,
const void* pUserBuf,
int32_t flags,
opal_convertor_t* convertor )
Expand All @@ -273,11 +277,11 @@ static inline int32_t opal_convertor_copy_and_prepare_for_send( const opal_conve
*/
OPAL_DECLSPEC int32_t opal_convertor_prepare_for_recv( opal_convertor_t* convertor,
const struct opal_datatype_t* datatype,
int32_t count,
size_t count,
const void* pUserBuf );
static inline int32_t opal_convertor_copy_and_prepare_for_recv( const opal_convertor_t* pSrcConv,
const struct opal_datatype_t* datatype,
int32_t count,
size_t count,
const void* pUserBuf,
int32_t flags,
opal_convertor_t* convertor )
Expand Down
28 changes: 14 additions & 14 deletions opal/datatype/opal_convertor_raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ opal_convertor_raw( opal_convertor_t* pConvertor,
const opal_datatype_t *pData = pConvertor->pDesc;
dt_stack_t* pStack; /* pointer to the position on the stack */
uint32_t pos_desc; /* actual position in the description of the derived datatype */
uint32_t count_desc; /* the number of items already done in the actual pos_desc */
size_t count_desc; /* the number of items already done in the actual pos_desc */
dt_elem_desc_t* description, *pElem;
unsigned char *source_base; /* origin of the data */
size_t raw_data = 0; /* sum of raw data lengths in the iov_len fields */
uint32_t index = 0, i; /* the iov index and a simple counter */
uint32_t index = 0; /* the iov index and a simple counter */

assert( (*iov_count) > 0 );
if( OPAL_LIKELY(pConvertor->flags & CONVERTOR_COMPLETED) ) {
Expand Down Expand Up @@ -83,15 +83,15 @@ opal_convertor_raw( opal_convertor_t* pConvertor,
pStack = pConvertor->pStack + pConvertor->stack_pos;
pos_desc = pStack->index;
source_base = pConvertor->pBaseBuf + pStack->disp;
count_desc = (uint32_t)pStack->count;
count_desc = pStack->count;
pStack--;
pConvertor->stack_pos--;
pElem = &(description[pos_desc]);
source_base += pStack->disp;
DO_DEBUG( opal_output( 0, "raw start pos_desc %d count_desc %d disp %ld\n"
"stack_pos %d pos_desc %d count_desc %d disp %ld\n",
DO_DEBUG( opal_output( 0, "raw start pos_desc %d count_desc %" PRIsize_t " disp %ld\n"
"stack_pos %d pos_desc %d count_desc %" PRIsize_t " disp %ld\n",
pos_desc, count_desc, (long)(source_base - pConvertor->pBaseBuf),
pConvertor->stack_pos, pStack->index, (int)pStack->count, (long)pStack->disp ); );
pConvertor->stack_pos, pStack->index, pStack->count, (long)pStack->disp ); );
while( 1 ) {
while( pElem->elem.common.flags & OPAL_DATATYPE_FLAG_DATA ) {
size_t blength = opal_datatype_basicDatatypes[pElem->elem.common.type]->size;
Expand All @@ -112,7 +112,7 @@ opal_convertor_raw( opal_convertor_t* pConvertor,
count_desc = 0;
}
} else {
for( i = count_desc; (i > 0) && (index < *iov_count); i--, index++ ) {
for(size_t i = count_desc; (i > 0) && (index < *iov_count); i--, index++ ) {
OPAL_DATATYPE_SAFEGUARD_POINTER( source_base, blength, pConvertor->pBaseBuf,
pConvertor->pDesc, pConvertor->count );
DO_DEBUG( opal_output( 0, "raw 2. iov[%d] = {base %p, length %" PRIsize_t "}\n",
Expand All @@ -134,9 +134,9 @@ opal_convertor_raw( opal_convertor_t* pConvertor,
goto complete_loop;
}
if( OPAL_DATATYPE_END_LOOP == pElem->elem.common.type ) { /* end of the current loop */
DO_DEBUG( opal_output( 0, "raw end_loop count %d stack_pos %d"
DO_DEBUG( opal_output( 0, "raw end_loop count %" PRIsize_t " stack_pos %d"
" pos_desc %d disp %ld space %lu\n",
(int)pStack->count, pConvertor->stack_pos,
pStack->count, pConvertor->stack_pos,
pos_desc, (long)pStack->disp, (unsigned long)raw_data ); );
if( --(pStack->count) == 0 ) { /* end of loop */
if( pConvertor->stack_pos == 0 ) {
Expand All @@ -160,9 +160,9 @@ opal_convertor_raw( opal_convertor_t* pConvertor,
}
source_base = pConvertor->pBaseBuf + pStack->disp;
UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc );
DO_DEBUG( opal_output( 0, "raw new_loop count %d stack_pos %d "
DO_DEBUG( opal_output( 0, "raw new_loop count %" PRIsize_t " stack_pos %d "
"pos_desc %d disp %ld space %lu\n",
(int)pStack->count, pConvertor->stack_pos,
pStack->count, pConvertor->stack_pos,
pos_desc, (long)pStack->disp, (unsigned long)raw_data ); );
}
if( OPAL_DATATYPE_LOOP == pElem->elem.common.type ) {
Expand All @@ -172,7 +172,7 @@ opal_convertor_raw( opal_convertor_t* pConvertor,
if( pElem->loop.common.flags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) {
ptrdiff_t offset = end_loop->first_elem_disp;
source_base += offset;
for(uint32_t i = MIN(count_desc, *iov_count - index); i > 0; i--, index++ ) {
for(size_t i = MIN(count_desc, *iov_count - index); i > 0; i--, index++ ) {
OPAL_DATATYPE_SAFEGUARD_POINTER( source_base, end_loop->size, pConvertor->pBaseBuf,
pConvertor->pDesc, pConvertor->count );
iov[index].iov_base = (IOVBASE_TYPE *) source_base;
Expand Down Expand Up @@ -216,7 +216,7 @@ opal_convertor_raw( opal_convertor_t* pConvertor,
/* I complete an element, next step I should go to the next one */
PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, OPAL_DATATYPE_UINT1, count_desc,
source_base - pStack->disp - pConvertor->pBaseBuf );
DO_DEBUG( opal_output( 0, "raw save stack stack_pos %d pos_desc %d count_desc %d disp %ld\n",
pConvertor->stack_pos, pStack->index, (int)pStack->count, (long)pStack->disp ); );
DO_DEBUG( opal_output( 0, "raw save stack stack_pos %d pos_desc %d count_desc %" PRIsize_t " disp %ld\n",
pConvertor->stack_pos, pStack->index, pStack->count, (long)pStack->disp ); );
return 0;
}
Loading