Minimize the number of branches, and orce the correct prediction for the
most usual one. Most of the time we expect the functions which allocate requests to succeed. This commit was SVN r12344.
Этот коммит содержится в:
родитель
44f3dd81b4
Коммит
a9c6ae8f15
@ -16,8 +16,10 @@
|
|||||||
* $HEADER$
|
* $HEADER$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "ompi_config.h"
|
#include "ompi_config.h"
|
||||||
|
|
||||||
|
#include "opal/prefetch.h"
|
||||||
|
|
||||||
#include "ompi/constants.h"
|
#include "ompi/constants.h"
|
||||||
#include "ompi/mca/pml/pml.h"
|
#include "ompi/mca/pml/pml.h"
|
||||||
#include "ompi/mca/btl/btl.h"
|
#include "ompi/mca/btl/btl.h"
|
||||||
@ -470,35 +472,39 @@ int mca_pml_ob1_send_request_start_copy(
|
|||||||
mca_pml_ob1_hdr_t* hdr;
|
mca_pml_ob1_hdr_t* hdr;
|
||||||
struct iovec iov;
|
struct iovec iov;
|
||||||
unsigned int iov_count;
|
unsigned int iov_count;
|
||||||
size_t max_data;
|
size_t max_data = size;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
/* allocate descriptor */
|
/* allocate descriptor */
|
||||||
if(0==size)
|
if( 0 == size ) {
|
||||||
MCA_PML_OB1_DES_ALLOC(bml_btl, descriptor,
|
MCA_PML_OB1_DES_ALLOC( bml_btl, descriptor,
|
||||||
sizeof(mca_pml_ob1_match_hdr_t));
|
sizeof(mca_pml_ob1_match_hdr_t) );
|
||||||
else
|
if( OPAL_UNLIKELY(NULL == descriptor) ) {
|
||||||
mca_bml_base_alloc(bml_btl, &descriptor,
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||||
sizeof(mca_pml_ob1_match_hdr_t) + size);
|
}
|
||||||
if(NULL == descriptor) {
|
segment = descriptor->des_src;
|
||||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
descriptor->des_cbfunc = mca_pml_ob1_match_completion_cache;
|
||||||
}
|
} else {
|
||||||
segment = descriptor->des_src;
|
mca_bml_base_alloc( bml_btl, &descriptor,
|
||||||
|
sizeof(mca_pml_ob1_match_hdr_t) + size );
|
||||||
|
if( OPAL_UNLIKELY(NULL == descriptor) ) {
|
||||||
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||||
|
}
|
||||||
|
segment = descriptor->des_src;
|
||||||
|
|
||||||
max_data = size;
|
/* pack the data into the supplied buffer */
|
||||||
if(size > 0) {
|
iov.iov_base = (IOVBASE_TYPE*)((unsigned char*)segment->seg_addr.pval + sizeof(mca_pml_ob1_match_hdr_t));
|
||||||
/* pack the data into the supplied buffer */
|
iov.iov_len = size;
|
||||||
iov.iov_base = (IOVBASE_TYPE*)((unsigned char*)segment->seg_addr.pval + sizeof(mca_pml_ob1_match_hdr_t));
|
iov_count = 1;
|
||||||
iov.iov_len = size;
|
rc = ompi_convertor_pack( &sendreq->req_send.req_convertor,
|
||||||
iov_count = 1;
|
&iov,
|
||||||
if((rc = ompi_convertor_pack(
|
&iov_count,
|
||||||
&sendreq->req_send.req_convertor,
|
&max_data );
|
||||||
&iov,
|
if( OPAL_UNLIKELY(rc < 0) ) {
|
||||||
&iov_count,
|
mca_bml_base_free(bml_btl, descriptor);
|
||||||
&max_data)) < 0) {
|
return rc;
|
||||||
mca_bml_base_free(bml_btl, descriptor);
|
}
|
||||||
return rc;
|
descriptor->des_cbfunc = mca_pml_ob1_match_completion_free;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* build match header */
|
/* build match header */
|
||||||
@ -530,8 +536,6 @@ int mca_pml_ob1_send_request_start_copy(
|
|||||||
sendreq->req_rdma_offset = max_data;
|
sendreq->req_rdma_offset = max_data;
|
||||||
|
|
||||||
/* short message */
|
/* short message */
|
||||||
descriptor->des_cbfunc = size?mca_pml_ob1_match_completion_free:
|
|
||||||
mca_pml_ob1_match_completion_cache;
|
|
||||||
descriptor->des_flags |= MCA_BTL_DES_FLAGS_PRIORITY;
|
descriptor->des_flags |= MCA_BTL_DES_FLAGS_PRIORITY;
|
||||||
descriptor->des_cbdata = sendreq;
|
descriptor->des_cbdata = sendreq;
|
||||||
|
|
||||||
@ -542,8 +546,8 @@ int mca_pml_ob1_send_request_start_copy(
|
|||||||
|
|
||||||
/* send */
|
/* send */
|
||||||
rc = mca_bml_base_send(bml_btl, descriptor, MCA_BTL_TAG_PML);
|
rc = mca_bml_base_send(bml_btl, descriptor, MCA_BTL_TAG_PML);
|
||||||
if(OMPI_SUCCESS != rc) {
|
if( OPAL_UNLIKELY(OMPI_SUCCESS != rc) ) {
|
||||||
if(0==size)
|
if( 0 == size )
|
||||||
MCA_BML_BASE_BTL_DES_RETURN(bml_btl, descriptor);
|
MCA_BML_BASE_BTL_DES_RETURN(bml_btl, descriptor);
|
||||||
else
|
else
|
||||||
mca_bml_base_free(bml_btl, descriptor );
|
mca_bml_base_free(bml_btl, descriptor );
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user