Skip to content

Commit 75e5632

Browse files
committed
opal_config_asm.m4: consolidate+document the --enable-cross-* options
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 <[email protected]>
1 parent 8c5de45 commit 75e5632

File tree

2 files changed

+57
-9
lines changed

2 files changed

+57
-9
lines changed

README

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1382,6 +1382,21 @@ MISCELLANEOUS FUNCTIONALITY
13821382
There are other ways to configure Open MPI's wrapper compiler
13831383
behavior; see the Open MPI FAQ for more information.
13841384

1385+
--enable-cross-cmpset128
1386+
--enable-cross-cmpxchg16b
1387+
1388+
WARNING: These options are not intended for most users. They are
1389+
not typical --enable-FOO flags, specifically in that using the
1390+
--disable-FOO form of these options is disallowed. These flags can
1391+
*ONLY* be used in their --enable-FOO form.
1392+
1393+
When used, these flags tells Open MPI's configure script to skip
1394+
part of the check for 128-bit atomics and just assume that 128-bit
1395+
atomics fully work. This should only be necessary in
1396+
cross-compiling environments (where configure can *compile* and
1397+
*link* the test, but can't actually *run* the test to verify full
1398+
functionality).
1399+
13851400
There are many other options available -- see "./configure --help".
13861401

13871402
Changing the compilers that Open MPI uses to build itself uses the

