Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: "Swinney, Jonathan" <jswinney@amazon.com>
To: "ffmpeg-devel@ffmpeg.org" <ffmpeg-devel@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH v2] add a configure flag to enabled tree-vecorization with gcc
Date: Mon, 8 Aug 2022 15:25:36 +0000
Message-ID: <fd2ce78bb11d457481cdcca122c1ad64@amazon.com> (raw)

Recent version of gcc improve the automatic vectorization. This flag
allows adventurous users to enable vectorization. Known problems with
this are primarily related to inline assembly for x86 and so to address
those, add a pragma to explicitly disable automatic vectorization for
those files.

Signed-off-by: Jonathan Swinney <jswinney@amazon.com>

--

Thank you considering this patch. I believe this addresses the primary
concerns that were raised by my previous submission. There may be more
files which require the pragma add `-fno-tree-vectorize`, and I welcome
suggestions. This should strike a compromise, allowing some users to
enable vectorization while not breaking mainstream builds. This should
give time to work out additional problems if they arise before enabling
vectorization more broadly.

---
 configure              | 7 ++++++-
 libavcodec/x86/cabac.h | 4 ++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index cbbb4dd9c8..8e842da1b8 100755
--- a/configure
+++ b/configure
@@ -110,6 +110,7 @@ Configuration options:
   --disable-swscale-alpha  disable alpha channel support in swscale
   --disable-all            disable building components, libraries and programs
   --disable-autodetect     disable automatically detected external libraries [no]
+  --enable-auto-vectorization enable compiler auto vectorization
 
 Program options:
   --disable-programs       do not build command line programs
@@ -1945,6 +1946,7 @@ FEATURE_LIST="
     small
     static
     swscale_alpha
+    auto_vectorization
 "
 
 # this list should be kept in linking order
@@ -7176,7 +7178,9 @@ if enabled icc; then
             disable aligned_stack
     fi
 elif enabled gcc; then
-    check_optflags -fno-tree-vectorize
+    if disabled auto_vectorization; then
+        check_optflags -fno-tree-vectorize
+    fi
     check_cflags -Werror=format-security
     check_cflags -Werror=implicit-function-declaration
     check_cflags -Werror=missing-prototypes
@@ -7569,6 +7573,7 @@ echo "pod2man enabled           ${pod2man-no}"
 echo "makeinfo enabled          ${makeinfo-no}"
 echo "makeinfo supports HTML    ${makeinfo_html-no}"
 echo "xmllint enabled           ${xmllint-no}"
+echo "auto-vectorization        ${auto_vectorization-no}"
 test -n "$random_seed" &&
     echo "random seed               ${random_seed}"
 echo
diff --git a/libavcodec/x86/cabac.h b/libavcodec/x86/cabac.h
index b046a56a6b..782e4cbda4 100644
--- a/libavcodec/x86/cabac.h
+++ b/libavcodec/x86/cabac.h
@@ -39,6 +39,10 @@
 
 #if HAVE_INLINE_ASM
 
+#ifdef __GNUC__
+    __attribute__((optimize("-fno-tree-vectorize")))
+#endif
+
 #ifndef UNCHECKED_BITSTREAM_READER
 #define UNCHECKED_BITSTREAM_READER !CONFIG_SAFE_BITSTREAM_READER
 #endif
-- 
2.37.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

             reply	other threads:[~2022-08-08 15:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-08 15:25 Swinney, Jonathan [this message]
2022-08-08 19:31 ` Lynne

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fd2ce78bb11d457481cdcca122c1ad64@amazon.com \
    --to=jswinney@amazon.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git