Skip to content

Commit 3d7c509

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]>
1 parent 09eb050 commit 3d7c509

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

config/opal_config_asm.m4

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,6 +1192,18 @@ AC_DEFUN([OPAL_CONFIG_ASM],[
11921192
AC_MSG_ERROR([Could not determine PowerPC word size: $ac_cv_sizeof_long])
11931193
fi
11941194
OPAL_GCC_INLINE_ASSIGN='"1: li %0,0" : "=&r"(ret)'
1195+
1196+
# See the following github PR and some performance numbers/discussion:
1197+
# https://github.com/open-mpi/ompi/pull/8649
1198+
AC_MSG_CHECKING([$opal_cv_asm_arch: Checking if force gcc atomics requested])
1199+
if test $force_gcc_atomics_ppc = 0 ; then
1200+
AC_MSG_RESULT([no])
1201+
opal_cv_asm_builtin="BUILTIN_NO"
1202+
else
1203+
AC_MSG_RESULT([Yes])
1204+
AC_MSG_WARN([$opal_cv_asm_arch: gcc atomics have been known to perform poorly on powerpc.])
1205+
fi
1206+
11951207
;;
11961208
*)
11971209
if test $opal_cv_have___atomic = "yes" ; then

config/opal_configure_options.m4

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ 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
94+
8795

8896
#
8997
# Memory debugging

0 commit comments

Comments
 (0)