Skip to content

Commit 3c7ea15

Browse files
committed
Powerpc atomics: Force usage of powerpc assembly.
The builtins used by default on Power have been shown to perform poorly. For the time being, force all compilers to use the inline assembly until atomic builtins catch-up. This changes the defaults for all compilers sans xl, including: gcc, clang, and pgi to use the assembly. Previously, all of the above were using C11 or the gcc builtins. Bonus: Add a configure flag to force Power machines to use the builtins/C11, depending on what is available. This will make future testing easier. Signed-off-by: Austen Lauria <[email protected]> (cherry picked from commit e3f3c5b)
1 parent cf7d9d2 commit 3c7ea15

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

config/opal_config_asm.m4

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,6 +1136,18 @@ AC_DEFUN([OPAL_CONFIG_ASM],[
11361136
AC_MSG_ERROR([Could not determine PowerPC word size: $ac_cv_sizeof_long])
11371137
fi
11381138
OPAL_GCC_INLINE_ASSIGN='"1: li %0,0" : "=&r"(ret)'
1139+
1140+
# See the following github PR and some performance numbers/discussion:
1141+
# https://github.com/open-mpi/ompi/pull/8649
1142+
AC_MSG_CHECKING([$opal_cv_asm_arch: Checking if force gcc atomics requested])
1143+
if test $force_gcc_atomics_ppc = 0 ; then
1144+
AC_MSG_RESULT([no])
1145+
opal_cv_asm_builtin="BUILTIN_NO"
1146+
else
1147+
AC_MSG_RESULT([Yes])
1148+
AC_MSG_WARN([$opal_cv_asm_arch: gcc atomics have been known to perform poorly on powerpc.])
1149+
fi
1150+
11391151
;;
11401152
# There is no current difference between s390 and s390x
11411153
# But use two different defines in case some come later

config/opal_configure_options.m4

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,13 @@ else
8484
WANT_BRANCH_PROBABILITIES=0
8585
fi
8686

87+
AC_ARG_ENABLE([builtin-atomics-for-ppc],[AS_HELP_STRING([--enable-builtin-atomics-for-ppc],
88+
[POWER architectures only: Force use of builtin atomics if available. This could either be gcc builtins or C11 atomics, depending on what is available on your system. Enabling this is known to cause poor performance in atomic operations on Power machines. (default: disabled)])])
89+
if test "x$enable_builtin_atomics_for_ppc" = "xyes" ; then
90+
force_gcc_atomics_ppc=1
91+
else
92+
force_gcc_atomics_ppc=0
93+
fi
8794

8895
#
8996
# Memory debugging

0 commit comments

Comments
 (0)