Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
98e3c9e7
Commit
98e3c9e7
authored
Nov 29, 2023
by
Peter W. Draper
Browse files
Options
Downloads
Patches
Plain Diff
Support optimization for the AMD aocc compiler
parent
6c668b9d
Branches
Branches containing commit
Tags
Tags containing commit
3 merge requests
!1887
Updating . . .
,
!1878
updating working branch
,
!1823
Support optimization for the AMD aocc compiler
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
configure.ac
+59
-22
59 additions, 22 deletions
configure.ac
with
59 additions
and
22 deletions
configure.ac
+
59
−
22
View file @
98e3c9e7
...
@@ -97,16 +97,33 @@ fi
...
@@ -97,16 +97,33 @@ fi
AM_CONDITIONAL([HAVECSDS],[test $with_csds = "yes"])
AM_CONDITIONAL([HAVECSDS],[test $with_csds = "yes"])
# Use best known optimization for the current architecture. Actual optimization
# happens later so we can avoid any issues it introduces with the compiler,
# but we need to know if that will happen now.
AC_ARG_ENABLE([optimization],
[AS_HELP_STRING([--enable-optimization],
[Enable compile time optimization flags for host @<:@yes/no@:>@]
)],
[enable_opt="$enableval"],
[enable_opt="yes"]
)
# Interprocedural optimization support. Needs special handling for linking and
# Interprocedural optimization support. Can need special handling for linking
# archiving as well as compilation with Intels, needs to be done before
# and archiving as well as compilation. Needs to be done before libtool is
# libtool is configured (to use correct LD).
# configured so we use the correct LD. It can give good improvements for
# clang based compilers, so the default is enabled, but we make that
# disabled when not optimizing or debugging support is enabled.
enable_ipo_default="yes";
if test "x$ax_enable_debug" = "xyes" -o "x$enable_opt" != "xyes"; then
enable_ipo_default="no";
AC_MSG_WARN([Interprocedural optimization support default is changed to false])
fi
AC_ARG_ENABLE([ipo],
AC_ARG_ENABLE([ipo],
[AS_HELP_STRING([--enable-ipo],
[AS_HELP_STRING([--enable-ipo],
[Enable interprocedural optimization
@<:@no/yes@:>@
]
[Enable interprocedural optimization
[default=yes unless debugging]
]
)],
)],
[enable_ipo="$enableval"],
[enable_ipo="$enableval"],
[enable_ipo="
no
"]
[enable_ipo="
$enable_ipo_default
"]
)
)
if test "$enable_ipo" = "yes"; then
if test "$enable_ipo" = "yes"; then
...
@@ -132,8 +149,8 @@ if test "$enable_ipo" = "yes"; then
...
@@ -132,8 +149,8 @@ if test "$enable_ipo" = "yes"; then
], [:] )
], [:] )
AC_MSG_RESULT([added GCC interprocedural optimization support])
AC_MSG_RESULT([added GCC interprocedural optimization support])
elif test "$ax_cv_c_compiler_vendor" = "clang"; then
elif test "$ax_cv_c_compiler_vendor" = "clang"; then
CFLAGS="$CFLAGS -flto
=thin
"
CFLAGS="$CFLAGS -flto"
LDFLAGS="$LDFLAGS -flto
=thin
"
LDFLAGS="$LDFLAGS -flto"
: ${RANLIB="llvm-ranlib"}
: ${RANLIB="llvm-ranlib"}
AC_MSG_RESULT([added LLVM interprocedural optimization support])
AC_MSG_RESULT([added LLVM interprocedural optimization support])
else
else
...
@@ -231,7 +248,7 @@ AC_C_INLINE
...
@@ -231,7 +248,7 @@ AC_C_INLINE
# If debugging try to show inlined functions.
# If debugging try to show inlined functions.
if test "x$enable_debug" = "xyes"; then
if test "x$
ax_
enable_debug" = "xyes"; then
# Show inlined functions.
# Show inlined functions.
if test "$ax_cv_c_compiler_vendor" = "gnu"; then
if test "$ax_cv_c_compiler_vendor" = "gnu"; then
# Would like to use -gdwarf and let the compiler pick a good version
# Would like to use -gdwarf and let the compiler pick a good version
...
@@ -548,16 +565,6 @@ fi
...
@@ -548,16 +565,6 @@ fi
# Define HAVE_POSIX_MEMALIGN if it works.
# Define HAVE_POSIX_MEMALIGN if it works.
AX_FUNC_POSIX_MEMALIGN
AX_FUNC_POSIX_MEMALIGN
# Only optimize if allowed, otherwise assume user will set CFLAGS as
# appropriate.
AC_ARG_ENABLE([optimization],
[AS_HELP_STRING([--enable-optimization],
[Enable compile time optimization flags for host @<:@yes/no@:>@]
)],
[enable_opt="$enableval"],
[enable_opt="yes"]
)
# Disable vectorisation for known compilers. This switches off optimizations
# Disable vectorisation for known compilers. This switches off optimizations
# that could be enabled above, so in general should be appended. Slightly odd
# that could be enabled above, so in general should be appended. Slightly odd
# implementation as want to describe as --disable-vec, but macro is enable
# implementation as want to describe as --disable-vec, but macro is enable
...
@@ -582,6 +589,9 @@ AC_ARG_ENABLE([hand-vec],
...
@@ -582,6 +589,9 @@ AC_ARG_ENABLE([hand-vec],
HAVEVECTORIZATION=0
HAVEVECTORIZATION=0
# Only optimize if allowed, otherwise assume user will set CFLAGS as
# appropriate. Note argument check is done earlier so we can configure
# other options related to optimization.
if test "$enable_opt" = "yes" ; then
if test "$enable_opt" = "yes" ; then
# Choose the best flags for this compiler and architecture
# Choose the best flags for this compiler and architecture
...
@@ -603,7 +613,7 @@ if test "$enable_opt" = "yes" ; then
...
@@ -603,7 +613,7 @@ if test "$enable_opt" = "yes" ; then
esac
esac
elif test "$ax_cv_c_compiler_vendor" = "gnu"; then
elif test "$ax_cv_c_compiler_vendor" = "gnu"; then
if test "$gcc_handles_avx512" = "yes"; then
if test "$gcc_handles_avx512" = "yes"; then
case "$ax_gcc_arch" in
case "$ax_
cv_
gcc_arch
flag
" in
*skylake-avx512*)
*skylake-avx512*)
GRAVITY_CFLAGS="$GRAVITY_CFLAGS -mprefer-vector-width=512"
GRAVITY_CFLAGS="$GRAVITY_CFLAGS -mprefer-vector-width=512"
;;
;;
...
@@ -614,6 +624,21 @@ if test "$enable_opt" = "yes" ; then
...
@@ -614,6 +624,21 @@ if test "$enable_opt" = "yes" ; then
else
else
AC_MSG_NOTICE([No additional flags needed for gravity on this platform])
AC_MSG_NOTICE([No additional flags needed for gravity on this platform])
fi
fi
elif test "$ax_cv_c_compiler_vendor" = "clang"; then
# Could be a number of compilers. Check for aocc specific flags we want
# to use.
AX_CHECK_COMPILE_FLAG("-zopt", [GRAVITY_CFLAGS="$GRAVITY_CFLAGS -fvectorize -zopt"])
case "$ax_cv_gcc_archflag" in
*skylake-avx512*)
GRAVITY_CFLAGS="$GRAVITY_CFLAGS -mprefer-vector-width=512"
;;
*znver[[4-9]])
GRAVITY_CFLAGS="$GRAVITY_CFLAGS -mprefer-vector-width=512"
;;
*)
:
;;
esac
else
else
AC_MSG_WARN([Do not know what best gravity vectorization flags to choose for this compiler])
AC_MSG_WARN([Do not know what best gravity vectorization flags to choose for this compiler])
fi
fi
...
@@ -650,7 +675,6 @@ if test "$enable_opt" = "yes" ; then
...
@@ -650,7 +675,6 @@ if test "$enable_opt" = "yes" ; then
fi
fi
AM_CONDITIONAL([HAVEVECTORIZATION],[test -n "$HAVEVECTORIZATION"])
AM_CONDITIONAL([HAVEVECTORIZATION],[test -n "$HAVEVECTORIZATION"])
# Add address sanitizer options to flags, if requested. Only useful for GCC
# Add address sanitizer options to flags, if requested. Only useful for GCC
# version 4.8 and later and clang.
# version 4.8 and later and clang.
AC_ARG_ENABLE([sanitizer],
AC_ARG_ENABLE([sanitizer],
...
@@ -1755,6 +1779,19 @@ if test "$ax_cv_c_compiler_vendor" = "clang"; then
...
@@ -1755,6 +1779,19 @@ if test "$ax_cv_c_compiler_vendor" = "clang"; then
AC_CHECK_LIB([m],[__sincosf], [AC_DEFINE([HAVE___SINCOSF],1,[The __sincosf function is present.])])
AC_CHECK_LIB([m],[__sincosf], [AC_DEFINE([HAVE___SINCOSF],1,[The __sincosf function is present.])])
fi
fi
# The aocc compiler has optimized maths libraries that we should use. Check
# any clang for this support. Note do this after the basic check for maths
# as we need to make sure -lm follows. Also note needs -Ofast or -ffast-math
# so only when optimizing.
if test "$enable_opt" = "yes" -a "$ax_cv_c_compiler_vendor" = "clang"; then
have_almfast="yes"
AC_CHECK_LIB([almfast],[amd_fastexp],[LIBS="-fveclib=AMDLIBM -fsclrlib=AMDLIBM -lalmfast -lamdlibm $LIBS"],[have_almfast="no"],[-lamdlibm -lm])
if test "$have_almfast" = "no"; then
# Less optimized version.
AC_CHECK_LIB([amdlibm],[sqrt],,,[-lm])
fi
fi
# Check for glibc extension backtrace().
# Check for glibc extension backtrace().
AC_CHECK_FUNCS([backtrace backtrace_symbols])
AC_CHECK_FUNCS([backtrace backtrace_symbols])
...
...
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment