@@ -41,7 +41,9 @@ mca_btl_base_descriptor_t *mca_btl_uct_alloc(mca_btl_base_module_t *btl,
4141 frag -> base .des_segment_count = 1 ;
4242 frag -> base .des_flags = flags ;
4343 frag -> base .order = order ;
44- frag -> uct_iov .length = size ;
44+ frag -> uct_iov [1 ].length = size ;
45+ frag -> uct_iov [2 ].length = 0 ;
46+ frag -> uct_iov_count = 2 ;
4547 if (NULL != frag -> base .super .registration ) {
4648 /* zero-copy fragments will need callbacks */
4749 frag -> base .des_flags |= MCA_BTL_DES_SEND_ALWAYS_CALLBACK ;
@@ -89,11 +91,11 @@ struct mca_btl_base_descriptor_t *mca_btl_uct_prepare_src(mca_btl_base_module_t
8991 return NULL ;
9092 }
9193
92- _mca_btl_uct_send_pack ((void * ) ((intptr_t ) frag -> uct_iov .buffer + reserve ), NULL , 0 ,
94+ _mca_btl_uct_send_pack ((void * ) ((intptr_t ) frag -> uct_iov [ 1 ] .buffer + reserve ), NULL , 0 ,
9395 convertor , size );
9496 /* update the length of the fragment according to the convertor packed data */
9597 frag -> segments [0 ].seg_len = reserve + * size ;
96- frag -> uct_iov .length = frag -> segments [0 ].seg_len ;
98+ frag -> uct_iov [ 1 ] .length = frag -> segments [0 ].seg_len ;
9799 } else {
98100 opal_convertor_get_current_pointer (convertor , & data_ptr );
99101 assert (NULL != data_ptr );
@@ -103,20 +105,21 @@ struct mca_btl_base_descriptor_t *mca_btl_uct_prepare_src(mca_btl_base_module_t
103105 return NULL ;
104106 }
105107
106- frag -> uct_iov .length = total_size ;
108+ frag -> uct_iov [1 ].length = reserve ;
109+
110+ /* user data */
111+ frag -> uct_iov [2 ].length = * size ;
112+ frag -> uct_iov [2 ].buffer = data_ptr ;
113+
114+ frag -> uct_iov_count = 3 ;
115+
107116 frag -> base .order = order ;
108117 frag -> base .des_flags = flags ;
109- if (total_size > (size_t ) uct_btl -> am_tl -> uct_iface_attr .cap .am .max_short ) {
110- frag -> segments [0 ].seg_len = reserve ;
111- frag -> segments [1 ].seg_len = * size ;
112- frag -> segments [1 ].seg_addr .pval = data_ptr ;
113- frag -> base .des_segment_count = 2 ;
114- } else {
115- frag -> segments [0 ].seg_len = total_size ;
116- memcpy ((void * ) ((intptr_t ) frag -> segments [0 ].seg_addr .pval + reserve ), data_ptr ,
117- * size );
118- frag -> base .des_segment_count = 1 ;
119- }
118+
119+ frag -> segments [0 ].seg_len = reserve ;
120+ frag -> segments [1 ].seg_len = * size ;
121+ frag -> segments [1 ].seg_addr .pval = data_ptr ;
122+ frag -> base .des_segment_count = 2 ;
120123 }
121124
122125 return & frag -> base ;
@@ -167,7 +170,7 @@ static void mca_btl_uct_append_pending_frag(mca_btl_uct_module_t *uct_btl,
167170int mca_btl_uct_send_frag (mca_btl_uct_module_t * uct_btl , mca_btl_uct_base_frag_t * frag , bool append )
168171{
169172 mca_btl_uct_device_context_t * context = frag -> context ;
170- const ssize_t msg_size = frag -> uct_iov .length + 8 ;
173+ const ssize_t msg_size = frag -> uct_iov [ 0 ] .length + frag -> uct_iov [ 1 ]. length + frag -> uct_iov [ 2 ]. length ;
171174 ssize_t size ;
172175 ucs_status_t ucs_status ;
173176 uct_ep_h ep_handle = NULL ;
@@ -184,8 +187,8 @@ int mca_btl_uct_send_frag(mca_btl_uct_module_t *uct_btl, mca_btl_uct_base_frag_t
184187 if (NULL != frag -> base .super .registration
185188 && (uct_btl -> am_tl -> uct_iface_attr .cap .flags & UCT_IFACE_FLAG_AM_ZCOPY )) {
186189 frag -> comp .dev_context = context ;
187- ucs_status = uct_ep_am_zcopy (ep_handle , MCA_BTL_UCT_FRAG , & frag -> header ,
188- sizeof ( frag -> header ) , & frag -> uct_iov , 1 , 0 ,
190+ ucs_status = uct_ep_am_zcopy (ep_handle , MCA_BTL_UCT_FRAG , frag -> uct_iov [ 0 ]. buffer ,
191+ frag -> uct_iov [ 0 ]. length , & frag -> uct_iov [ 1 ] , 1 , 0 ,
189192 & frag -> comp .uct_comp );
190193
191194 if (OPAL_LIKELY (UCS_INPROGRESS == ucs_status )) {
@@ -195,12 +198,8 @@ int mca_btl_uct_send_frag(mca_btl_uct_module_t *uct_btl, mca_btl_uct_base_frag_t
195198 }
196199 } else {
197200 /* short message */
198- if (1 == frag -> base .des_segment_count
199- && (frag -> uct_iov .length + 8 )
200- < uct_btl -> am_tl -> uct_iface_attr .cap .am .max_short ) {
201- ucs_status = uct_ep_am_short (ep_handle , MCA_BTL_UCT_FRAG , frag -> header .value ,
202- frag -> uct_iov .buffer , frag -> uct_iov .length );
203-
201+ if (msg_size < uct_btl -> am_tl -> uct_iface_attr .cap .am .max_short ) {
202+ ucs_status = uct_ep_am_short_iov (ep_handle , MCA_BTL_UCT_FRAG , frag -> uct_iov , frag -> uct_iov_count );
204203 if (OPAL_LIKELY (UCS_OK == ucs_status )) {
205204 uct_worker_progress (context -> uct_worker );
206205 mca_btl_uct_context_unlock (context );
@@ -250,7 +249,7 @@ int mca_btl_uct_send(mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endpoi
250249
251250 BTL_VERBOSE (("btl/uct sending descriptor %p from %d -> %d. length = %" PRIu64 ,
252251 (void * ) descriptor , OPAL_PROC_MY_NAME .vpid , endpoint -> ep_proc -> proc_name .vpid ,
253- frag -> uct_iov .length ));
252+ frag -> uct_iov [ 0 ]. length + frag -> uct_iov [ 1 ]. length + frag -> uct_iov [ 2 ] .length ));
254253
255254 frag -> header .data .tag = tag ;
256255 frag -> context = context ;
0 commit comments