Remove descriptor caching form BML. With descriptor caching some optimizations
are impossible. This commit was SVN r16897.
Этот коммит содержится в:
родитель
de3761208a
Коммит
2d784752dd
@ -64,7 +64,6 @@ struct mca_bml_base_btl_t {
|
||||
size_t btl_min_rdma_pipeline_size; /**< BTL min rdma size */
|
||||
struct mca_btl_base_module_t *btl; /**< BTL module */
|
||||
struct mca_btl_base_endpoint_t* btl_endpoint; /**< BTL addressing info */
|
||||
struct mca_btl_base_descriptor_t* btl_cache;
|
||||
|
||||
/* BTL function table */
|
||||
mca_btl_base_module_alloc_fn_t btl_alloc;
|
||||
@ -355,66 +354,6 @@ static inline void mca_bml_base_prepare_dst(mca_bml_base_btl_t* bml_btl,
|
||||
}
|
||||
}
|
||||
|
||||
#if OMPI_HAVE_THREAD_SUPPORT
|
||||
#define MCA_BML_BASE_BTL_DES_ALLOC(bml_btl, des, arg_order, \
|
||||
alloc_size, seg_size) \
|
||||
do { \
|
||||
if( MCA_BTL_NO_ORDER == arg_order && \
|
||||
NULL != (des = bml_btl->btl_cache) ) { \
|
||||
/* atomically acquire the cached descriptor */ \
|
||||
if(opal_atomic_cmpset_ptr(&bml_btl->btl_cache, \
|
||||
des, NULL) == 0) { \
|
||||
des = bml_btl->btl_alloc(bml_btl->btl, arg_order, \
|
||||
alloc_size); \
|
||||
} \
|
||||
} else { \
|
||||
des = bml_btl->btl_alloc(bml_btl->btl, arg_order, alloc_size); \
|
||||
} \
|
||||
if( OPAL_LIKELY(des != NULL) ) { \
|
||||
des->des_src->seg_len = seg_size; \
|
||||
des->des_context = (void*) bml_btl; \
|
||||
} \
|
||||
} while(0)
|
||||
#else
|
||||
#define MCA_BML_BASE_BTL_DES_ALLOC(bml_btl, des, arg_order, \
|
||||
alloc_size, seg_size) \
|
||||
do { \
|
||||
if( MCA_BTL_NO_ORDER == arg_order && \
|
||||
NULL != (des = bml_btl->btl_cache) ) { \
|
||||
bml_btl->btl_cache = NULL; \
|
||||
des->order = MCA_BTL_NO_ORDER; \
|
||||
} else { \
|
||||
des = bml_btl->btl_alloc(bml_btl->btl, arg_order, alloc_size); \
|
||||
} \
|
||||
if( OPAL_LIKELY(des != NULL) ) { \
|
||||
des->des_src->seg_len = seg_size; \
|
||||
des->des_context = (void*) bml_btl; \
|
||||
} \
|
||||
} while(0)
|
||||
#endif /* OMPI_HAVE_THREAD_SUPPORT */
|
||||
|
||||
/**
|
||||
* Return a descriptor
|
||||
*/
|
||||
#if OMPI_HAVE_THREAD_SUPPORT
|
||||
#define MCA_BML_BASE_BTL_DES_RETURN( bml_btl, descriptor ) \
|
||||
do { \
|
||||
if( opal_atomic_cmpset_ptr(&bml_btl->btl_cache, \
|
||||
NULL,descriptor) == 0 ) { \
|
||||
bml_btl->btl_free( bml_btl->btl, descriptor ); \
|
||||
} \
|
||||
} while (0)
|
||||
#else
|
||||
#define MCA_BML_BASE_BTL_DES_RETURN( bml_btl, descriptor ) \
|
||||
do { \
|
||||
if( NULL == bml_btl->btl_cache ) { \
|
||||
bml_btl->btl_cache = descriptor; \
|
||||
} else { \
|
||||
bml_btl->btl_free( bml_btl->btl, descriptor ); \
|
||||
} \
|
||||
} while(0)
|
||||
#endif /* OMPI_HAVE_THREAD_SUPPORT */
|
||||
|
||||
/*
|
||||
* BML component interface functions and datatype.
|
||||
*/
|
||||
|
@ -309,7 +309,6 @@ int mca_bml_r2_add_procs(
|
||||
btl->btl_rdma_pipeline_frag_size;
|
||||
bml_btl->btl_min_rdma_pipeline_size =
|
||||
btl->btl_min_rdma_pipeline_size;
|
||||
bml_btl->btl_cache = NULL;
|
||||
bml_btl->btl_endpoint = btl_endpoints[p];
|
||||
bml_btl->btl_weight = 0;
|
||||
bml_btl->btl_alloc = btl->btl_alloc;
|
||||
|
@ -216,10 +216,6 @@ extern int mca_pml_dr_ft_event(int state);
|
||||
#endif
|
||||
|
||||
|
||||
#define MCA_PML_DR_DES_ALLOC(bml_btl, des, size) \
|
||||
MCA_BML_BASE_BTL_DES_ALLOC(bml_btl, des, MCA_BTL_NO_ORDER, \
|
||||
sizeof(mca_pml_dr_hdr_t) + (sizeof(mca_btl_base_segment_t) << 4),size)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -88,7 +88,7 @@ static void mca_pml_dr_ctl_completion(
|
||||
int status)
|
||||
{
|
||||
mca_bml_base_btl_t* bml_btl = (mca_bml_base_btl_t*)des->des_context;
|
||||
MCA_BML_BASE_BTL_DES_RETURN(bml_btl, des);
|
||||
mca_bml_base_free(bml_btl, des);
|
||||
}
|
||||
|
||||
|
||||
@ -802,7 +802,8 @@ void mca_pml_dr_recv_frag_ack(
|
||||
(bml_btl->btl_flags & MCA_BTL_FLAGS_NEED_CSUM);
|
||||
|
||||
/* allocate descriptor */
|
||||
MCA_PML_DR_DES_ALLOC(bml_btl, des, sizeof(mca_pml_dr_ack_hdr_t));
|
||||
mca_bml_base_alloc(bml_btl, &des, MCA_BTL_NO_ORDER,
|
||||
sizeof(mca_pml_dr_ack_hdr_t));
|
||||
if(NULL == des) {
|
||||
goto retry;
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ static void mca_pml_dr_ctl_completion(
|
||||
int status)
|
||||
{
|
||||
mca_bml_base_btl_t* bml_btl = (mca_bml_base_btl_t*)des->des_context;
|
||||
MCA_BML_BASE_BTL_DES_RETURN(bml_btl, des);
|
||||
mca_bml_base_free(bml_btl, des);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -183,7 +183,8 @@ void mca_pml_dr_recv_request_ack(
|
||||
/* allocate descriptor */
|
||||
do_csum = mca_pml_dr.enable_csum &&
|
||||
(bml_btl->btl_flags & MCA_BTL_FLAGS_NEED_CSUM);
|
||||
MCA_PML_DR_DES_ALLOC(bml_btl, des, sizeof(mca_pml_dr_ack_hdr_t));
|
||||
mca_bml_base_alloc(bml_btl, &des, MCA_BTL_NO_ORDER,
|
||||
sizeof(mca_pml_dr_ack_hdr_t));
|
||||
if(NULL == des) {
|
||||
return;
|
||||
}
|
||||
|
@ -314,7 +314,7 @@ static void mca_pml_ob1_fin_completion( mca_btl_base_module_t* btl,
|
||||
|
||||
mca_bml_base_btl_t* bml_btl = (mca_bml_base_btl_t*) des->des_context;
|
||||
|
||||
MCA_BML_BASE_BTL_DES_RETURN(bml_btl, des);
|
||||
mca_bml_base_free(bml_btl, des);
|
||||
|
||||
/* check for pending requests */
|
||||
MCA_PML_OB1_PROGRESS_PENDING(bml_btl);
|
||||
@ -330,7 +330,8 @@ int mca_pml_ob1_send_fin( ompi_proc_t* proc,
|
||||
mca_pml_ob1_fin_hdr_t* hdr;
|
||||
int rc;
|
||||
|
||||
MCA_PML_OB1_DES_ALLOC(bml_btl, fin, order, sizeof(mca_pml_ob1_fin_hdr_t));
|
||||
mca_bml_base_alloc(bml_btl, &fin, order, sizeof(mca_pml_ob1_fin_hdr_t));
|
||||
|
||||
if(NULL == fin) {
|
||||
MCA_PML_OB1_ADD_FIN_TO_PENDING(proc, hdr_des, bml_btl, order, status);
|
||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||
@ -367,7 +368,7 @@ int mca_pml_ob1_send_fin( ompi_proc_t* proc,
|
||||
MCA_BTL_TAG_PML
|
||||
);
|
||||
if(OMPI_SUCCESS != rc) {
|
||||
MCA_BML_BASE_BTL_DES_RETURN(bml_btl, fin);
|
||||
mca_bml_base_free(bml_btl, fin);
|
||||
MCA_PML_OB1_ADD_FIN_TO_PENDING(proc, hdr_des, bml_btl, order, status);
|
||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
|
@ -179,10 +179,6 @@ extern int mca_pml_ob1_ft_event( int state );
|
||||
|
||||
END_C_DECLS
|
||||
|
||||
#define MCA_PML_OB1_DES_ALLOC(bml_btl, des, order, size) \
|
||||
MCA_BML_BASE_BTL_DES_ALLOC(bml_btl, des, order, \
|
||||
sizeof(mca_pml_ob1_hdr_t) + (sizeof(mca_btl_base_segment_t) << 4), size)
|
||||
|
||||
struct mca_pml_ob1_pckt_pending_t {
|
||||
ompi_free_list_item_t super;
|
||||
ompi_proc_t* proc;
|
||||
|
@ -140,7 +140,8 @@ static void mca_pml_ob1_recv_ctl_completion( mca_btl_base_module_t* btl,
|
||||
int status )
|
||||
{
|
||||
mca_bml_base_btl_t* bml_btl = (mca_bml_base_btl_t*)des->des_context;
|
||||
MCA_BML_BASE_BTL_DES_RETURN(bml_btl, des);
|
||||
|
||||
mca_bml_base_free(bml_btl, des);
|
||||
|
||||
MCA_PML_OB1_PROGRESS_PENDING(bml_btl);
|
||||
}
|
||||
@ -188,7 +189,8 @@ int mca_pml_ob1_recv_request_ack_send_btl(
|
||||
int rc;
|
||||
|
||||
/* allocate descriptor */
|
||||
MCA_PML_OB1_DES_ALLOC(bml_btl, des, MCA_BTL_NO_ORDER, sizeof(mca_pml_ob1_ack_hdr_t));
|
||||
mca_bml_base_alloc(bml_btl, &des, MCA_BTL_NO_ORDER,
|
||||
sizeof(mca_pml_ob1_ack_hdr_t));
|
||||
if( OPAL_UNLIKELY(NULL == des) ) {
|
||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
@ -673,7 +675,8 @@ int mca_pml_ob1_recv_request_schedule_once(
|
||||
(dst->des_dst_cnt-1));
|
||||
}
|
||||
|
||||
MCA_PML_OB1_DES_ALLOC(bml_btl, ctl, MCA_BTL_NO_ORDER, hdr_size);
|
||||
mca_bml_base_alloc(bml_btl, &ctl, MCA_BTL_NO_ORDER, hdr_size);
|
||||
|
||||
if( OPAL_UNLIKELY(NULL == ctl) ) {
|
||||
mca_bml_base_free(bml_btl,dst);
|
||||
continue;
|
||||
|
@ -137,42 +137,6 @@ OBJ_CLASS_INSTANCE( mca_pml_ob1_send_request_t,
|
||||
mca_pml_ob1_send_request_construct,
|
||||
mca_pml_ob1_send_request_destruct );
|
||||
|
||||
/**
|
||||
* Completion of a short message - nothing left to schedule. Note that this
|
||||
* function is only called for 0 sized messages.
|
||||
*/
|
||||
|
||||
static void
|
||||
mca_pml_ob1_match_completion_cache( struct mca_btl_base_module_t* btl,
|
||||
struct mca_btl_base_endpoint_t* ep,
|
||||
struct mca_btl_base_descriptor_t* descriptor,
|
||||
int status )
|
||||
{
|
||||
mca_pml_ob1_send_request_t* sendreq = (mca_pml_ob1_send_request_t*)descriptor->des_cbdata;
|
||||
mca_bml_base_btl_t* bml_btl = (mca_bml_base_btl_t*) descriptor->des_context;
|
||||
|
||||
if( sendreq->req_send.req_bytes_packed > 0 ) {
|
||||
PERUSE_TRACE_COMM_EVENT( PERUSE_COMM_REQ_XFER_BEGIN,
|
||||
&(sendreq->req_send.req_base), PERUSE_SEND );
|
||||
}
|
||||
|
||||
/* check completion status */
|
||||
if( OPAL_UNLIKELY(OMPI_SUCCESS != status) ) {
|
||||
/* TSW - FIX */
|
||||
opal_output(0, "%s:%d FATAL", __FILE__, __LINE__);
|
||||
orte_errmgr.abort();
|
||||
}
|
||||
|
||||
/* attempt to cache the descriptor */
|
||||
MCA_BML_BASE_BTL_DES_RETURN( bml_btl, descriptor );
|
||||
|
||||
/* signal request completion */
|
||||
send_request_pml_complete(sendreq);
|
||||
|
||||
/* check for pending requests */
|
||||
MCA_PML_OB1_PROGRESS_PENDING(bml_btl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Completion of a short message - nothing left to schedule.
|
||||
*/
|
||||
@ -476,31 +440,22 @@ int mca_pml_ob1_send_request_start_copy( mca_pml_ob1_send_request_t* sendreq,
|
||||
int rc;
|
||||
|
||||
/* allocate descriptor */
|
||||
if( 0 == size ) {
|
||||
MCA_PML_OB1_DES_ALLOC( bml_btl, descriptor,
|
||||
MCA_BTL_NO_ORDER,
|
||||
sizeof(mca_pml_ob1_match_hdr_t) );
|
||||
if( OPAL_UNLIKELY(NULL == descriptor) ) {
|
||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
segment = descriptor->des_src;
|
||||
descriptor->des_cbfunc = mca_pml_ob1_match_completion_cache;
|
||||
} else {
|
||||
mca_bml_base_alloc( bml_btl, &descriptor,
|
||||
MCA_BTL_NO_ORDER,
|
||||
sizeof(mca_pml_ob1_match_hdr_t) + size );
|
||||
if( OPAL_UNLIKELY(NULL == descriptor) ) {
|
||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
segment = descriptor->des_src;
|
||||
mca_bml_base_alloc( bml_btl, &descriptor,
|
||||
MCA_BTL_NO_ORDER,
|
||||
sizeof(mca_pml_ob1_match_hdr_t) + size );
|
||||
if( OPAL_UNLIKELY(NULL == descriptor) ) {
|
||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
segment = descriptor->des_src;
|
||||
|
||||
if(size > 0) {
|
||||
/* pack the data into the supplied buffer */
|
||||
iov.iov_base = (IOVBASE_TYPE*)((unsigned char*)segment->seg_addr.pval + sizeof(mca_pml_ob1_match_hdr_t));
|
||||
iov.iov_base = (IOVBASE_TYPE*)((unsigned char*)segment->seg_addr.pval +
|
||||
sizeof(mca_pml_ob1_match_hdr_t));
|
||||
iov.iov_len = size;
|
||||
iov_count = 1;
|
||||
(void)ompi_convertor_pack( &sendreq->req_send.req_base.req_convertor,
|
||||
&iov, &iov_count, &max_data );
|
||||
descriptor->des_cbfunc = mca_pml_ob1_match_completion_free;
|
||||
&iov, &iov_count, &max_data );
|
||||
}
|
||||
|
||||
/* build match header */
|
||||
@ -532,6 +487,7 @@ int mca_pml_ob1_send_request_start_copy( mca_pml_ob1_send_request_t* sendreq,
|
||||
/* short message */
|
||||
descriptor->des_flags |= MCA_BTL_DES_FLAGS_PRIORITY;
|
||||
descriptor->des_cbdata = sendreq;
|
||||
descriptor->des_cbfunc = mca_pml_ob1_match_completion_free;
|
||||
|
||||
/* signal request completion */
|
||||
OPAL_THREAD_LOCK(&ompi_request_lock);
|
||||
@ -540,12 +496,8 @@ int mca_pml_ob1_send_request_start_copy( mca_pml_ob1_send_request_t* sendreq,
|
||||
|
||||
/* send */
|
||||
rc = mca_bml_base_send(bml_btl, descriptor, MCA_BTL_TAG_PML);
|
||||
if( OPAL_UNLIKELY(OMPI_SUCCESS != rc) ) {
|
||||
if( 0 == size )
|
||||
MCA_BML_BASE_BTL_DES_RETURN(bml_btl, descriptor);
|
||||
else
|
||||
mca_bml_base_free(bml_btl, descriptor );
|
||||
}
|
||||
if(OPAL_UNLIKELY(OMPI_SUCCESS != rc))
|
||||
mca_bml_base_free(bml_btl, descriptor);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user