Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Dne 3.8.2011 18:41, Norbert Thiebaud napsal(a):
Ok so now I read the patch...

Did it work for you ?

1/ it seems to me that it is missing a piece to put that HAVE_GCC_AVX
in Env.Host.sh (see set_soenv.in)
without that the second patch will never see it

2/ the makefile patches in the second patch are dmake makefile so the
syntax is more something like

.IF "$(HAVE_GCC_AVX)" == "YES"
[...]
.ENDIF

take a look at HAVE_GCC_NO_LONG_DOUBLE
and how it is set-up in configure.in/set_soenv.in and used later in
the makefiles...

Norbert
Ok I wrote it how I think it should work and triggered the build so I will have the results of it in 24 hours.
FWIW I am attaching the final patches for now.

Cheers

Tom
From 467533c0a419655a778689ff32ae18131db06780 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= <tomas.chvatal@gmail.com>
Date: Wed, 3 Aug 2011 13:52:13 +0200
Subject: [PATCH] Add check for avx support.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit


Signed-off-by: Tomáš Chvátal <tomas.chvatal@gmail.com>
---
 configure.in |   31 +++++++++++++++++++++++++++++++
 set_soenv.in |    1 +
 2 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/configure.in b/configure.in
index cf308dc..3317d42 100755
--- a/configure.in
+++ b/configure.in
@@ -1885,6 +1885,37 @@ fi
 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
 
 dnl ===================================================================
+dnl Check for AVX
+dnl ===================================================================
+AS_IF([test "x$AVX_CFLAGS" = "x"], [
+  AS_IF([test "x$SUNCC" = "xyes" && test "x$AMD64_ABI" = "xno"], [
+       AVX_CFLAGS="-xarch=avx"
+  ])
+], [
+  AVX_CFLAGS="-mavx -Winline"
+])
+
+have_avx_intrinsics=no
+AC_MSG_CHECKING(whether to use AVX intrinsics)
+avx_save_CFLAGS=$CFLAGS
+CFLAGS="$AVX_CFLAGS $CFLAGS"
+AC_COMPILE_IFELSE([
+#if defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5))
+#   if !defined(__amd64__) && !defined(__x86_64__)
+#      error "Need GCC >= 4.5 for AVX intrinsics on x86"
+#   endif
+#endif
+#include <immintrin.h>
+int main () {
+    __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
+        c = _mm256_permute2f128_si256 (a, b, 0);
+    return 0;
+}], have_avx_intrinsics=yes)
+CFLAGS=$avx_save_CFLAGS
+AC_MSG_RESULT([$have_avx_intrinsics])
+AM_CONDITIONAL(HAVE_GCC_AVX, [test "x$have_avx_intrinsics" = "xyes"])
+
+dnl ===================================================================
 dnl Set up a different compiler to produce tools to run on the build
 dnl machine when doing cross-compilation
 dnl ===================================================================
diff --git a/set_soenv.in b/set_soenv.in
index 4994709..729241c 100755
--- a/set_soenv.in
+++ b/set_soenv.in
@@ -1825,6 +1825,7 @@ ToFile( "ALIGNOF_INT",          "@ALIGNOF_INT@", "e" );
 ToFile( "ALIGNOF_LONG",         "@ALIGNOF_LONG@", "e" );
 ToFile( "ALIGNOF_DOUBLE",       "@ALIGNOF_DOUBLE@", "e" );
 ToFile( "HAVE_GCC_NO_LONG_DOUBLE", "@HAVE_GCC_NO_LONG_DOUBLE@", "e" );
+ToFile( "HAVE_GCC_AVX", "@HAVE_GCC_AVX@", "e" );
 ToFile( "HAVE_GCC_VISIBILITY_FEATURE",
                "@HAVE_GCC_VISIBILITY_FEATURE@", "e" );
 ToFile( "HAVE_GCC_VISIBILITY_BROKEN",
-- 
1.7.3.4

From 16d4258863c936538ef3b7ff13a95f7567a62044 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= <tomas.chvatal@gmail.com>
Date: Mon, 1 Aug 2011 17:41:29 +0200
Subject: [PATCH] Fix segmentation fault when linking -mavx on new CPUs is enabled by explicitly 
adding -mno-avx to CXXFLAGS.

---
 .../source/cpp_uno/gcc3_linux_intel/makefile.mk    |    6 ++++++
 .../source/cpp_uno/gcc3_linux_x86-64/makefile.mk   |    6 ++++++
 bridges/source/cpp_uno/mingw_intel/makefile.mk     |    6 ++++++
 3 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/makefile.mk 
b/bridges/source/cpp_uno/gcc3_linux_intel/makefile.mk
index beedf9d..609e09a 100644
--- a/bridges/source/cpp_uno/gcc3_linux_intel/makefile.mk
+++ b/bridges/source/cpp_uno/gcc3_linux_intel/makefile.mk
@@ -52,6 +52,12 @@ CFLAGS += -DLEAK_STATIC_DATA
 # work with the .cxx sources in this directory:
 CFLAGSCXX += -fno-omit-frame-pointer -fno-strict-aliasing
 
+# In case the compiler supports AVX this code segfaults so specifically turn
+# it off.
+.IF "$(HAVE_GCC_AVX)" == "YES"
+    CFLAGSCXX+= -mno-avx
+.ENDIF
+
 CFLAGSNOOPT=-O0
 
 SLOFILES= \
diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/makefile.mk 
b/bridges/source/cpp_uno/gcc3_linux_x86-64/makefile.mk
index dd35432..e519105 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/makefile.mk
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/makefile.mk
@@ -52,6 +52,12 @@ CFLAGS += -DLEAK_STATIC_DATA
 # work with the .cxx sources in this directory:
 CFLAGSCXX += -fno-omit-frame-pointer -fno-strict-aliasing
 
+# In case the compiler supports AVX this code segfaults so specifically turn
+# it off.
+.IF "$(HAVE_GCC_AVX)" == "YES"
+    CFLAGSCXX+= -mno-avx
+.ENDIF
+
 SLOFILES= \
     $(SLO)$/abi.obj                    \
     $(SLO)$/except.obj         \
diff --git a/bridges/source/cpp_uno/mingw_intel/makefile.mk 
b/bridges/source/cpp_uno/mingw_intel/makefile.mk
index 2c7a8da..d2b0809 100644
--- a/bridges/source/cpp_uno/mingw_intel/makefile.mk
+++ b/bridges/source/cpp_uno/mingw_intel/makefile.mk
@@ -51,6 +51,12 @@ CFLAGS += -DBROKEN_ALLOCA
 # work with the .cxx sources in this directory:
 CFLAGSCXX += -fno-omit-frame-pointer
 
+# In case the compiler supports AVX this code segfaults so specifically turn
+# it off.
+.IF "$(HAVE_GCC_AVX)" == "YES"
+    CFLAGSCXX+= -mno-avx
+.ENDIF
+
 NOOPTFILES= \
     $(SLO)$/uno2cpp.obj
 
-- 
1.7.3.4


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.