Skip to content

Exterminate all 32 bit platform support from opal atomic (IA32, ARM32, PowerPC32) #8722

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,13 @@ base as of this writing (April 2020):

* Open MPI requires a C99-capable compiler to build.

* On platforms other than x86-64, ARM, and PPC, Open MPI requires a
compiler that either supports C11 atomics or the GCC `__atomic`
atomics (e.g., GCC >= v4.7.2).
* On platforms other than x86-64, AArch64 (64-bit ARM), and PPC64,
Open MPI requires a compiler that either supports C11 atomics or
the GCC `__atomic` atomics (e.g., GCC >= v4.7.2).

* 32-bit platforms are only supported with a recent compiler that
supports C11 atomics. This includes gcc 4.9.x+ (gcc 6.x or newer
recommened), icc 16, clang 3.1+, etc.

* Mixing compilers from different vendors when building Open MPI
(e.g., using the C/C++ compiler from one vendor and the Fortran
Expand Down
121 changes: 22 additions & 99 deletions config/opal_config_asm.m4
Original file line number Diff line number Diff line change
Expand Up @@ -880,53 +880,6 @@ AC_DEFUN([OPAL_CHECK_POWERPC_REG],[
[Whether r notation is used for ppc registers])
])dnl


dnl #################################################################
dnl
dnl OPAL_CHECK_POWERPC_64BIT
dnl
dnl On some powerpc chips (the PPC970 or G5), the OS usually runs in
dnl 32 bit mode, even though the hardware can do 64bit things. If
dnl the compiler will let us, emit code for 64bit test and set type
dnl operations (on a long long).
dnl
dnl #################################################################
AC_DEFUN([OPAL_CHECK_POWERPC_64BIT],[
if test "$ac_cv_sizeof_long" != "4" ; then
# this function should only be called in the 32 bit case
AC_MSG_ERROR([CHECK_POWERPC_64BIT called on 64 bit platform. Internal error.])
fi
AC_MSG_CHECKING([for 64-bit PowerPC assembly support])
case $host in
*-darwin*)
ppc64_result=0
if test "$opal_cv_asm_powerpc_r_reg" = "1" ; then
ldarx_asm=" ldarx r1,r1,r1";
else
ldarx_asm=" ldarx 1,1,1";
fi
OPAL_TRY_ASSEMBLE([$opal_cv_asm_text
$ldarx_asm],
[ppc64_result=1],
[ppc64_result=0])
;;
*)
ppc64_result=0
;;
esac

if test "$ppc64_result" = "1" ; then
AC_MSG_RESULT([yes])
ifelse([$1],,:,[$1])
else
AC_MSG_RESULT([no])
ifelse([$2],,:,[$2])
fi

unset ppc64_result ldarx_asm
])dnl


dnl #################################################################
dnl
dnl OPAL_CHECK_CMPXCHG16B
Expand Down Expand Up @@ -1108,7 +1061,7 @@ AC_DEFUN([OPAL_CONFIG_ASM],[
AC_MSG_ERROR([Cannot continue])
elif test "$enable_builtin_atomics" = "yes" ; then
if test $opal_cv_have___atomic = "yes" ; then
opal_cv_asm_builtin="BUILTIN_GCC"
opal_cv_asm_builtin="BUILTIN_GCC"
else
AC_MSG_WARN([GCC built-in atomics requested but not found.])
AC_MSG_ERROR([Cannot continue])
Expand All @@ -1129,63 +1082,43 @@ AC_DEFUN([OPAL_CONFIG_ASM],[
# find our architecture for purposes of assembly stuff
opal_cv_asm_arch="UNSUPPORTED"
OPAL_GCC_INLINE_ASSIGN=""
if test "$opal_cv_have___atomic_64" ; then
OPAL_ASM_SUPPORT_64BIT=1
else
OPAL_ASM_SUPPORT_64BIT=0
fi

case "${host}" in
x86_64-*x32)
opal_cv_asm_arch="X86_64"
OPAL_ASM_SUPPORT_64BIT=1
OPAL_GCC_INLINE_ASSIGN='"xaddl %1,%0" : "=m"(ret), "+r"(negone) : "m"(ret)'
;;
i?86-*|x86_64*|amd64*)
x86_64-*x32|i?86-*|x86_64*|amd64*)
if test "$ac_cv_sizeof_long" = "4" ; then
opal_cv_asm_arch="IA32"
else
opal_cv_asm_arch="X86_64"
fi
OPAL_ASM_SUPPORT_64BIT=1
if test $opal_cv_asm_builtin = BUILTIN_NO ; then
AC_MSG_ERROR([IA32 atomics are no longer supported. Use a C11 compiler])
fi
opal_cv_asm_arch="IA32"
else
opal_cv_asm_arch="X86_64"
OPAL_CHECK_CMPXCHG16B
fi
OPAL_GCC_INLINE_ASSIGN='"xaddl %1,%0" : "=m"(ret), "+r"(negone) : "m"(ret)'
OPAL_CHECK_CMPXCHG16B
;;

aarch64*)
opal_cv_asm_arch="ARM64"
OPAL_ASM_SUPPORT_64BIT=1
OPAL_ASM_ARM_VERSION=8
OPAL_GCC_INLINE_ASSIGN='"mov %0, #0" : "=&r"(ret)'
;;

