Skip to content

Commit 5cb72aa

Browse files
authored
Merge pull request #4552 from hjelmn/asm_cleanup2
Add atomic fetch-and-op and compare-exchange functions
2 parents 0fcc996 + 7893248 commit 5cb72aa

File tree

110 files changed

+1509
-1441
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+1509
-1441
lines changed

ompi/datatype/ompi_datatype_args.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Copyright (c) 2004-2006 The Regents of the University of California.
1212
* All rights reserved.
1313
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
14-
* Copyright (c) 2013-2016 Los Alamos National Security, LLC. All rights
14+
* Copyright (c) 2013-2017 Los Alamos National Security, LLC. All rights
1515
* reserved.
1616
* Copyright (c) 2015-2017 Research Organization for Information Science
1717
* and Technology (RIST). All rights reserved.
@@ -378,7 +378,7 @@ int32_t ompi_datatype_copy_args( const ompi_datatype_t* source_data,
378378
* a read only memory).
379379
*/
380380
if( NULL != pArgs ) {
381-
OPAL_THREAD_ADD32(&pArgs->ref_count, 1);
381+
OPAL_THREAD_ADD_FETCH32(&pArgs->ref_count, 1);
382382
dest_data->args = pArgs;
383383
}
384384
return OMPI_SUCCESS;
@@ -396,7 +396,7 @@ int32_t ompi_datatype_release_args( ompi_datatype_t* pData )
396396
ompi_datatype_args_t* pArgs = (ompi_datatype_args_t*)pData->args;
397397

