Skip to content

Commit

Permalink
opal_config_asm.m4: consolidate+document the --enable-cross-* options
Browse files Browse the repository at this point in the history
Put some comments in about exactly what the --enable-cross-* options
are doing (because they're weird).  Also explicitly disallow the use
of --disable-cross-FOO (see the README / AS_HELP_MESSAGE for a
description of why).  Also add compete information to the "./configure
--help" output about what these options do/do not do, and put a
modified version of that same help message in the README.

Finally, consolidate a little bit of the AC_ARG_ENABLE code in
opal_config_asm.m4 file to reduce a little redundancy.

Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
  • Loading branch information
jsquyres committed Aug 16, 2018
1 parent 8c5de45 commit 3f69c40
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 9 deletions.
14 changes: 14 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -1382,6 +1382,20 @@ MISCELLANEOUS FUNCTIONALITY
There are other ways to configure Open MPI's wrapper compiler
behavior; see the Open MPI FAQ for more information.

--enable-cross-cmpset128
--enable-cross-cmpxchg16b
WARNING: These options are not intended for most users. They are
not typical --enable-FOO flags, specifically in that using the
--disable-FOO form of these options is disallowed. These flags can
*ONLY* be used in their --enable-FOO form.

When used, these flags tell Open MPI's configure script to skip
part of the check for 128-bit atomics and just assume that 128-bit
atomics fully work. This should only be necessary in
cross-compiling environments (where configure can *compile* and
*link* the test, but can't actually *run* the test to verify full
functionality).

There are many other options available -- see "./configure --help".

Changing the compilers that Open MPI uses to build itself uses the
Expand Down
51 changes: 42 additions & 9 deletions config/opal_config_asm.m4
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,11 @@ AC_DEFUN([OPAL_CHECK_SYNC_BUILTIN_CSWAP_INT128], [
OPAL_VAR_SCOPE_PUSH([sync_bool_compare_and_swap_128_result CFLAGS_save LDFLAGS_save])
AC_ARG_ENABLE([cross-cmpset128],[AC_HELP_STRING([--enable-cross-cmpset128],
[enable the use of the __sync builtin atomic compare-and-swap 128 when cross compiling])])
sync_bool_compare_and_swap_128_result=0
if test ! "$enable_cross_cmpset128" = "yes" ; then
# Do this test if we can AC RUN_IFELSE (i.e., if we are not
# cross-compiling).
AC_MSG_CHECKING([for processor support of __sync builtin atomic compare-and-swap on 128-bit values])
AC_RUN_IFELSE([AC_LANG_PROGRAM([], [__int128 x = 0; __sync_bool_compare_and_swap (&x, 0, 1);])],
Expand Down Expand Up @@ -74,6 +73,12 @@ AC_DEFUN([OPAL_CHECK_SYNC_BUILTIN_CSWAP_INT128], [
fi
else
# If we get here, it means that the user has specified
# --enable-cross-cmpset128, which means they specifically told
# us to skip the "run" part of the test. If we can compile/link
# the test, that's good enough. This is typically only needed
# in cross-compiling scenarios.
AC_MSG_WARN([--enable-cross-cmpset128 was specified; skipping the "run" part of the cmpset128 test])
AC_MSG_CHECKING([for compiler support of __sync builtin atomic compare-and-swap on 128-bit values])
# Check if the compiler supports the __sync builtin
Expand Down Expand Up @@ -153,12 +158,11 @@ AC_DEFUN([OPAL_CHECK_GCC_BUILTIN_CSWAP_INT128], [
OPAL_VAR_SCOPE_PUSH([atomic_compare_exchange_n_128_result CFLAGS_save LDFLAGS_save])
AC_ARG_ENABLE([cross-cmpset128],[AC_HELP_STRING([--enable-cross-cmpset128],
[enable the use of the __sync builtin atomic compare-and-swap 128 when cross compiling])])
atomic_compare_exchange_n_128_result=0
if test ! "$enable_cross_cmpset128" = "yes" ; then
# Do this test if we can AC RUN_IFELSE (i.e., if we are not
# cross-compiling).
AC_MSG_CHECKING([for processor support of __atomic builtin atomic compare-and-swap on 128-bit values])
AC_RUN_IFELSE([AC_LANG_PROGRAM([], [__int128 x = 0, y = 0; __atomic_compare_exchange_n (&x, &y, 1, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED);])],
Expand Down Expand Up @@ -212,6 +216,12 @@ dnl before going into OPAL_CHECK_SYNC_BUILTIN_CSWAP_INT128
fi
else
# If we get here, it means that the user has specified
# --enable-cross-cmpset128, which means they specifically told
# us to skip the "run" part of the test. If we can compile/link
# the test, that's good enough. This is typically only needed
# in cross-compiling scenarios.
AC_MSG_WARN([--enable-cross-cmpset128 was specified; skipping the "run" part of the cmpset128 test])
AC_MSG_CHECKING([for compiler support of __atomic builtin atomic compare-and-swap on 128-bit values])
# Check if the compiler supports the __atomic builtin
Expand Down Expand Up @@ -814,10 +824,9 @@ dnl #################################################################
AC_DEFUN([OPAL_CHECK_CMPXCHG16B],[
OPAL_VAR_SCOPE_PUSH([cmpxchg16b_result])
AC_ARG_ENABLE([cross-cmpxchg16b],[AC_HELP_STRING([--enable-cross-cmpxchg16b],
[enable the use of the cmpxchg16b instruction when cross compiling])])
if test ! "$enable_cross_cmpxchg16b" = "yes" ; then
# Do this test if we can AC RUN_IFELSE (i.e., if we are not
# cross-compiling).
AC_MSG_CHECKING([if processor supports x86_64 16-byte compare-and-exchange])
AC_RUN_IFELSE([AC_LANG_PROGRAM([[unsigned char tmp[16];]],[[
__asm__ __volatile__ ("lock cmpxchg16b (%%rsi)" : : "S" (tmp) : "memory", "cc");]])],
Expand All @@ -828,6 +837,12 @@ AC_DEFUN([OPAL_CHECK_CMPXCHG16B],[
[AC_MSG_RESULT([no (cross-compiling)])
cmpxchg16b_result=0])
else
# If we get here, it means that the user has specified
# --enable-cross-cmpxchng12b, which means they specifically told
# us to skip the "run" part of the test. If we can compile/link
# the test, that's good enough. This is typically only needed
# in cross-compiling scenarios.
AC_MSG_WARN([--enable-cross-cmpxchg16b was specified; skipping the "run" part of the 16-byte compare-and-exchange test])
AC_MSG_CHECKING([if assembler supports x86_64 16-byte compare-and-exchange])
OPAL_TRY_ASSEMBLE([$opal_cv_asm_text
Expand Down Expand Up @@ -981,6 +996,24 @@ AC_DEFUN([OPAL_CONFIG_ASM],[
[AC_HELP_STRING([--enable-builtin-atomics],
[Enable use of __sync builtin atomics (default: enabled)])])
AC_ARG_ENABLE([cross-cmpset128],
[AC_HELP_STRING([--enable-cross-cmpset128],
[WARNING: This option is not intended for most users. It is not a typical --enable-FOO flag, specifically in that using --disable-FOO is disallowed. This flag can *ONLY* be used in its --enable form. When used, this flag tells Open MPI's configure script to skip part of the check for 128-bit atomics and just assume that 128-bit atomics fully work. This should only be necessary in cross-compiling environments (where configure can *compile* and *link* the test, but can't actually *run* the test to verify full functionality).])])
AS_IF([test "$enable_cross_cmpset128" = "no"],
[AC_MSG_WARN([the CLI option --disable-cross-cmpset128 is not permitted])
AC_MSG_WARN([please see "./configure --help" and/or the README file])
AC_MSG_ERROR([Cannot continue])])
AC_ARG_ENABLE([cross-cmpxchg16b],
[AC_HELP_STRING([--enable-cross-cmpxchg16b],
[WARNING: This option is not intended for most users. It is not a typical --enable-FOO flag, specifically in that using --disable-FOO is disallowed. This flag can *ONLY* be used in its --enable form. When used, this flag tells Open MPI's configure script to skip part of the check for 128-bit atomics and just assume that 128-bit atomics fully work. This should only be necessary in cross-compiling environments (where configure can *compile* and *link* the test, but can't actually *run* the test to verify full functionality).])])
AS_IF([test "$enable_cross_cmpxchg16b" = "no"],
[AC_MSG_WARN([the CLI option --disable-cross-cmpxchg12b is not permitted])
AC_MSG_WARN([please see "./configure --help" and/or the README file])
AC_MSG_ERROR([Cannot continue])])
opal_cv_asm_builtin="BUILTIN_NO"
AS_IF([test "$opal_cv_asm_builtin" = "BUILTIN_NO" && test "$enable_builtin_atomics" != "no"],
[OPAL_CHECK_GCC_ATOMIC_BUILTINS([opal_cv_asm_builtin="BUILTIN_GCC"], [])])
Expand Down

0 comments on commit 3f69c40

Please sign in to comment.