armv7*|arm-*-linux-gnueabihf)
opal_cv_asm_arch="ARM"
OPAL_ASM_SUPPORT_64BIT=1
OPAL_ASM_ARM_VERSION=7
OPAL_GCC_INLINE_ASSIGN='"mov %0, #0" : "=&r"(ret)'
;;
armv7*|arm-*-linux-gnueabihf|armv6*)
if test $opal_cv_asm_builtin = BUILTIN_NO ; then
AC_MSG_ERROR([32-bit ARM atomics are no longer supported. Use a C11 compiler])
fi

armv6*)
opal_cv_asm_arch="ARM"
OPAL_ASM_SUPPORT_64BIT=0
OPAL_ASM_ARM_VERSION=6
CCASFLAGS="$CCASFLAGS -march=armv7-a"
OPAL_GCC_INLINE_ASSIGN='"mov %0, #0" : "=&r"(ret)'
;;

powerpc-*|powerpc64-*|powerpcle-*|powerpc64le-*|rs6000-*|ppc-*)
OPAL_CHECK_POWERPC_REG
if test "$ac_cv_sizeof_long" = "4" ; then
opal_cv_asm_arch="POWERPC32"

# Note that on some platforms (Apple G5), even if we are
# compiling in 32 bit mode (and therefore should assume
# sizeof(long) == 4), we can use the 64 bit test and set
# operations.
OPAL_CHECK_POWERPC_64BIT(OPAL_ASM_SUPPORT_64BIT=1)
elif test "$ac_cv_sizeof_long" = "8" ; then
OPAL_ASM_SUPPORT_64BIT=1
if test $opal_cv_asm_builtin = BUILTIN_NO ; then
AC_MSG_ERROR([PowerPC 32-bit atomics are no longer supported. Use a C11 compiler])
fi
opal_cv_asm_arch="POWERPC32"
elif test "$ac_cv_sizeof_long" = "8" ; then
opal_cv_asm_arch="POWERPC64"
else
AC_MSG_ERROR([Could not determine PowerPC word size: $ac_cv_sizeof_long])
Expand Down Expand Up @@ -1213,20 +1146,10 @@ AC_DEFUN([OPAL_CONFIG_ASM],[
;;
esac

if ! test -z "$OPAL_ASM_ARM_VERSION" ; then
AC_DEFINE_UNQUOTED([OPAL_ASM_ARM_VERSION], [$OPAL_ASM_ARM_VERSION],
[What ARM assembly version to use])
fi

if test "$opal_cv_asm_builtin" = "BUILTIN_GCC" ; then
AC_DEFINE([OPAL_C_GCC_INLINE_ASSEMBLY], [1],
[Whether C compiler supports GCC style inline assembly])
else
AC_DEFINE_UNQUOTED([OPAL_ASM_SUPPORT_64BIT],
[$OPAL_ASM_SUPPORT_64BIT],
[Whether we can do 64bit assembly operations or not. Should not be used outside of the assembly header files])
AC_SUBST([OPAL_ASM_SUPPORT_64BIT])

opal_cv_asm_inline_supported="no"
# now that we know our architecture, try to inline assemble
OPAL_CHECK_INLINE_C_GCC([$OPAL_GCC_INLINE_ASSIGN])
Expand All @@ -1239,12 +1162,12 @@ AC_DEFUN([OPAL_CONFIG_ASM],[
asm_format="${asm_format}-${opal_cv_asm_lsym}"
asm_format="${asm_format}-${opal_cv_asm_type}-${opal_asm_size}"
asm_format="${asm_format}-${opal_asm_align_log_result}"
if test "$opal_cv_asm_arch" = "POWERPC32" || test "$opal_cv_asm_arch" = "POWERPC64" ; then
if test "$opal_cv_asm_arch" = "POWERPC64" ; then
asm_format="${asm_format}-${opal_cv_asm_powerpc_r_reg}"
else
asm_format="${asm_format}-1"
fi
asm_format="${asm_format}-${OPAL_ASM_SUPPORT_64BIT}"
asm_format="${asm_format}-1"
opal_cv_asm_format="${asm_format}-${opal_cv_asm_gnu_stack}"
# For the Makefile, need to escape the $ as $$. Don't display
# this version, but make sure the Makefile gives the right thing
Expand All @@ -1256,7 +1179,7 @@ AC_DEFUN([OPAL_CONFIG_ASM],[
AC_DEFINE_UNQUOTED([OPAL_ASSEMBLY_FORMAT], ["$OPAL_ASSEMBLY_FORMAT"],
[Format of assembly file])
AC_SUBST([OPAL_ASSEMBLY_FORMAT])
fi # if opal_cv_asm_builtin = BUILTIN_GCC
fi # if opal_cv_asm_builtin = BUILTIN_GCC

result="OPAL_$opal_cv_asm_arch"
OPAL_ASSEMBLY_ARCH="$opal_cv_asm_arch"
Expand Down
8 changes: 0 additions & 8 deletions ompi/mca/osc/rdma/osc_rdma_frag.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@ static inline void ompi_osc_rdma_frag_complete (ompi_osc_rdma_frag_t *frag)
opal_atomic_rmb ();

(void) opal_atomic_swap_32 (&frag->pending, 1);
#if OPAL_HAVE_ATOMIC_MATH_64
(void) opal_atomic_swap_64 (&frag->curr_index, 0);
#else
(void) opal_atomic_swap_32 (&frag->curr_index, 0);
#endif
}
}

Expand Down Expand Up @@ -88,11 +84,7 @@ static inline int ompi_osc_rdma_frag_alloc (ompi_osc_rdma_module_t *module, size
OSC_RDMA_VERBOSE(MCA_BASE_VERBOSE_INFO, "allocating frag. pending = %d", curr->pending);
OPAL_THREAD_ADD_FETCH32(&curr->pending, 1);

#if OPAL_HAVE_ATOMIC_MATH_64
my_index = opal_atomic_fetch_add_64 (&curr->curr_index, request_len);
#else
my_index = opal_atomic_fetch_add_32 (&curr->curr_index, request_len);
#endif
if (my_index + request_len > mca_osc_rdma_component.buffer_size) {
if (my_index <= mca_osc_rdma_component.buffer_size) {
/* this thread caused the buffer to spill over */
Expand Down
51 changes: 0 additions & 51 deletions ompi/mca/osc/rdma/osc_rdma_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,13 @@ struct ompi_osc_rdma_frag_t;
struct ompi_osc_rdma_sync_t;
struct ompi_osc_rdma_peer_t;

#if OPAL_HAVE_ATOMIC_MATH_64

typedef int64_t osc_rdma_base_t;
typedef uint64_t osc_rdma_size_t;
typedef int64_t osc_rdma_counter_t;
typedef opal_atomic_int64_t osc_rdma_atomic_counter_t;

#define ompi_osc_rdma_counter_add opal_atomic_add_fetch_64

#else

typedef int32_t osc_rdma_base_t;
typedef uint32_t osc_rdma_size_t;
typedef int32_t osc_rdma_counter_t;
typedef opal_atomic_int32_t osc_rdma_atomic_counter_t;

#define ompi_osc_rdma_counter_add opal_atomic_add_fetch_32

#endif

#if OPAL_HAVE_ATOMIC_MATH_64

#define OMPI_OSC_RDMA_LOCK_EXCLUSIVE 0x8000000000000000l

typedef int64_t ompi_osc_rdma_lock_t;
Expand Down Expand Up @@ -70,38 +55,6 @@ static inline int ompi_osc_rdma_lock_compare_exchange (opal_atomic_int64_t *p, i
return ret;
}

#else

#define OMPI_OSC_RDMA_LOCK_EXCLUSIVE 0x80000000l

typedef int32_t ompi_osc_rdma_lock_t;
typedef opal_atomic_int32_t ompi_osc_rdma_atomic_lock_t;

static inline int32_t ompi_osc_rdma_lock_add (opal_atomic_int32_t *p, int32_t value)
{
int32_t new;

opal_atomic_mb ();
/* opal_atomic_add_fetch_32 differs from normal atomics in that is returns the new value */
new = opal_atomic_add_fetch_32 (p, value) - value;
opal_atomic_mb ();

return new;
}

static inline int ompi_osc_rdma_lock_compare_exchange (opal_atomic_int32_t *p, int32_t *comp, int32_t value)
{
int ret;

opal_atomic_mb ();
ret = opal_atomic_compare_exchange_strong_32 (p, comp, value);
opal_atomic_mb ();

return ret;
}

#endif /* OPAL_HAVE_ATOMIC_MATH_64 */

/**
* @brief structure describing a window memory region
*/
Expand Down Expand Up @@ -219,11 +172,7 @@ struct ompi_osc_rdma_frag_t {

/* Number of operations which have started writing into the frag, but not yet completed doing so */
opal_atomic_int32_t pending;
#if OPAL_HAVE_ATOMIC_MATH_64
opal_atomic_int64_t curr_index;
#else
opal_atomic_int32_t curr_index;
#endif

struct ompi_osc_rdma_module_t *module;
mca_btl_base_registration_handle_t *handle;
Expand Down
11 changes: 0 additions & 11 deletions ompi/mca/osc/sm/osc_sm.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,11 @@

#include "opal/mca/shmem/base/base.h"

#if OPAL_HAVE_ATOMIC_MATH_64

typedef uint64_t osc_sm_post_type_t;
typedef opal_atomic_uint64_t osc_sm_post_atomic_type_t;
#define OSC_SM_POST_BITS 6
#define OSC_SM_POST_MASK 0x3f

#else

typedef uint32_t osc_sm_post_type_t;
typedef opal_atomic_uint32_t osc_sm_post_atomic_type_t;
#define OSC_SM_POST_BITS 5
#define OSC_SM_POST_MASK 0x1f

#endif

/* data shared across all peers */
struct ompi_osc_sm_global_state_t {
int use_barrier_for_fence;
Expand Down
8 changes: 0 additions & 8 deletions ompi/mca/osc/sm/osc_sm_active_target.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,7 @@ ompi_osc_sm_start(struct ompi_group_t *group,

opal_atomic_rmb ();

#if OPAL_HAVE_ATOMIC_MATH_64
(void) opal_atomic_fetch_xor_64 ((opal_atomic_int64_t *) module->posts[my_rank] + rank_byte, rank_bit);
#else
(void) opal_atomic_fetch_xor_32 ((opal_atomic_int32_t *) module->posts[my_rank] + rank_byte, rank_bit);
#endif
}

free (ranks);
Expand Down Expand Up @@ -247,11 +243,7 @@ ompi_osc_sm_post(struct ompi_group_t *group,

gsize = ompi_group_size(module->post_group);
for (int i = 0 ; i < gsize ; ++i) {
#if OPAL_HAVE_ATOMIC_MATH_64
(void) opal_atomic_fetch_add_64 ((opal_atomic_int64_t *) module->posts[ranks[i]] + my_byte, my_bit);
#else
(void) opal_atomic_fetch_add_32 ((opal_atomic_int32_t *) module->posts[ranks[i]] + my_byte, my_bit);
#endif
}

opal_atomic_wmb ();
Expand Down
4 changes: 1 addition & 3 deletions opal/include/opal/sys/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# reserved.
# Copyright (c) 2017 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# Copyright (c) 2020 Google, LLC. All rights reserved.
# Copyright (c) 2020-2021 Google, LLC. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
Expand All @@ -34,8 +34,6 @@ headers += \
opal/sys/cma.h

include opal/sys/x86_64/Makefile.am
include opal/sys/arm/Makefile.am
include opal/sys/arm64/Makefile.am
include opal/sys/ia32/Makefile.am
include opal/sys/powerpc/Makefile.am
include opal/sys/gcc_builtin/Makefile.am
Loading