Skip to content

Commit

Permalink
sagemathgh-38136: Fix building fflas, linbox on 32-bit by disabling S…
Browse files Browse the repository at this point in the history
…SE, AVX

Fixes sagemath#38000

URL: sagemath#38136
Reported by: Volker Braun
Reviewer(s):
  • Loading branch information
Release Manager committed Jun 2, 2024
2 parents e5f42fa + 197cfd1 commit cd80369
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 3 deletions.
4 changes: 2 additions & 2 deletions build/pkgs/configure/checksums.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
tarball=configure-VERSION.tar.gz
sha1=022699b7eb21eccbc8f9d15fe354069f2cf125fc
sha256=1dc7bc34f697b658b026772bb2d3c10875c5fa3be96d2d58a4e1b794f4b6ac3d
sha1=cb58c3e8026d4b3d163fde91aceb336e703ea3ad
sha256=ffc7a17af853d5d9711e36c9d92eb4f6d331a5bb2c0ae61d2418727cacc7f4c5
2 changes: 1 addition & 1 deletion build/pkgs/configure/package-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
973a7e3600d01aede4d21d94d1ff58e7d1631af1
a5ff92822df559eeb41b072669e3a0e6f4273f0f
48 changes: 48 additions & 0 deletions build/pkgs/fflas_ffpack/patches/disable-sse-avx-on-32-bit.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
commit 621a3b0825d7f7ad463e8ae175db51b0ec15bcd5 (HEAD -> master)
Author: Volker Braun <vbraun.name@gmail.com>
Date: Sun Jun 2 14:42:31 2024 +0200

Disable sse41, sse42, avx, avx2 on 32-bit

This can potentially be provided by the CPU, but will not compile
since simd128_int64.inl is 64-bit only. Probably also makes not much
sense to try to hardware-accelerate 64-bit on 32-bit OS.

diff --git a/fflas-ffpack/fflas-ffpack-config.h b/fflas-ffpack/fflas-ffpack-config.h
index a8e6cb0d..ff538bc6 100644
--- a/fflas-ffpack/fflas-ffpack-config.h
+++ b/fflas-ffpack/fflas-ffpack-config.h
@@ -121,13 +121,16 @@ namespace std _GLIBCXX_VISIBILITY(default)
#define __FFLASFFPACK_HAVE_SSE3_INSTRUCTIONS 1
#endif

-/* Define if sse4.1 instructions are supported */
-#ifdef __SSE4_1__
+/* Define if sse4.1 instructions are supported
+ * Technically, sse4.1 could be supported on 32-bit but if you want to
+ * accelerate 64-bit simd you should start by installing a 64-bit OS
+ */
+#if defined(__SSE4_1__) && defined(__x86_64__)
#define __FFLASFFPACK_HAVE_SSE4_1_INSTRUCTIONS 1
#endif

/* Define if sse4.2 instructions are supported */
-#ifdef __SSE4_2__
+#if defined(__SSE4_2__) && defined(__x86_64__)
#define __FFLASFFPACK_HAVE_SSE4_2_INSTRUCTIONS 1
#endif

@@ -137,12 +140,12 @@ namespace std _GLIBCXX_VISIBILITY(default)
#if not defined(__CYGWIN__) or not defined(__GNUC__)

/* Define if avx instructions are supported */
-#ifdef __AVX__
+#if defined(__AVX__) && defined(__x86_64__)
#define __FFLASFFPACK_HAVE_AVX_INSTRUCTIONS 1
#endif

/* Define if avx2 instructions are supported */
-#ifdef __AVX2__
+#if defined(__AVX2__) && defined(__x86_64__)
#define __FFLASFFPACK_HAVE_AVX2_INSTRUCTIONS 1
#endif

0 comments on commit cd80369

Please sign in to comment.