]> granicus.if.org Git - handbrake/commitdiff
contrib: Add additional AVX-512 compatibility patches to libvpx.
authorBradley Sepos <bradley@bradleysepos.com>
Fri, 29 Jun 2018 01:42:56 +0000 (21:42 -0400)
committerBradley Sepos <bradley@bradleysepos.com>
Fri, 29 Jun 2018 01:42:56 +0000 (21:42 -0400)
#1401.

contrib/libvpx/A02-avx-512-detection2.patch [new file with mode: 0644]
contrib/libvpx/A03-avx-512-detection3.patch [new file with mode: 0644]

diff --git a/contrib/libvpx/A02-avx-512-detection2.patch b/contrib/libvpx/A02-avx-512-detection2.patch
new file mode 100644 (file)
index 0000000..3eabe77
--- /dev/null
@@ -0,0 +1,33 @@
+From 68a9b143d02436729e024f081c8d77b42f2e9d7f Mon Sep 17 00:00:00 2001
+From: Tom Finegan <tomfinegan@google.com>
+Date: Wed, 13 Jun 2018 09:39:28 -0700
+Subject: [PATCH] Fix avx512 related MSVC build failure.
+
+Check GCC specific AVX512 flags only when GCC is enabled.
+
+Change-Id: I15dc2a0dbf8bce37f4364fedfd34a0a34882104b
+---
+ build/make/configure.sh | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/build/make/configure.sh b/build/make/configure.sh
+index e0e9fd1a73..37b410edb6 100644
+--- a/build/make/configure.sh
++++ b/build/make/configure.sh
+@@ -1335,13 +1335,15 @@ EOF
+             check_gcc_machine_options $ext avx512f avx512cd avx512bw avx512dq avx512vl
+             # Confirm that the compiler really supports avx512.
+-            check_cc -mavx512f <<EOF || RTCD_OPTIONS="${RTCD_OPTIONS}--disable-avx512 " && soft_disable avx512
++            if enabled gcc; then
++              check_cc -mavx512f <<EOF || RTCD_OPTIONS="${RTCD_OPTIONS}--disable-avx512 " && soft_disable avx512
+ #include <immintrin.h>
+ void f(void) {
+   __m512i x = _mm512_set1_epi16(0);
+   (void)x;
+ }
+ EOF
++            fi
+           else
+             # use the shortened version for the flag: sse4_1 -> sse4
+             check_gcc_machine_option ${ext%_*} $ext
diff --git a/contrib/libvpx/A03-avx-512-detection3.patch b/contrib/libvpx/A03-avx-512-detection3.patch
new file mode 100644 (file)
index 0000000..6dc09e3
--- /dev/null
@@ -0,0 +1,63 @@
+From ab71db65a5e8aeb107e0eb4d5fd3e03ec7452b86 Mon Sep 17 00:00:00 2001
+From: Tom Finegan <tomfinegan@google.com>
+Date: Fri, 15 Jun 2018 10:58:11 -0700
+Subject: [PATCH] Clean up avx512 compiler support test.
+
+Moves the check into a function, check_gcc_avx512_compiles,
+that behaves somewhat similarly to check_gcc_machine_options.
+
+Change-Id: I2bef3ddd98e636eef12d9d5e548c43282fac7826
+---
+ build/make/configure.sh | 32 +++++++++++++++++++++-----------
+ 1 file changed, 21 insertions(+), 11 deletions(-)
+
+diff --git a/build/make/configure.sh b/build/make/configure.sh
+index 37b410edb6..d2c6b26fa1 100644
+--- a/build/make/configure.sh
++++ b/build/make/configure.sh
+@@ -426,6 +426,26 @@ check_gcc_machine_options() {
+   fi
+ }
++check_gcc_avx512_compiles() {
++  if disabled gcc; then
++    return
++  fi
++
++  check_cc -mavx512f <<EOF
++#include <immintrin.h>
++void f(void) {
++  __m512i x = _mm512_set1_epi16(0);
++  (void)x;
++}
++EOF
++  compile_result=$?
++  if [ ${compile_result} -ne 0 ]; then
++    log_echo "    disabling avx512: not supported by compiler"
++    disable_feature avx512
++    RTCD_OPTIONS="${RTCD_OPTIONS}--disable-avx512 "
++  fi
++}
++
+ write_common_config_banner() {
+   print_webm_license config.mk "##" ""
+   echo '# This file automatically generated by configure. Do not edit!' >> config.mk
+@@ -1333,17 +1353,7 @@ EOF
+         else
+           if [ "$ext" = "avx512" ]; then
+             check_gcc_machine_options $ext avx512f avx512cd avx512bw avx512dq avx512vl
+-
+-            # Confirm that the compiler really supports avx512.
+-            if enabled gcc; then
+-              check_cc -mavx512f <<EOF || RTCD_OPTIONS="${RTCD_OPTIONS}--disable-avx512 " && soft_disable avx512
+-#include <immintrin.h>
+-void f(void) {
+-  __m512i x = _mm512_set1_epi16(0);
+-  (void)x;
+-}
+-EOF
+-            fi
++            check_gcc_avx512_compiles
+           else
+             # use the shortened version for the flag: sse4_1 -> sse4
+             check_gcc_machine_option ${ext%_*} $ext