1
1

opal/threads: add OPAL_THREAD_SUB_SIZE_T macro

-1 is not a valid size_t, so instead of OPAL_THREAD_ADD_SIZE_T(..., -1),
simply OPAL_THREAD_SUB_SIZE_T(..., 1) and keep picky compilers happy
Этот коммит содержится в:
Gilles Gouaillardet 2016-08-10 11:56:42 +09:00
родитель 799104f688
Коммит dfbf2b7be4
5 изменённых файлов: 27 добавлений и 7 удалений

Просмотреть файл

@ -14,6 +14,8 @@
* Copyright (c) 2010-2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011-2012 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -203,7 +205,7 @@ static void mca_pml_bfo_put_completion( mca_btl_base_module_t* btl,
(void *) des->des_remote,
des->des_remote_count, 0);
}
OPAL_THREAD_ADD_SIZE_T(&recvreq->req_pipeline_depth,-1);
OPAL_THREAD_SUB_SIZE_T(&recvreq->req_pipeline_depth, 1);
#if PML_BFO
btl->btl_free(btl, des);

Просмотреть файл

@ -14,6 +14,8 @@
* Copyright (c) 2010-2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011-2012 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -357,7 +359,7 @@ mca_pml_bfo_frag_completion( mca_btl_base_module_t* btl,
des->des_local_count,
sizeof(mca_pml_bfo_frag_hdr_t));
OPAL_THREAD_ADD_SIZE_T(&sendreq->req_pipeline_depth, -1);
OPAL_THREAD_SUB_SIZE_T(&sendreq->req_pipeline_depth, 1);
OPAL_THREAD_ADD_SIZE_T(&sendreq->req_bytes_delivered, req_bytes_delivered);
#if PML_BFO

Просмотреть файл

@ -16,7 +16,7 @@
* Copyright (c) 2011-2016 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2012 FUJITSU LIMITED. All rights reserved.
* Copyright (c) 2014-2015 Research Organization for Information Science
* Copyright (c) 2014-2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
@ -189,7 +189,7 @@ static void mca_pml_ob1_put_completion (mca_pml_ob1_rdma_frag_t *frag, int64_t r
mca_pml_ob1_recv_request_t* recvreq = (mca_pml_ob1_recv_request_t *) frag->rdma_req;
mca_bml_base_btl_t *bml_btl = frag->rdma_bml;
OPAL_THREAD_ADD_SIZE_T(&recvreq->req_pipeline_depth,-1);
OPAL_THREAD_SUB_SIZE_T(&recvreq->req_pipeline_depth, 1);
MCA_PML_OB1_RDMA_FRAG_RETURN(frag);

Просмотреть файл

@ -15,7 +15,9 @@
* Copyright (c) 2012 NVIDIA Corporation. All rights reserved.
* Copyright (c) 2012-2016 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -310,7 +312,7 @@ mca_pml_ob1_frag_completion( mca_btl_base_module_t* btl,
des->des_segment_count,
sizeof(mca_pml_ob1_frag_hdr_t));
OPAL_THREAD_ADD_SIZE_T(&sendreq->req_pipeline_depth, -1);
OPAL_THREAD_SUB_SIZE_T(&sendreq->req_pipeline_depth, 1);
OPAL_THREAD_ADD_SIZE_T(&sendreq->req_bytes_delivered, req_bytes_delivered);
if(send_request_pml_complete_check(sendreq) == false) {

Просмотреть файл

@ -11,7 +11,7 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2007-2014 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2014 Research Organization for Information Science
* Copyright (c) 2014-2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2015-2016 Los Alamos National Security, LLC. All rights
* reserved.
@ -103,6 +103,16 @@ static inline type opal_thread_add_ ## suffix (volatile type *addr, type delta)
return (*addr += delta); \
}
#define OPAL_THREAD_DEFINE_ATOMIC_SUB(type, suffix) \
static inline type opal_thread_sub_ ## suffix (volatile type *addr, type delta) \
{ \
if (OPAL_UNLIKELY(opal_using_threads())) { \
return opal_atomic_sub_ ## suffix (addr, delta); \
} \
\
return (*addr -= delta); \
}
#define OPAL_THREAD_DEFINE_ATOMIC_CMPSET(type, addr_type, suffix) \
static inline bool opal_thread_cmpset_bool_ ## suffix (volatile addr_type *addr, type compare, type value) \
{ \
@ -133,6 +143,7 @@ static inline type opal_thread_swap_ ## suffix (volatile addr_type *ptr, type ne
OPAL_THREAD_DEFINE_ATOMIC_ADD(int32_t, 32)
OPAL_THREAD_DEFINE_ATOMIC_ADD(size_t, size_t)
OPAL_THREAD_DEFINE_ATOMIC_SUB(size_t, size_t)
OPAL_THREAD_DEFINE_ATOMIC_CMPSET(int32_t, int32_t, 32)
OPAL_THREAD_DEFINE_ATOMIC_CMPSET(void *, intptr_t, ptr)
OPAL_THREAD_DEFINE_ATOMIC_SWAP(int32_t, int32_t, 32)
@ -144,6 +155,9 @@ OPAL_THREAD_DEFINE_ATOMIC_SWAP(void *, intptr_t, ptr)
#define OPAL_THREAD_ADD_SIZE_T opal_thread_add_size_t
#define OPAL_ATOMIC_ADD_SIZE_T opal_thread_add_size_t
#define OPAL_THREAD_SUB_SIZE_T opal_thread_sub_size_t
#define OPAL_ATOMIC_SUB_SIZE_T opal_thread_sub_size_t
#define OPAL_THREAD_CMPSET_32 opal_thread_cmpset_bool_32
#define OPAL_ATOMIC_CMPSET_32 opal_thread_cmpset_bool_32