398398
assert( 0 < pArgs->ref_count );
399-
OPAL_THREAD_ADD32(&pArgs->ref_count, -1);
399+
OPAL_THREAD_ADD_FETCH32(&pArgs->ref_count, -1);
400400
if( 0 == pArgs->ref_count ) {
401401
/* There are some duplicated datatypes around that have a pointer to this
402402
* args. We will release them only when the last datatype will dissapear.
@@ -487,7 +487,8 @@ int ompi_datatype_get_pack_description( ompi_datatype_t* datatype,
487487
void* recursive_buffer;
488488

489489
if (NULL == packed_description) {
490-
if (opal_atomic_bool_cmpset (&datatype->packed_description, NULL, (void *) 1)) {
490+
void *_tmp_ptr = NULL;
491+
if (opal_atomic_compare_exchange_strong_ptr (&datatype->packed_description, (void *) &_tmp_ptr, (void *) 1)) {
491492
if( ompi_datatype_is_predefined(datatype) ) {
492493
packed_description = malloc(2 * sizeof(int));
493494
} else if( NULL == args ) {

ompi/group/group.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* Copyright (c) 2007-2017 Cisco Systems, Inc. All rights reserved
1515
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
1616
* Copyright (c) 2012 Oak Ridge National Labs. All rights reserved.
17-
* Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights
17+
* Copyright (c) 2013-2017 Los Alamos National Security, LLC. All rights
1818
* reserved.
1919
* Copyright (c) 2016 Research Organization for Information Science
2020
* and Technology (RIST). All rights reserved.
@@ -356,7 +356,7 @@ static inline struct ompi_proc_t *ompi_group_dense_lookup (ompi_group_t *group,
356356
ompi_proc_t *real_proc =
357357
(ompi_proc_t *) ompi_proc_for_name (ompi_proc_sentinel_to_name ((uintptr_t) proc));
358358

359-
if (opal_atomic_bool_cmpset_ptr (group->grp_proc_pointers + peer_id, proc, real_proc)) {
359+
if (opal_atomic_compare_exchange_strong_ptr (group->grp_proc_pointers + peer_id, &proc, real_proc)) {
360360
OBJ_RETAIN(real_proc);
361361
}
362362

ompi/mca/coll/libnbc/coll_libnbc_component.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ libnbc_module_destruct(ompi_coll_libnbc_module_t *module)
314314
/* if we ever were used for a collective op, do the progress cleanup. */
315315
if (true == module->comm_registered) {
316316
int32_t tmp =
317-
OPAL_THREAD_ADD32(&mca_coll_libnbc_component.active_comms, -1);
317+
OPAL_THREAD_ADD_FETCH32(&mca_coll_libnbc_component.active_comms, -1);
318318
if (0 == tmp) {
319319
opal_progress_unregister(ompi_coll_libnbc_progress);
320320
}

ompi/mca/coll/libnbc/nbc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ int NBC_Init_handle(struct ompi_communicator_t *comm, ompi_coll_libnbc_request_t
618618
/* register progress */
619619
if (need_register) {
620620
int32_t tmp =
621-
OPAL_THREAD_ADD32(&mca_coll_libnbc_component.active_comms, 1);
621+
OPAL_THREAD_ADD_FETCH32(&mca_coll_libnbc_component.active_comms, 1);
622622
if (tmp == 1) {
623623
opal_progress_register(ompi_coll_libnbc_progress);
624624
}

ompi/mca/coll/monitoring/coll_monitoring_component.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ static int
120120
mca_coll_monitoring_module_enable(mca_coll_base_module_t*module, struct ompi_communicator_t*comm)
121121
{
122122
mca_coll_monitoring_module_t*monitoring_module = (mca_coll_monitoring_module_t*) module;
123-
if( 1 == opal_atomic_add_32(&monitoring_module->is_initialized, 1) ) {
123+
if( 1 == opal_atomic_add_fetch_32(&monitoring_module->is_initialized, 1) ) {
124124
MONITORING_SAVE_FULL_PREV_COLL_API(monitoring_module, comm);
125125
monitoring_module->data = mca_common_monitoring_coll_new(comm);
126126
OPAL_MONITORING_PRINT_INFO("coll_module_enabled");
@@ -132,7 +132,7 @@ static int
132132
mca_coll_monitoring_module_disable(mca_coll_base_module_t*module, struct ompi_communicator_t*comm)
133133
{
134134
mca_coll_monitoring_module_t*monitoring_module = (mca_coll_monitoring_module_t*) module;
135-
if( 0 == opal_atomic_sub_32(&monitoring_module->is_initialized, 1) ) {
135+
if( 0 == opal_atomic_sub_fetch_32(&monitoring_module->is_initialized, 1) ) {
136136
MONITORING_RELEASE_FULL_PREV_COLL_API(monitoring_module, comm);
137137
mca_common_monitoring_coll_release(monitoring_module->data);
138138
monitoring_module->data = NULL;

ompi/mca/coll/portals4/coll_portals4_allreduce.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ allreduce_kary_tree_top(const void *sendbuf, void *recvbuf, int count,
6868
zero_md_h = mca_coll_portals4_component.zero_md_h;
6969
data_md_h = mca_coll_portals4_component.data_md_h;
7070

71-
internal_count = opal_atomic_add_size_t(&module->coll_count, 1);
71+
internal_count = opal_atomic_add_fetch_size_t(&module->coll_count, 1);
7272

7373
/*
7474
** DATATYPE and SIZES

ompi/mca/coll/portals4/coll_portals4_barrier.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ barrier_hypercube_top(struct ompi_communicator_t *comm,
4444

4545
request->type = OMPI_COLL_PORTALS4_TYPE_BARRIER;
4646

47-
count = opal_atomic_add_size_t(&portals4_module->coll_count, 1);
47+
count = opal_atomic_add_fetch_size_t(&portals4_module->coll_count, 1);
4848

4949
ret = PtlCTAlloc(mca_coll_portals4_component.ni_h,
5050
&request->u.barrier.rtr_ct_h);

ompi/mca/coll/portals4/coll_portals4_bcast.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ bcast_kary_tree_top(void *buff, int count,
176176
zero_md_h = mca_coll_portals4_component.zero_md_h;
177177
data_md_h = mca_coll_portals4_component.data_md_h;
178178

179-
internal_count = opal_atomic_add_size_t(&portals4_module->coll_count, 1);
179+
internal_count = opal_atomic_add_fetch_size_t(&portals4_module->coll_count, 1);
180180

181181

182182
/*
@@ -513,7 +513,7 @@ bcast_pipeline_top(void *buff, int count,
513513
zero_md_h = mca_coll_portals4_component.zero_md_h;
514514
data_md_h = mca_coll_portals4_component.data_md_h;
515515

516-
internal_count = opal_atomic_add_size_t(&portals4_module->coll_count, 1);
516+
internal_count = opal_atomic_add_fetch_size_t(&portals4_module->coll_count, 1);
517517

518518
/*
519519
** DATATYPE and SIZES

ompi/mca/coll/portals4/coll_portals4_gather.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ ompi_coll_portals4_gather_intra_binomial_top(const void *sbuf, int scount, struc
582582
/* Setup Common Parameters */
583583
/**********************************/
584584

585-
request->u.gather.coll_count = opal_atomic_add_size_t(&portals4_module->coll_count, 1);
585+
request->u.gather.coll_count = opal_atomic_add_fetch_size_t(&portals4_module->coll_count, 1);
586586

587587
COLL_PORTALS4_UPDATE_IN_ORDER_BMTREE( comm, portals4_module, request->u.gather.root_rank );
588588
bmtree = portals4_module->cached_in_order_bmtree;
@@ -879,7 +879,7 @@ ompi_coll_portals4_gather_intra_linear_top(const void *sbuf, int scount, struct
879879

880880
i_am_root = (request->u.gather.my_rank == request->u.gather.root_rank);
881881

882-
request->u.gather.coll_count = opal_atomic_add_size_t(&portals4_module->coll_count, 1);
882+
request->u.gather.coll_count = opal_atomic_add_fetch_size_t(&portals4_module->coll_count, 1);
883883

884884
ret = setup_gather_buffers_linear(comm, request, portals4_module);
885885
if (MPI_SUCCESS != ret) { line = __LINE__; goto err_hdlr; }

ompi/mca/coll/portals4/coll_portals4_reduce.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ reduce_kary_tree_top(const void *sendbuf, void *recvbuf, int count,
6969
zero_md_h = mca_coll_portals4_component.zero_md_h;
7070
data_md_h = mca_coll_portals4_component.data_md_h;
7171

72-
internal_count = opal_atomic_add_size_t(&module->coll_count, 1);
72+
internal_count = opal_atomic_add_fetch_size_t(&module->coll_count, 1);
7373

7474
/*
7575
** DATATYPE and SIZES

ompi/mca/coll/portals4/coll_portals4_scatter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ ompi_coll_portals4_scatter_intra_linear_top(const void *sbuf, int scount, struct
399399

400400
i_am_root = (request->u.scatter.my_rank == request->u.scatter.root_rank);
401401

402-
request->u.scatter.coll_count = opal_atomic_add_size_t(&portals4_module->coll_count, 1);
402+
request->u.scatter.coll_count = opal_atomic_add_fetch_size_t(&portals4_module->coll_count, 1);
403403

404404
ret = setup_scatter_buffers_linear(comm, request, portals4_module);
405405
if (MPI_SUCCESS != ret) { line = __LINE__; goto err_hdlr; }

ompi/mca/coll/sm/coll_sm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ extern uint32_t mca_coll_sm_one;
358358
* Macro to release an in-use flag from this process
359359
*/
360360
#define FLAG_RELEASE(flag) \
361-
(void)opal_atomic_add(&(flag)->mcsiuf_num_procs_using, -1)
361+
opal_atomic_add(&(flag)->mcsiuf_num_procs_using, -1)
362362

363363
/**
364364
* Macro to copy a single segment in from a user buffer to a shared

ompi/mca/coll/sm/coll_sm_barrier.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ int mca_coll_sm_barrier_intra(struct ompi_communicator_t *comm,
101101
if (0 != rank) {
102102
/* Get parent *in* buffer */
103103
parent = &data->mcb_barrier_control_parent[buffer_set];
104-
(void)opal_atomic_add(parent, 1);
104+
opal_atomic_add (parent, 1);
105105

106106
SPIN_CONDITION(0 != *me_out, exit_label2);
107107
*me_out = 0;

ompi/mca/coll/sm/coll_sm_module.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ int ompi_coll_sm_lazy_enable(mca_coll_base_module_t *module,
463463
OBJ_RETAIN(sm_module->previous_reduce_module);
464464

465465
/* Indicate that we have successfully attached and setup */
466-
(void)opal_atomic_add(&(data->sm_bootstrap_meta->module_seg->seg_inited), 1);
466+
opal_atomic_add (&(data->sm_bootstrap_meta->module_seg->seg_inited), 1);
467467

468468
/* Wait for everyone in this communicator to attach and setup */
469469
opal_output_verbose(10, ompi_coll_base_framework.framework_output,

ompi/mca/common/monitoring/common_monitoring.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ static int mca_common_monitoring_comm_size_notify(mca_base_pvar_t *pvar,
209209
int mca_common_monitoring_init( void )
210210
{
211211
if( !mca_common_monitoring_enabled ) return OMPI_ERROR;
212-
if( 1 < opal_atomic_add_32(&mca_common_monitoring_hold, 1) ) return OMPI_SUCCESS; /* Already initialized */
212+
if( 1 < opal_atomic_add_fetch_32(&mca_common_monitoring_hold, 1) ) return OMPI_SUCCESS; /* Already initialized */
213213

214214
char hostname[OPAL_MAXHOSTNAMELEN] = "NA";
215215
/* Initialize constant */
@@ -229,7 +229,7 @@ int mca_common_monitoring_init( void )
229229
void mca_common_monitoring_finalize( void )
230230
{
231231
if( ! mca_common_monitoring_enabled || /* Don't release if not last */
232-
0 < opal_atomic_sub_32(&mca_common_monitoring_hold, 1) ) return;
232+
0 < opal_atomic_sub_fetch_32(&mca_common_monitoring_hold, 1) ) return;
233233

234234
OPAL_MONITORING_PRINT_INFO("common_component_finish");
235235
/* Dump monitoring informations */
@@ -503,21 +503,21 @@ void mca_common_monitoring_record_pml(int world_rank, size_t data_size, int tag)
503503

504504
/* Keep tracks of the data_size distribution */
505505
if( 0 == data_size ) {
506-
opal_atomic_add_size_t(&size_histogram[world_rank * max_size_histogram], 1);
506+
opal_atomic_add_fetch_size_t(&size_histogram[world_rank * max_size_histogram], 1);
507507
} else {
508508
int log2_size = log10(data_size)/log10_2;
509509
if(log2_size > max_size_histogram - 2) /* Avoid out-of-bound write */
510510
log2_size = max_size_histogram - 2;
511-
opal_atomic_add_size_t(&size_histogram[world_rank * max_size_histogram + log2_size + 1], 1);
511+
opal_atomic_add_fetch_size_t(&size_histogram[world_rank * max_size_histogram + log2_size + 1], 1);
512512
}
513513

514514
/* distinguishses positive and negative tags if requested */
515515
if( (tag < 0) && (mca_common_monitoring_filter()) ) {
516-
opal_atomic_add_size_t(&filtered_pml_data[world_rank], data_size);
517-
opal_atomic_add_size_t(&filtered_pml_count[world_rank], 1);
516+
opal_atomic_add_fetch_size_t(&filtered_pml_data[world_rank], data_size);
517+
opal_atomic_add_fetch_size_t(&filtered_pml_count[world_rank], 1);
518518
} else { /* if filtered monitoring is not activated data is aggregated indifferently */
519-
opal_atomic_add_size_t(&pml_data[world_rank], data_size);
520-
opal_atomic_add_size_t(&pml_count[world_rank], 1);
519+
opal_atomic_add_fetch_size_t(&pml_data[world_rank], data_size);
520+
opal_atomic_add_fetch_size_t(&pml_count[world_rank], 1);
521521
}
522522
}
523523

@@ -564,11 +564,11 @@ void mca_common_monitoring_record_osc(int world_rank, size_t data_size,
564564
if( 0 == mca_common_monitoring_current_state ) return; /* right now the monitoring is not started */
565565

566566
if( SEND == dir ) {
567-
opal_atomic_add_size_t(&osc_data_s[world_rank], data_size);
568-
opal_atomic_add_size_t(&osc_count_s[world_rank], 1);
567+
opal_atomic_add_fetch_size_t(&osc_data_s[world_rank], data_size);
568+
opal_atomic_add_fetch_size_t(&osc_count_s[world_rank], 1);
569569
} else {
570-
opal_atomic_add_size_t(&osc_data_r[world_rank], data_size);
571-
opal_atomic_add_size_t(&osc_count_r[world_rank], 1);
570+
opal_atomic_add_fetch_size_t(&osc_data_r[world_rank], data_size);
571+
opal_atomic_add_fetch_size_t(&osc_count_r[world_rank], 1);
572572
}
573573
}
574574

@@ -650,8 +650,8 @@ void mca_common_monitoring_record_coll(int world_rank, size_t data_size)
650650
{
651651
if( 0 == mca_common_monitoring_current_state ) return; /* right now the monitoring is not started */
652652

653-
opal_atomic_add_size_t(&coll_data[world_rank], data_size);
654-
opal_atomic_add_size_t(&coll_count[world_rank], 1);
653+
opal_atomic_add_fetch_size_t(&coll_data[world_rank], data_size);
654+
opal_atomic_add_fetch_size_t(&coll_count[world_rank], 1);
655655
}
656656

657657
static int mca_common_monitoring_get_coll_count(const struct mca_base_pvar_t *pvar,

ompi/mca/common/monitoring/common_monitoring_coll.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,8 @@ void mca_common_monitoring_coll_o2a(size_t size, mca_monitoring_coll_data_t*data
236236
return;
237237
}
238238
#endif /* OPAL_ENABLE_DEBUG */
239-
opal_atomic_add_size_t(&data->o2a_size, size);
240-
opal_atomic_add_size_t(&data->o2a_count, 1);
239+
opal_atomic_add_fetch_size_t(&data->o2a_size, size);
240+
opal_atomic_add_fetch_size_t(&data->o2a_count, 1);
241241
}
242242

243243
int mca_common_monitoring_coll_get_o2a_count(const struct mca_base_pvar_t *pvar,
@@ -277,8 +277,8 @@ void mca_common_monitoring_coll_a2o(size_t size, mca_monitoring_coll_data_t*data
277277
return;
278278
}
279279
#endif /* OPAL_ENABLE_DEBUG */
280-
opal_atomic_add_size_t(&data->a2o_size, size);
281-
opal_atomic_add_size_t(&data->a2o_count, 1);
280+
opal_atomic_add_fetch_size_t(&data->a2o_size, size);
281+
opal_atomic_add_fetch_size_t(&data->a2o_count, 1);
282282
}
283283

284284
int mca_common_monitoring_coll_get_a2o_count(const struct mca_base_pvar_t *pvar,
@@ -318,8 +318,8 @@ void mca_common_monitoring_coll_a2a(size_t size, mca_monitoring_coll_data_t*data
318318
return;
319319
}
320320
#endif /* OPAL_ENABLE_DEBUG */
321-
opal_atomic_add_size_t(&data->a2a_size, size);
322-
opal_atomic_add_size_t(&data->a2a_count, 1);
321+
opal_atomic_add_fetch_size_t(&data->a2a_size, size);
322+
opal_atomic_add_fetch_size_t(&data->a2a_count, 1);
323323
}
324324

325325
int mca_common_monitoring_coll_get_a2a_count(const struct mca_base_pvar_t *pvar,

ompi/mca/mtl/portals4/mtl_portals4_flowctl.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
22
/*
33
* Copyright (c) 2012 Sandia National Laboratories. All rights reserved.
4-
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
4+
* Copyright (c) 2015-2017 Los Alamos National Security, LLC. All rights
55
* reserved.
66
* $COPYRIGHT$
77
*
@@ -296,9 +296,10 @@ ompi_mtl_portals4_flowctl_add_procs(size_t me,
296296
int
297297
ompi_mtl_portals4_flowctl_trigger(void)
298298
{
299+
int32_t _tmp_value = 0;
299300
int ret;
300301

301-
if (true == OPAL_ATOMIC_BOOL_CMPSET_32(&ompi_mtl_portals4.flowctl.flowctl_active, false, true)) {
302+
if (true == OPAL_ATOMIC_COMPARE_EXCHANGE_STRONG_32(&ompi_mtl_portals4.flowctl.flowctl_active, &_tmp_value, 1)) {
302303
/* send trigger to root */
303304
ret = PtlPut(ompi_mtl_portals4.zero_md_h,
304305
0,
@@ -346,7 +347,7 @@ start_recover(void)
346347
int64_t epoch_counter;
347348

348349
ompi_mtl_portals4.flowctl.flowctl_active = true;
349-
epoch_counter = opal_atomic_add_64(&ompi_mtl_portals4.flowctl.epoch_counter, 1);
350+
epoch_counter = opal_atomic_add_fetch_64(&ompi_mtl_portals4.flowctl.epoch_counter, 1);
350351

351352
opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
352353
"Entering flowctl_start_recover %ld",

ompi/mca/mtl/portals4/mtl_portals4_recv.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ read_msg(void *start, ptl_size_t length, ptl_process_t target,
5353
int32_t frag_count;
5454

5555
#if OMPI_MTL_PORTALS4_FLOW_CONTROL
56-
while (OPAL_UNLIKELY(OPAL_THREAD_ADD32(&ompi_mtl_portals4.flowctl.send_slots, -1) < 0)) {
57-
OPAL_THREAD_ADD32(&ompi_mtl_portals4.flowctl.send_slots, 1);
56+
while (OPAL_UNLIKELY(OPAL_THREAD_ADD_FETCH32(&ompi_mtl_portals4.flowctl.send_slots, -1) < 0)) {
57+
OPAL_THREAD_ADD_FETCH32(&ompi_mtl_portals4.flowctl.send_slots, 1);
5858
ompi_mtl_portals4_progress();
5959
}
6060
#endif
6161

6262
frag_count = (length + ompi_mtl_portals4.max_msg_size_mtl - 1) / ompi_mtl_portals4.max_msg_size_mtl;
63-
ret = OPAL_THREAD_ADD32(&(request->pending_reply), frag_count);
63+
ret = OPAL_THREAD_ADD_FETCH32(&(request->pending_reply), frag_count);
6464

6565
for (i = 0 ; i < frag_count ; i++) {
6666
opal_free_list_item_t *tmp;
@@ -385,14 +385,14 @@ ompi_mtl_portals4_rndv_get_frag_progress(ptl_event_t *ev,
385385
opal_free_list_return (&ompi_mtl_portals4.fl_rndv_get_frag,
386386
&rndv_get_frag->super);
387387

388-
ret = OPAL_THREAD_ADD32(&(ptl_request->pending_reply), -1);
388+
ret = OPAL_THREAD_ADD_FETCH32(&(ptl_request->pending_reply), -1);
389389
if (ret > 0) {
390390
return OMPI_SUCCESS;
391391
}
392392
assert(ptl_request->pending_reply == 0);
393393

394394
#if OMPI_MTL_PORTALS4_FLOW_CONTROL
395-
OPAL_THREAD_ADD32(&ompi_mtl_portals4.flowctl.send_slots, 1);
395+
OPAL_THREAD_ADD_FETCH32(&ompi_mtl_portals4.flowctl.send_slots, 1);
396396
#endif
397397

398398
/* make sure the data is in the right place. Use _ucount for
@@ -468,7 +468,7 @@ ompi_mtl_portals4_irecv(struct mca_mtl_base_module_t* mtl,
468468
ptl_request->super.type = portals4_req_recv;
469469
ptl_request->super.event_callback = ompi_mtl_portals4_recv_progress;
470470
#if OPAL_ENABLE_DEBUG
471-
ptl_request->opcount = OPAL_THREAD_ADD64((int64_t*) &ompi_mtl_portals4.recv_opcount, 1);
471+
ptl_request->opcount = OPAL_THREAD_ADD_FETCH64((int64_t*) &ompi_mtl_portals4.recv_opcount, 1);
472472
ptl_request->hdr_data = 0;
473473
#endif
474474
ptl_request->buffer_ptr = (free_after) ? start : NULL;
@@ -549,7 +549,7 @@ ompi_mtl_portals4_imrecv(struct mca_mtl_base_module_t* mtl,
549549
}
550550

551551
#if OPAL_ENABLE_DEBUG
552-
ptl_request->opcount = OPAL_THREAD_ADD64((int64_t*) &ompi_mtl_portals4.recv_opcount, 1);
552+
ptl_request->opcount = OPAL_THREAD_ADD_FETCH64((int64_t*) &ompi_mtl_portals4.recv_opcount, 1);
553553
ptl_request->hdr_data = 0;
554554
#endif
555555
ptl_request->super.type = portals4_req_recv;

0 commit comments

Comments
 (0)