Skip to content

Commit ca545d1

Browse files
committed
Remove old MB() macro
In the early days of OMPI, we used MB/WMB/RMB macros instead of the opal_atomic_* functions that most of the code uses today. Remove the last few places that the MB defines were used and then remove the defines themselves. Signed-off-by: Brian Barrett <[email protected]>
1 parent 6e5cf17 commit ca545d1

File tree

5 files changed

+16
-23
lines changed

5 files changed

+16
-23
lines changed

ompi/patterns/net/allreduce.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
* All rights reserved.
66
* Copyright (c) 2017 IBM Corporation. All rights reserved.
77
* Copyright (c) 2019 Intel, Inc. All rights reserved.
8+
* Copyright (c) 2022 Amazon.com, Inc. or its affiliates.
9+
* All Rights reserved.
810
* $COPYRIGHT$
911
*
1012
* Additional copyrights may follow
@@ -34,7 +36,7 @@ void recv_completion(nt status, struct ompi_process_name_t* peer, struct iovec*
3436
int count, ompi_rml_tag_t tag, void* cbdata)
3537
{
3638
/* set receive completion flag */
37-
MB();
39+
opal_atomic_mb();
3840
*(int *)cbdata=1;
3941
}
4042

@@ -232,7 +234,7 @@ comm_allreduce(void *sbuf, void *rbuf, int count, opal_datatype_t *dtype,
232234
send_buffer^=1;
233235
}
234236

235-
MB();
237+
opal_atomic_mb();
236238
/*
237239
* Signal parent that data is ready
238240
*/
@@ -255,7 +257,7 @@ comm_allreduce(void *sbuf, void *rbuf, int count, opal_datatype_t *dtype,
255257

256258
*recv_done=0;
257259
*send_done=0;
258-
MB();
260+
opal_atomic_mb();
259261

260262
/* post non-blocking receive */
261263
recv_iov.iov_base=scratch_bufers[send_buffer];

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

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@
4646
#define OPAL_HAVE_ATOMIC_XOR_64 1
4747
#define OPAL_HAVE_ATOMIC_SUB_64 1
4848

49-
#define MB() __asm__ __volatile__("dmb sy" : : : "memory")
50-
#define RMB() __asm__ __volatile__("dmb ld" : : : "memory")
51-
#define WMB() __asm__ __volatile__("dmb st" : : : "memory")
52-
5349
/**********************************************************************
5450
*
5551
* Memory Barriers
@@ -58,17 +54,17 @@
5854

5955
static inline void opal_atomic_mb(void)
6056
{
61-
MB();
57+
__asm__ __volatile__("dmb sy" : : : "memory");
6258
}
6359

6460
static inline void opal_atomic_rmb(void)
6561
{
66-
RMB();
62+
__asm__ __volatile__("dmb ld" : : : "memory");
6763
}
6864

6965
static inline void opal_atomic_wmb(void)
7066
{
71-
WMB();
67+
__asm__ __volatile__("dmb st" : : : "memory");
7268
}
7369

7470
static inline void opal_atomic_isync(void)

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ static inline void opal_atomic_wmb(void)
7777
__atomic_thread_fence(__ATOMIC_RELEASE);
7878
}
7979

80-
#define MB() opal_atomic_mb()
8180

8281
/**********************************************************************
8382
*

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

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@
3030
* On powerpc ...
3131
*/
3232

33-
#define MB() __asm__ __volatile__("sync" : : : "memory")
34-
#define RMB() __asm__ __volatile__ ("isync" : : : "memory")
35-
#define WMB() __asm__ __volatile__("lwsync" : : : "memory")
36-
#define ISYNC() __asm__ __volatile__("isync" : : : "memory")
37-
3833
/**********************************************************************
3934
*
4035
* Define constants for PowerPC 64
@@ -68,22 +63,22 @@
6863

6964
static inline void opal_atomic_mb(void)
7065
{
71-
MB();
66+
__asm__ __volatile__("sync" : : : "memory");
7267
}
7368

7469
static inline void opal_atomic_rmb(void)
7570
{
76-
RMB();
71+
__asm__ __volatile__ ("isync" : : : "memory");
7772
}
7873

7974
static inline void opal_atomic_wmb(void)
8075
{
81-
WMB();
76+
__asm__ __volatile__("lwsync" : : : "memory");
8277
}
8378

8479
static inline void opal_atomic_isync(void)
8580
{
86-
ISYNC();
81+
__asm__ __volatile__("isync" : : : "memory");
8782
}
8883

8984

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
* Copyright (c) 2016-2017 Research Organization for Information Science
1717
* and Technology (RIST). All rights reserved.
1818
* Copyright (c) 2021 Google, LLC. All rights reserved.
19+
* Copyright (c) 2022 Amazon.com, Inc. or its affiliates.
20+
* All Rights reserved.
1921
* $COPYRIGHT$
2022
*
2123
* Additional copyrights may follow
@@ -30,7 +32,6 @@
3032
*/
3133

3234
#define SMPLOCK "lock; "
33-
#define MB() __asm__ __volatile__("" : : : "memory")
3435

3536
/**********************************************************************
3637
*
@@ -56,12 +57,12 @@ static inline void opal_atomic_mb(void)
5657

5758
static inline void opal_atomic_rmb(void)
5859
{
59-
MB();
60+
__asm__ __volatile__("" : : : "memory");
6061
}
6162

6263
static inline void opal_atomic_wmb(void)
6364
{
64-
MB();
65+
__asm__ __volatile__("" : : : "memory");
6566
}
6667

6768
static inline void opal_atomic_isync(void)

0 commit comments

Comments
 (0)