Skip to content

Commit a6695d5

Browse files
committed
Clean out OPAL_HAVE_ATOMIC_MATH_* macros
These macros are no longer relevant as all platforms have both 32 and 64-bit atomic math. This is required by Open MPI. Signed-off-by: Nathan Hjelm <[email protected]>
1 parent b4ba4de commit a6695d5

File tree

14 files changed

+4
-158
lines changed

14 files changed

+4
-158
lines changed

ompi/mca/osc/rdma/osc_rdma_frag.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,7 @@ static inline void ompi_osc_rdma_frag_complete (ompi_osc_rdma_frag_t *frag)
2525
opal_atomic_rmb ();
2626

2727
(void) opal_atomic_swap_32 (&frag->pending, 1);
28-
#if OPAL_HAVE_ATOMIC_MATH_64
2928
(void) opal_atomic_swap_64 (&frag->curr_index, 0);
30-
#else
31-
(void) opal_atomic_swap_32 (&frag->curr_index, 0);
32-
#endif
3329
}
3430
}
3531

@@ -88,11 +84,7 @@ static inline int ompi_osc_rdma_frag_alloc (ompi_osc_rdma_module_t *module, size
8884
OSC_RDMA_VERBOSE(MCA_BASE_VERBOSE_INFO, "allocating frag. pending = %d", curr->pending);
8985
OPAL_THREAD_ADD_FETCH32(&curr->pending, 1);
9086

91-
#if OPAL_HAVE_ATOMIC_MATH_64
9287
my_index = opal_atomic_fetch_add_64 (&curr->curr_index, request_len);
93-
#else
94-
my_index = opal_atomic_fetch_add_32 (&curr->curr_index, request_len);
95-
#endif
9688
if (my_index + request_len > mca_osc_rdma_component.buffer_size) {
9789
if (my_index <= mca_osc_rdma_component.buffer_size) {
9890
/* this thread caused the buffer to spill over */

ompi/mca/osc/rdma/osc_rdma_types.h

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -21,28 +21,13 @@ struct ompi_osc_rdma_frag_t;
2121
struct ompi_osc_rdma_sync_t;
2222
struct ompi_osc_rdma_peer_t;
2323

24-
#if OPAL_HAVE_ATOMIC_MATH_64
25-
2624
typedef int64_t osc_rdma_base_t;
2725
typedef uint64_t osc_rdma_size_t;
2826
typedef int64_t osc_rdma_counter_t;
2927
typedef opal_atomic_int64_t osc_rdma_atomic_counter_t;
3028

3129
#define ompi_osc_rdma_counter_add opal_atomic_add_fetch_64
3230

33-
#else
34-
35-
typedef int32_t osc_rdma_base_t;
36-
typedef uint32_t osc_rdma_size_t;
37-
typedef int32_t osc_rdma_counter_t;
38-
typedef opal_atomic_int32_t osc_rdma_atomic_counter_t;
39-
40-
#define ompi_osc_rdma_counter_add opal_atomic_add_fetch_32
41-
42-
#endif
43-
44-
#if OPAL_HAVE_ATOMIC_MATH_64
45-
4631
#define OMPI_OSC_RDMA_LOCK_EXCLUSIVE 0x8000000000000000l
4732

4833
typedef int64_t ompi_osc_rdma_lock_t;
@@ -70,38 +55,6 @@ static inline int ompi_osc_rdma_lock_compare_exchange (opal_atomic_int64_t *p, i
7055
return ret;
7156
}
7257

73-
#else
74-
75-
#define OMPI_OSC_RDMA_LOCK_EXCLUSIVE 0x80000000l
76-
77-
typedef int32_t ompi_osc_rdma_lock_t;
78-
typedef opal_atomic_int32_t ompi_osc_rdma_atomic_lock_t;
79-
80-
static inline int32_t ompi_osc_rdma_lock_add (opal_atomic_int32_t *p, int32_t value)
81-
{
82-
int32_t new;
83-
84-
opal_atomic_mb ();
85-
/* opal_atomic_add_fetch_32 differs from normal atomics in that is returns the new value */
86-
new = opal_atomic_add_fetch_32 (p, value) - value;
87-
opal_atomic_mb ();
88-
89-
return new;
90-
}
91-
92-
static inline int ompi_osc_rdma_lock_compare_exchange (opal_atomic_int32_t *p, int32_t *comp, int32_t value)
93-
{
94-
int ret;
95-
96-
opal_atomic_mb ();
97-
ret = opal_atomic_compare_exchange_strong_32 (p, comp, value);
98-
opal_atomic_mb ();
99-
100-
return ret;
101-
}
102-
103-
#endif /* OPAL_HAVE_ATOMIC_MATH_64 */
104-
10558
/**
10659
* @brief structure describing a window memory region
10760
*/
@@ -219,11 +172,7 @@ struct ompi_osc_rdma_frag_t {
219172

220173
/* Number of operations which have started writing into the frag, but not yet completed doing so */
221174
opal_atomic_int32_t pending;
222-
#if OPAL_HAVE_ATOMIC_MATH_64
223175
opal_atomic_int64_t curr_index;
224-
#else
225-
opal_atomic_int32_t curr_index;
226-
#endif
227176

228177
struct ompi_osc_rdma_module_t *module;
229178
mca_btl_base_registration_handle_t *handle;

ompi/mca/osc/sm/osc_sm.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,11 @@
1818

1919
#include "opal/mca/shmem/base/base.h"
2020

21-
#if OPAL_HAVE_ATOMIC_MATH_64
22-
2321
typedef uint64_t osc_sm_post_type_t;
2422
typedef opal_atomic_uint64_t osc_sm_post_atomic_type_t;
2523
#define OSC_SM_POST_BITS 6
2624
#define OSC_SM_POST_MASK 0x3f
2725

28-
#else
29-
30-
typedef uint32_t osc_sm_post_type_t;
31-
typedef opal_atomic_uint32_t osc_sm_post_atomic_type_t;
32-
#define OSC_SM_POST_BITS 5
33-
#define OSC_SM_POST_MASK 0x1f
34-
35-
#endif
36-
3726
/* data shared across all peers */
3827
struct ompi_osc_sm_global_state_t {
3928
int use_barrier_for_fence;

ompi/mca/osc/sm/osc_sm_active_target.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,7 @@ ompi_osc_sm_start(struct ompi_group_t *group,
161161

162162
opal_atomic_rmb ();
163163

164-
#if OPAL_HAVE_ATOMIC_MATH_64
165164
(void) opal_atomic_fetch_xor_64 ((opal_atomic_int64_t *) module->posts[my_rank] + rank_byte, rank_bit);
166-
#else
167-
(void) opal_atomic_fetch_xor_32 ((opal_atomic_int32_t *) module->posts[my_rank] + rank_byte, rank_bit);
168-
#endif
169165
}
170166

171167
free (ranks);
@@ -247,11 +243,7 @@ ompi_osc_sm_post(struct ompi_group_t *group,
247243

248244
gsize = ompi_group_size(module->post_group);
249245
for (int i = 0 ; i < gsize ; ++i) {
250-
#if OPAL_HAVE_ATOMIC_MATH_64
251246
(void) opal_atomic_fetch_add_64 ((opal_atomic_int64_t *) module->posts[ranks[i]] + my_byte, my_bit);
252-
#else
253-
(void) opal_atomic_fetch_add_32 ((opal_atomic_int32_t *) module->posts[ranks[i]] + my_byte, my_bit);
254-
#endif
255247
}
256248

257249
opal_atomic_wmb ();

opal/include/opal/sys/arm64/atomic.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
# define OPAL_HAVE_ATOMIC_MEM_BARRIER 1
3535
# define OPAL_HAVE_ATOMIC_COMPARE_EXCHANGE_32 1
3636
# define OPAL_HAVE_ATOMIC_SWAP_32 1
37-
# define OPAL_HAVE_ATOMIC_MATH_32 1
3837
# define OPAL_HAVE_ATOMIC_COMPARE_EXCHANGE_64 1
3938
# define OPAL_HAVE_ATOMIC_SWAP_64 1
4039
# define OPAL_HAVE_ATOMIC_ADD_32 1

opal/include/opal/sys/atomic.h

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* reserved.
1717
* Copyright (c) 2017 Research Organization for Information Science
1818
* and Technology (RIST). All rights reserved.
19-
* Copyright (c) 2020 Google, LLC. All rights reserved.
19+
* Copyright (c) 2020-2021 Google, LLC. All rights reserved.
2020
* $COPYRIGHT$
2121
*
2222
* Additional copyrights may follow
@@ -41,8 +41,6 @@
4141
*
4242
* - \c OPAL_HAVE_ATOMIC_MEM_BARRIER atomic memory barriers
4343
* - \c OPAL_HAVE_ATOMIC_SPINLOCKS atomic spinlocks
44-
* - \c OPAL_HAVE_ATOMIC_MATH_32 if 32 bit add/sub/compare-exchange can be done "atomicly"
45-
* - \c OPAL_HAVE_ATOMIC_MATH_64 if 64 bit add/sub/compare-exchange can be done "atomicly"
4644
*
4745
* Note that for the Atomic math, atomic add/sub may be implemented as
4846
* C code using opal_atomic_compare_exchange. The appearance of atomic
@@ -396,13 +394,6 @@ static inline
396394

397395
# endif
398396

399-
# if !defined(OPAL_HAVE_ATOMIC_MATH_32) && !defined(DOXYGEN)
400-
/* define to 0 for these tests. WIll fix up later. */
401-
# define OPAL_HAVE_ATOMIC_MATH_32 0
402-
# endif
403-
404-
# if defined(DOXYGEN) || OPAL_HAVE_ATOMIC_MATH_32 || OPAL_HAVE_ATOMIC_COMPARE_EXCHANGE_32
405-
406397
static inline int32_t opal_atomic_add_fetch_32(opal_atomic_int32_t *addr, int delta);
407398
static inline int32_t opal_atomic_fetch_add_32(opal_atomic_int32_t *addr, int delta);
408399
static inline int32_t opal_atomic_and_fetch_32(opal_atomic_int32_t *addr, int32_t value);
@@ -418,20 +409,6 @@ static inline int32_t opal_atomic_fetch_min_32(opal_atomic_int32_t *addr, int32_
418409
static inline int32_t opal_atomic_max_fetch_32(opal_atomic_int32_t *addr, int32_t value);
419410
static inline int32_t opal_atomic_fetch_max_32(opal_atomic_int32_t *addr, int32_t value);
420411

421-
# endif /* OPAL_HAVE_ATOMIC_MATH_32 */
422-
423-
# if !OPAL_HAVE_ATOMIC_MATH_32
424-
/* fix up the value of opal_have_atomic_math_32 to allow for C versions */
425-
# undef OPAL_HAVE_ATOMIC_MATH_32
426-
# define OPAL_HAVE_ATOMIC_MATH_32 OPAL_HAVE_ATOMIC_COMPARE_EXCHANGE_32
427-
# endif
428-
429-
# ifndef OPAL_HAVE_ATOMIC_MATH_64
430-
/* define to 0 for these tests. WIll fix up later. */
431-
# define OPAL_HAVE_ATOMIC_MATH_64 0
432-
# endif
433-
434-
# if defined(DOXYGEN) || OPAL_HAVE_ATOMIC_MATH_64 || OPAL_HAVE_ATOMIC_COMPARE_EXCHANGE_64
435412

436413
static inline int64_t opal_atomic_add_fetch_64(opal_atomic_int64_t *addr, int64_t delta);
437414
static inline int64_t opal_atomic_fetch_add_64(opal_atomic_int64_t *addr, int64_t delta);
@@ -447,13 +424,6 @@ static inline int64_t opal_atomic_fetch_min_64(opal_atomic_int64_t *addr, int64_
447424
static inline int64_t opal_atomic_max_fetch_64(opal_atomic_int64_t *addr, int64_t value);
448425
static inline int64_t opal_atomic_fetch_max_64(opal_atomic_int64_t *addr, int64_t value);
449426

450-
# endif /* OPAL_HAVE_ATOMIC_MATH_64 */
451-
452-
# if !OPAL_HAVE_ATOMIC_MATH_64
453-
/* fix up the value of opal_have_atomic_math_64 to allow for C versions */
454-
# undef OPAL_HAVE_ATOMIC_MATH_64
455-
# define OPAL_HAVE_ATOMIC_MATH_64 OPAL_HAVE_ATOMIC_COMPARE_EXCHANGE_64
456-
# endif
457427

458428
/* provide a size_t add/subtract. When in debug mode, make it an
459429
* inline function so that we don't have any casts in the
@@ -607,8 +577,6 @@ static inline bool opal_atomic_compare_exchange_strong_rel_ptr(opal_atomic_intpt
607577

608578
# endif /* (OPAL_HAVE_ATOMIC_COMPARE_EXCHANGE_32 || OPAL_HAVE_ATOMIC_COMPARE_EXCHANGE_64) */
609579

610-
# if defined(DOXYGEN) || (OPAL_HAVE_ATOMIC_MATH_32 || OPAL_HAVE_ATOMIC_MATH_64)
611-
612580
static inline void opal_atomic_add_xx(opal_atomic_intptr_t *addr, int32_t value, size_t length);
613581
static inline void opal_atomic_sub_xx(opal_atomic_intptr_t *addr, int32_t value, size_t length);
614582

@@ -643,7 +611,6 @@ static inline intptr_t opal_atomic_fetch_sub_ptr(opal_atomic_intptr_t *addr, voi
643611
# define opal_atomic_sub(ADDR, VALUE) \
644612
opal_atomic_sub_xx((opal_atomic_intptr_t *) (ADDR), (int32_t)(VALUE), sizeof(*(ADDR)))
645613

646-
# endif /* OPAL_HAVE_ATOMIC_MATH_32 || OPAL_HAVE_ATOMIC_MATH_64 */
647614

648615
/*
649616
* Include inline implementations of everything not defined directly

opal/include/opal/sys/atomic_impl.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -311,8 +311,6 @@ OPAL_ATOMIC_DEFINE_CMPXCG_PTR_XX(_rel_)
311311

312312
#endif /* (OPAL_HAVE_ATOMIC_SWAP_32 || OPAL_HAVE_ATOMIC_SWAP_64) */
313313

314-
#if OPAL_HAVE_ATOMIC_MATH_32 || OPAL_HAVE_ATOMIC_MATH_64
315-
316314
static inline void opal_atomic_add_xx(opal_atomic_intptr_t *addr, int32_t value, size_t length)
317315
{
318316
switch (length) {
@@ -380,7 +378,6 @@ static inline int32_t opal_atomic_max_fetch_32(opal_atomic_int32_t *addr, int32_
380378
return old >= value ? old : value;
381379
}
382380

383-
# if OPAL_HAVE_ATOMIC_MATH_64
384381
OPAL_ATOMIC_DEFINE_OP_FETCH(add, +, int64_t, int64_t, 64)
385382
OPAL_ATOMIC_DEFINE_OP_FETCH(and, &, int64_t, int64_t, 64)
386383
OPAL_ATOMIC_DEFINE_OP_FETCH(or, |, int64_t, int64_t, 64)
@@ -399,8 +396,6 @@ static inline int64_t opal_atomic_max_fetch_64(opal_atomic_int64_t *addr, int64_
399396
return old >= value ? old : value;
400397
}
401398

402-
# endif
403-
404399
static inline intptr_t opal_atomic_fetch_add_ptr(opal_atomic_intptr_t *addr, void *delta)
405400
{
406401
# if SIZEOF_VOID_P == 4 && OPAL_HAVE_ATOMIC_ADD_32
@@ -449,7 +444,6 @@ static inline intptr_t opal_atomic_sub_fetch_ptr(opal_atomic_intptr_t *addr, voi
449444
# endif
450445
}
451446

452-
#endif /* OPAL_HAVE_ATOMIC_MATH_32 || OPAL_HAVE_ATOMIC_MATH_64 */
453447

454448
/**********************************************************************
455449
*

opal/include/opal/sys/atomic_stdc.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* reserved.
55
* Copyright (c) 2018 Research Organization for Information Science
66
* and Technology (RIST). All rights reserved.
7-
* Copyright (c) 2019 Google, LLC. All rights reserved.
7+
* Copyright (c) 2019-2021 Google, LLC. All rights reserved.
88
* Copyright (c) 2019 Triad National Security, LLC. All rights
99
* reserved.
1010
* $COPYRIGHT$
@@ -35,7 +35,6 @@
3535
# define OPAL_HAVE_ATOMIC_COMPARE_EXCHANGE_32 1
3636
# define OPAL_HAVE_ATOMIC_SWAP_32 1
3737

38-
# define OPAL_HAVE_ATOMIC_MATH_32 1
3938
# define OPAL_HAVE_ATOMIC_ADD_32 1
4039
# define OPAL_HAVE_ATOMIC_AND_32 1
4140
# define OPAL_HAVE_ATOMIC_OR_32 1
@@ -45,7 +44,6 @@
4544
# define OPAL_HAVE_ATOMIC_COMPARE_EXCHANGE_64 1
4645
# define OPAL_HAVE_ATOMIC_SWAP_64 1
4746

48-
# define OPAL_HAVE_ATOMIC_MATH_64 1
4947
# define OPAL_HAVE_ATOMIC_ADD_64 1
5048
# define OPAL_HAVE_ATOMIC_AND_64 1
5149
# define OPAL_HAVE_ATOMIC_OR_64 1

opal/include/opal/sys/gcc_builtin/atomic.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* and Technology (RIST). All rights reserved.
1818
* Copyright (c) 2018 Triad National Security, LLC. All rights
1919
* reserved.
20+
* Copyright (c) 2021 Google, LLC. All rights reserved.
2021
* $COPYRIGHT$
2122
*
2223
* Additional copyrights may follow
@@ -34,15 +35,13 @@
3435
*********************************************************************/
3536
#define OPAL_HAVE_ATOMIC_MEM_BARRIER 1
3637

37-
#define OPAL_HAVE_ATOMIC_MATH_32 1
3838
#define OPAL_HAVE_ATOMIC_COMPARE_EXCHANGE_32 1
3939
#define OPAL_HAVE_ATOMIC_ADD_32 1
4040
#define OPAL_HAVE_ATOMIC_AND_32 1
4141
#define OPAL_HAVE_ATOMIC_OR_32 1
4242
#define OPAL_HAVE_ATOMIC_XOR_32 1
4343
#define OPAL_HAVE_ATOMIC_SUB_32 1
4444
#define OPAL_HAVE_ATOMIC_SWAP_32 1
45-
#define OPAL_HAVE_ATOMIC_MATH_64 1
4645
#define OPAL_HAVE_ATOMIC_COMPARE_EXCHANGE_64 1
4746
#define OPAL_HAVE_ATOMIC_ADD_64 1
4847
#define OPAL_HAVE_ATOMIC_AND_64 1

opal/include/opal/sys/powerpc/atomic.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
#define OPAL_HAVE_ATOMIC_SWAP_32 1
4545
#define OPAL_HAVE_ATOMIC_LLSC_32 1
4646

47-
#define OPAL_HAVE_ATOMIC_MATH_32 1
4847
#define OPAL_HAVE_ATOMIC_ADD_32 1
4948
#define OPAL_HAVE_ATOMIC_AND_32 1
5049
#define OPAL_HAVE_ATOMIC_OR_32 1
@@ -53,7 +52,6 @@
5352
#define OPAL_HAVE_ATOMIC_COMPARE_EXCHANGE_64 1
5453
#define OPAL_HAVE_ATOMIC_SWAP_64 1
5554
#define OPAL_HAVE_ATOMIC_LLSC_64 1
56-
#define OPAL_HAVE_ATOMIC_MATH_64 1
5755
#define OPAL_HAVE_ATOMIC_ADD_64 1
5856
#define OPAL_HAVE_ATOMIC_AND_64 1
5957
#define OPAL_HAVE_ATOMIC_OR_64 1

opal/include/opal/sys/x86_64/atomic.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* reserved.
1616
* Copyright (c) 2016-2017 Research Organization for Information Science
1717
* and Technology (RIST). All rights reserved.
18+
* Copyright (c) 2021 Google, LLC. All rights reserved.
1819
* $COPYRIGHT$
1920
*
2021
* Additional copyrights may follow
@@ -169,9 +170,6 @@ static inline int64_t opal_atomic_swap_64(opal_atomic_int64_t *addr, int64_t new
169170

170171
#if OPAL_GCC_INLINE_ASSEMBLY
171172

172-
# define OPAL_HAVE_ATOMIC_MATH_32 1
173-
# define OPAL_HAVE_ATOMIC_MATH_64 1
174-
175173
# define OPAL_HAVE_ATOMIC_ADD_32 1
176174

177175
/**

opal/mca/threads/thread_usage.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,6 @@ OPAL_THREAD_DEFINE_ATOMIC_SWAP(intptr_t, intptr_t, ptr)
211211
#define OPAL_THREAD_SWAP_PTR(x, y) opal_thread_swap_ptr((opal_atomic_intptr_t *) x, (intptr_t) y)
212212
#define OPAL_ATOMIC_SWAP_PTR OPAL_THREAD_SWAP_PTR
213213

214-
/* define 64-bit macros is 64-bit atomic math is available */
215-
#if OPAL_HAVE_ATOMIC_MATH_64
216-
217214
OPAL_THREAD_DEFINE_ATOMIC_OP(int64_t, add, +, 64)
218215
OPAL_THREAD_DEFINE_ATOMIC_OP(int64_t, and, &, 64)
219216
OPAL_THREAD_DEFINE_ATOMIC_OP(int64_t, or, |, 64)
@@ -252,8 +249,6 @@ OPAL_THREAD_DEFINE_ATOMIC_SWAP(int64_t, int64_t, 64)
252249
# define OPAL_THREAD_SWAP_64 opal_thread_swap_64
253250
# define OPAL_ATOMIC_SWAP_64 opal_thread_swap_64
254251

255-
#endif
256-
257252
/* thread local storage */
258253
#if OPAL_C_HAVE__THREAD_LOCAL
259254
# define opal_thread_local _Thread_local

0 commit comments

Comments
 (0)