@@ -102,7 +102,7 @@ opal_convertor_raw( opal_convertor_t* pConvertor,
102
102
/* now here we have a basic datatype */
103
103
OPAL_DATATYPE_SAFEGUARD_POINTER ( source_base , blength , pConvertor -> pBaseBuf ,
104
104
pConvertor -> pDesc , pConvertor -> count );
105
- DO_DEBUG ( opal_output ( 0 , "raw 1. iov[%d] = {base %p, length %lu }\n" ,
105
+ DO_DEBUG ( opal_output ( 0 , "raw 1. iov[%d] = {base %p, length %" PRIsize_t " }\n" ,
106
106
index , (void * )source_base , (unsigned long )blength ); );
107
107
iov [index ].iov_base = (IOVBASE_TYPE * ) source_base ;
108
108
iov [index ].iov_len = blength ;
@@ -115,7 +115,7 @@ opal_convertor_raw( opal_convertor_t* pConvertor,
115
115
for (size_t i = count_desc ; (i > 0 ) && (index < * iov_count ); i -- , index ++ ) {
116
116
OPAL_DATATYPE_SAFEGUARD_POINTER ( source_base , blength , pConvertor -> pBaseBuf ,
117
117
pConvertor -> pDesc , pConvertor -> count );
118
- DO_DEBUG ( opal_output ( 0 , "raw 2. iov[%d] = {base %p, length %lu }\n" ,
118
+ DO_DEBUG ( opal_output ( 0 , "raw 2. iov[%d] = {base %p, length %" PRIsize_t " }\n" ,
119
119
index , (void * )source_base , (unsigned long )blength ); );
120
120
iov [index ].iov_base = (IOVBASE_TYPE * ) source_base ;
121
121
iov [index ].iov_len = blength ;
@@ -172,30 +172,28 @@ opal_convertor_raw( opal_convertor_t* pConvertor,
172
172
if ( pElem -> loop .common .flags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) {
173
173
ptrdiff_t offset = end_loop -> first_elem_disp ;
174
174
source_base += offset ;
175
- for (size_t i = count_desc ; i > 0 ; i -- , index ++ ) {
176
- if (index >= * iov_count ) {
177
- dt_elem_desc_t * nElem = pElem + 1 ;
178
- while (nElem -> elem .common .type == OPAL_DATATYPE_LOOP ) {
179
- nElem ++ ;
180
- }
181
- assert (OPAL_DATATYPE_END_LOOP != nElem -> elem .common .type );
182
- offset = nElem -> elem .disp ;
183
- break ;
184
- }
175
+ for (size_t i = MIN (count_desc , * iov_count - index ); i > 0 ; i -- , index ++ ) {
185
176
OPAL_DATATYPE_SAFEGUARD_POINTER ( source_base , end_loop -> size , pConvertor -> pBaseBuf ,
186
177
pConvertor -> pDesc , pConvertor -> count );
187
178
iov [index ].iov_base = (IOVBASE_TYPE * ) source_base ;
188
179
iov [index ].iov_len = end_loop -> size ;
189
180
source_base += pElem -> loop .extent ;
190
181
raw_data += end_loop -> size ;
191
182
count_desc -- ;
183
+ DO_DEBUG ( opal_output ( 0 , "raw contig loop generate iov[%d] = {base %p, length %" PRIsize_t "}"
184
+ "space %lu [pos_desc %d]\n" ,
185
+ index , iov [index ].iov_base , iov [index ].iov_len ,
186
+ (unsigned long )raw_data , pos_desc ); );
192
187
}
193
188
source_base -= offset ;
194
189
if ( 0 == count_desc ) { /* completed */
195
190
pos_desc += pElem -> loop .items + 1 ;
196
191
goto update_loop_description ;
197
192
}
198
193
}
194
+ if ( index == * iov_count ) { /* all iov have been filled, we need to bail out */
195
+ goto complete_loop ;
196
+ }
199
197
local_disp = (ptrdiff_t )source_base - local_disp ;
200
198
PUSH_STACK ( pStack , pConvertor -> stack_pos , pos_desc , OPAL_DATATYPE_LOOP , count_desc ,
201
199
pStack -> disp + local_disp );
0 commit comments