Skip to content

Commit 104f6df

Browse files
committed
Make the pipeline depth an int instead of a size_t. While
they are supposed to be unsigned, casting them to a signed value for all atomic operations is as errorprone as handling them as signed entities.
1 parent d5ee4e6 commit 104f6df

File tree

6 files changed

+24
-24
lines changed

6 files changed

+24
-24
lines changed

ompi/mca/pml/ob1/pml_ob1.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ struct mca_pml_ob1_t {
5555
int free_list_num; /* initial size of free list */
5656
int free_list_max; /* maximum size of free list */
5757
int free_list_inc; /* number of elements to grow free list */
58-
size_t send_pipeline_depth;
59-
size_t recv_pipeline_depth;
58+
int32_t send_pipeline_depth;
59+
int32_t recv_pipeline_depth;
6060
size_t rdma_retries_limit;
6161
int max_rdma_per_request;
6262
int max_send_per_range;

ompi/mca/pml/ob1/pml_ob1_component.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ static int mca_pml_ob1_component_register(void)
186186
mca_pml_ob1_param_register_int("free_list_max", -1, &mca_pml_ob1.free_list_max);
187187
mca_pml_ob1_param_register_int("free_list_inc", 64, &mca_pml_ob1.free_list_inc);
188188
mca_pml_ob1_param_register_int("priority", 20, &mca_pml_ob1.priority);
189-
mca_pml_ob1_param_register_sizet("send_pipeline_depth", 3, &mca_pml_ob1.send_pipeline_depth);
190-
mca_pml_ob1_param_register_sizet("recv_pipeline_depth", 4, &mca_pml_ob1.recv_pipeline_depth);
189+
mca_pml_ob1_param_register_int("send_pipeline_depth", 3, &mca_pml_ob1.send_pipeline_depth);
190+
mca_pml_ob1_param_register_int("recv_pipeline_depth", 4, &mca_pml_ob1.recv_pipeline_depth);
191191

192192
/* NTH: we can get into a live-lock situation in the RDMA failure path so disable
193193
RDMA retries for now. Falling back to send may suck but it is better than

ompi/mca/pml/ob1/pml_ob1_recvreq.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,15 +194,15 @@ static void mca_pml_ob1_put_completion (mca_pml_ob1_rdma_frag_t *frag, int64_t r
194194
mca_pml_ob1_recv_request_t* recvreq = (mca_pml_ob1_recv_request_t *) frag->rdma_req;
195195
mca_bml_base_btl_t *bml_btl = frag->rdma_bml;
196196

197-
OPAL_THREAD_ADD_SIZE_T(&recvreq->req_pipeline_depth,-1);
197+
OPAL_THREAD_ADD32(&recvreq->req_pipeline_depth, -1);
198198

199199
MCA_PML_OB1_RDMA_FRAG_RETURN(frag);
200200

201201
if (OPAL_LIKELY(0 < rdma_size)) {
202202
assert ((uint64_t) rdma_size == frag->rdma_length);
203203

204204
/* check completion status */
205-
OPAL_THREAD_ADD_SIZE_T(&recvreq->req_bytes_received, (size_t) rdma_size);
205+
OPAL_THREAD_ADD_SIZE_T(&recvreq->req_bytes_received, rdma_size);
206206
if (recv_request_pml_complete_check(recvreq) == false &&
207207
recvreq->req_rdma_offset < recvreq->req_send_offset) {
208208
/* schedule additional rdma operations */
@@ -953,7 +953,7 @@ int mca_pml_ob1_recv_request_schedule_once( mca_pml_ob1_recv_request_t* recvreq,
953953
}
954954

955955
while(bytes_remaining > 0 &&
956-
recvreq->req_pipeline_depth < mca_pml_ob1.recv_pipeline_depth) {
956+
recvreq->req_pipeline_depth < mca_pml_ob1.recv_pipeline_depth) {
957957
mca_pml_ob1_rdma_frag_t *frag = NULL;
958958
mca_btl_base_module_t *btl;
959959
int rc, rdma_idx;
@@ -1030,7 +1030,7 @@ int mca_pml_ob1_recv_request_schedule_once( mca_pml_ob1_recv_request_t* recvreq,
10301030
if (OPAL_LIKELY(OMPI_SUCCESS == rc)) {
10311031
/* update request state */
10321032
recvreq->req_rdma_offset += size;
1033-
OPAL_THREAD_ADD_SIZE_T(&recvreq->req_pipeline_depth, 1);
1033+
OPAL_THREAD_ADD32(&recvreq->req_pipeline_depth, 1);
10341034
recvreq->req_rdma[rdma_idx].length -= size;
10351035
bytes_remaining -= size;
10361036
} else {

ompi/mca/pml/ob1/pml_ob1_recvreq.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ BEGIN_C_DECLS
4141
struct mca_pml_ob1_recv_request_t {
4242
mca_pml_base_recv_request_t req_recv;
4343
opal_ptr_t remote_req_send;
44-
int32_t req_lock;
45-
size_t req_pipeline_depth;
46-
size_t req_bytes_received; /**< amount of data transferred into the user buffer */
47-
size_t req_bytes_expected; /**< local size of the data as suggested by the user */
48-
size_t req_rdma_offset;
49-
size_t req_send_offset;
44+
int32_t req_lock;
45+
int32_t req_pipeline_depth;
46+
size_t req_bytes_received; /**< amount of data transferred into the user buffer */
47+
size_t req_bytes_expected; /**< local size of the data as suggested by the user */
48+
size_t req_rdma_offset;
49+
size_t req_send_offset;
5050
uint32_t req_rdma_cnt;
5151
uint32_t req_rdma_idx;
5252
bool req_pending;

ompi/mca/pml/ob1/pml_ob1_sendreq.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ mca_pml_ob1_frag_completion( mca_btl_base_module_t* btl,
314314
des->des_segment_count,
315315
sizeof(mca_pml_ob1_frag_hdr_t));
316316

317-
OPAL_THREAD_ADD_SIZE_T(&sendreq->req_pipeline_depth, -1);
317+
OPAL_THREAD_ADD32(&sendreq->req_pipeline_depth, -1);
318318
OPAL_THREAD_ADD_SIZE_T(&sendreq->req_bytes_delivered, req_bytes_delivered);
319319

320320
if(send_request_pml_complete_check(sendreq) == false) {
@@ -918,13 +918,13 @@ mca_pml_ob1_send_request_schedule_once(mca_pml_ob1_send_request_t* sendreq)
918918

919919
/* check pipeline_depth here before attempting to get any locks */
920920
if(true == sendreq->req_throttle_sends &&
921-
sendreq->req_pipeline_depth >= mca_pml_ob1.send_pipeline_depth)
921+
sendreq->req_pipeline_depth >= mca_pml_ob1.send_pipeline_depth)
922922
return OMPI_SUCCESS;
923923

924924
range = get_send_range(sendreq);
925925

926926
while(range && (false == sendreq->req_throttle_sends ||
927-
sendreq->req_pipeline_depth < mca_pml_ob1.send_pipeline_depth)) {
927+
sendreq->req_pipeline_depth < mca_pml_ob1.send_pipeline_depth)) {
928928
mca_pml_ob1_frag_hdr_t* hdr;
929929
mca_btl_base_descriptor_t* des;
930930
int rc, btl_idx;
@@ -1049,7 +1049,7 @@ mca_pml_ob1_send_request_schedule_once(mca_pml_ob1_send_request_t* sendreq)
10491049
range->range_btls[btl_idx].length -= size;
10501050
range->range_send_length -= size;
10511051
range->range_send_offset += size;
1052-
OPAL_THREAD_ADD_SIZE_T(&sendreq->req_pipeline_depth, 1);
1052+
OPAL_THREAD_ADD32(&sendreq->req_pipeline_depth, 1);
10531053
if(range->range_send_length == 0) {
10541054
range = get_next_send_range(sendreq, range);
10551055
prev_bytes_remaining = 0;
@@ -1065,7 +1065,7 @@ mca_pml_ob1_send_request_schedule_once(mca_pml_ob1_send_request_t* sendreq)
10651065
range->range_btls[btl_idx].length -= size;
10661066
range->range_send_length -= size;
10671067
range->range_send_offset += size;
1068-
OPAL_THREAD_ADD_SIZE_T(&sendreq->req_pipeline_depth, 1);
1068+
OPAL_THREAD_ADD32(&sendreq->req_pipeline_depth, 1);
10691069
if(range->range_send_length == 0) {
10701070
range = get_next_send_range(sendreq, range);
10711071
prev_bytes_remaining = 0;

ompi/mca/pml/ob1/pml_ob1_sendreq.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ struct mca_pml_ob1_send_request_t {
4545
mca_pml_base_send_request_t req_send;
4646
mca_bml_base_endpoint_t* req_endpoint;
4747
opal_ptr_t req_recv;
48-
int32_t req_state;
49-
int32_t req_lock;
50-
bool req_throttle_sends;
51-
size_t req_pipeline_depth;
52-
size_t req_bytes_delivered;
48+
int32_t req_state;
49+
int32_t req_lock;
50+
bool req_throttle_sends;
51+
int32_t req_pipeline_depth;
52+
size_t req_bytes_delivered;
5353
uint32_t req_rdma_cnt;
5454
mca_pml_ob1_send_pending_t req_pending;
5555
opal_mutex_t req_send_range_lock;

0 commit comments

Comments
 (0)