config/opal_config_asm.m4

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,11 @@ AC_DEFUN([OPAL_CHECK_SYNC_BUILTIN_CSWAP_INT128], [
2929
3030
OPAL_VAR_SCOPE_PUSH([sync_bool_compare_and_swap_128_result CFLAGS_save LDFLAGS_save])
3131
32-
AC_ARG_ENABLE([cross-cmpset128],[AC_HELP_STRING([--enable-cross-cmpset128],
33-
[enable the use of the __sync builtin atomic compare-and-swap 128 when cross compiling])])
34-
3532
sync_bool_compare_and_swap_128_result=0
3633
3734
if test ! "$enable_cross_cmpset128" = "yes" ; then
35+
# Do this test if we can AC RUN_IFELSE (i.e., if we are not
36+
# cross-compiling).
3837
AC_MSG_CHECKING([for processor support of __sync builtin atomic compare-and-swap on 128-bit values])
3938
4039
AC_RUN_IFELSE([AC_LANG_PROGRAM([], [__int128 x = 0; __sync_bool_compare_and_swap (&x, 0, 1);])],
@@ -74,6 +73,12 @@ AC_DEFUN([OPAL_CHECK_SYNC_BUILTIN_CSWAP_INT128], [
7473
fi
7574
7675
else
76+
# If we get here, it means that the user has specified
77+
# --enable-cross-cmpset128, which means they specifically told
78+
# us to skip the "run" part of the test. If we can compile/link
79+
# the test, that's good enough. This is typically only needed
80+
# in cross-compiling scenarios.
81+
AC_MSG_WARN([--enable-cross-cmpset128 was specified; skipping the "run" part of the cmpset128 test])
7782
AC_MSG_CHECKING([for compiler support of __sync builtin atomic compare-and-swap on 128-bit values])
7883
7984
# Check if the compiler supports the __sync builtin
@@ -153,12 +158,11 @@ AC_DEFUN([OPAL_CHECK_GCC_BUILTIN_CSWAP_INT128], [
153158
154159
OPAL_VAR_SCOPE_PUSH([atomic_compare_exchange_n_128_result CFLAGS_save LDFLAGS_save])
155160
156-
AC_ARG_ENABLE([cross-cmpset128],[AC_HELP_STRING([--enable-cross-cmpset128],
157-
[enable the use of the __sync builtin atomic compare-and-swap 128 when cross compiling])])
158-
159161
atomic_compare_exchange_n_128_result=0
160162
161163
if test ! "$enable_cross_cmpset128" = "yes" ; then
164+
# Do this test if we can AC RUN_IFELSE (i.e., if we are not
165+
# cross-compiling).
162166
AC_MSG_CHECKING([for processor support of __atomic builtin atomic compare-and-swap on 128-bit values])
163167
164168
AC_RUN_IFELSE([AC_LANG_PROGRAM([], [__int128 x = 0, y = 0; __atomic_compare_exchange_n (&x, &y, 1, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED);])],
@@ -212,6 +216,12 @@ dnl before going into OPAL_CHECK_SYNC_BUILTIN_CSWAP_INT128
212216
fi
213217
214218
else
219+
# If we get here, it means that the user has specified
220+
# --enable-cross-cmpset128, which means they specifically told
221+
# us to skip the "run" part of the test. If we can compile/link
222+
# the test, that's good enough. This is typically only needed
223+
# in cross-compiling scenarios.
224+
AC_MSG_WARN([--enable-cross-cmpset128 was specified; skipping the "run" part of the cmpset128 test])
215225
AC_MSG_CHECKING([for compiler support of __atomic builtin atomic compare-and-swap on 128-bit values])
216226
217227
# Check if the compiler supports the __atomic builtin
@@ -814,10 +824,9 @@ dnl #################################################################
814824
AC_DEFUN([OPAL_CHECK_CMPXCHG16B],[
815825
OPAL_VAR_SCOPE_PUSH([cmpxchg16b_result])
816826
817-
AC_ARG_ENABLE([cross-cmpxchg16b],[AC_HELP_STRING([--enable-cross-cmpxchg16b],
818-
[enable the use of the cmpxchg16b instruction when cross compiling])])
819-
820827
if test ! "$enable_cross_cmpxchg16b" = "yes" ; then
828+
# Do this test if we can AC RUN_IFELSE (i.e., if we are not
829+
# cross-compiling).
821830
AC_MSG_CHECKING([if processor supports x86_64 16-byte compare-and-exchange])
822831
AC_RUN_IFELSE([AC_LANG_PROGRAM([[unsigned char tmp[16];]],[[
823832
__asm__ __volatile__ ("lock cmpxchg16b (%%rsi)" : : "S" (tmp) : "memory", "cc");]])],
@@ -828,6 +837,12 @@ AC_DEFUN([OPAL_CHECK_CMPXCHG16B],[
828837
[AC_MSG_RESULT([no (cross-compiling)])
829838
cmpxchg16b_result=0])
830839
else
840+
# If we get here, it means that the user has specified
841+
# --enable-cross-cmpxchng12b, which means they specifically told
842+
# us to skip the "run" part of the test. If we can compile/link
843+
# the test, that's good enough. This is typically only needed
844+
# in cross-compiling scenarios.
845+
AC_MSG_WARN([--enable-cross-cmpxchg16b was specified; skipping the "run" part of the 16-byte compare-and-exchange test])
831846
AC_MSG_CHECKING([if assembler supports x86_64 16-byte compare-and-exchange])
832847
833848
OPAL_TRY_ASSEMBLE([$opal_cv_asm_text
@@ -981,6 +996,24 @@ AC_DEFUN([OPAL_CONFIG_ASM],[
981996
[AC_HELP_STRING([--enable-builtin-atomics],
982997
[Enable use of __sync builtin atomics (default: enabled)])])
983998
999+
AC_ARG_ENABLE([cross-cmpset128],
1000+
[AC_HELP_STRING([--enable-cross-cmpset128],
1001+
[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).])])
1002+
1003+
AS_IF([test "$enable_cross_cmpset128" = "no"],
1004+
[AC_MSG_WARN([the CLI option --disable-cross-cmpset128 is not permitted])
1005+
AC_MSG_WARN([please see "./configure --help" and/or the README file])
1006+
AC_MSG_ERROR([Cannot continue])])
1007+
1008+
AC_ARG_ENABLE([cross-cmpxchg16b],
1009+
[AC_HELP_STRING([--enable-cross-cmpxchg16b],
1010+
[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).])])
1011+
1012+
AS_IF([test "$enable_cross_cmpxchg16b" = "no"],
1013+
[AC_MSG_WARN([the CLI option --disable-cross-cmpxchg12b is not permitted])
1014+
AC_MSG_WARN([please see "./configure --help" and/or the README file])
1015+
AC_MSG_ERROR([Cannot continue])])
1016+
9841017
opal_cv_asm_builtin="BUILTIN_NO"
9851018
AS_IF([test "$opal_cv_asm_builtin" = "BUILTIN_NO" && test "$enable_builtin_atomics" != "no"],
9861019
[OPAL_CHECK_GCC_ATOMIC_BUILTINS([opal_cv_asm_builtin="BUILTIN_GCC"], [])])

0 commit comments

Comments
 (0)