@@ -81,20 +81,32 @@ static ucs_status_t pml_ucx_generic_datatype_unpack(void *state, size_t offset,
8181
8282 uint32_t iov_count ;
8383 struct iovec iov ;
84+ opal_convertor_t conv ;
8485
8586 iov_count = 1 ;
8687 iov .iov_base = (void * )src ;
8788 iov .iov_len = length ;
8889
89- /* if we detected out-of-order message - apply hack: reset datatype stack
90- * of convertor to allow re-build it on set_position call */
91- if ((offset != convertor -> offset ) &&
92- !(convertor -> opal_conv .flags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) ) {
93- opal_convertor_reset_stack_at_beginning (& convertor -> opal_conv );
90+ /* in case if unordered message arrived - create separate convertor to
91+ * unpack data. */
92+ if (offset != convertor -> offset ) {
93+ OBJ_CONSTRUCT (& conv , opal_convertor_t );
94+ opal_convertor_copy_and_prepare_for_recv (ompi_proc_local_proc -> super .proc_convertor ,
95+ & convertor -> datatype -> super ,
96+ convertor -> opal_conv .count ,
97+ convertor -> opal_conv .pBaseBuf , 0 ,
98+ & conv );
99+ opal_convertor_set_position (& conv , & offset );
100+ opal_convertor_unpack (& conv , & iov , & iov_count , & length );
101+ opal_convertor_cleanup (& conv );
102+ OBJ_DESTRUCT (& conv );
103+ /* permanently switch to un-ordered mode */
104+ convertor -> offset = 0 ;
105+ } else {
106+ opal_convertor_set_position (& convertor -> opal_conv , & offset );
107+ opal_convertor_unpack (& convertor -> opal_conv , & iov , & iov_count , & length );
108+ convertor -> offset += length ;
94109 }
95- opal_convertor_set_position (& convertor -> opal_conv , & offset );
96- opal_convertor_unpack (& convertor -> opal_conv , & iov , & iov_count , & length );
97- convertor -> offset = offset + length ;
98110 return UCS_OK ;
99111}
100112
0 commit comments