Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: "Martin Storsjö" <code@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH] gcc: Don't disable '-ftree-vectorize' on GCC >= 13 on major architectures (PR #20120)
Date: Tue,  5 Aug 2025 17:15:26 +0300 (EEST)
Message-ID: <20250805141526.9864D68C339@ffbox0-bg.ffmpeg.org> (raw)

PR #20120 opened by Martin Storsjö (mstorsjo)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20120
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20120.patch

This changes configure to stop disabling -ftree-vectorize on
GCC versions 13 and newer, on major architectures.

Background:
- Original `-fno-tree-vectorize` was added in 2009 in commit
  973859f5230e to avoid compiler errors.
- Re-enabled in 2016 in commit cb8646af24bd but caused failures due
  to inline CABAC assembly issues and was disabled again in
  fd6dbc53855fb.
- Commit 182663a58a7a in 2023 fixed the inline CABAC assembly issues.
- Recent versions of GCC, in particular 13 and newer, seem to
  generally work reliably with respect to vectorization, although bugs
  have been observed on Loongarch.

Cautiously allow the GCC default of having vectorization enabled,
on major architectures where we expect to see enough testing. If
further issues are observed, they should be reported and noted here in
configure, so the workarounds can be scoped and version limited.


From f95261fab763cae5723513c9281d073048284ed4 Mon Sep 17 00:00:00 2001
From: Jiawei <jiawei@iscas.ac.cn>
Date: Mon, 14 Jul 2025 19:29:57 +0800
Subject: [PATCH] gcc: Don't disable '-ftree-vectorize' on GCC >= 13 on major
 architectures

This changes configure to stop disabling -ftree-vectorize on
GCC versions 13 and newer, on major architectures.

Background:
- Original `-fno-tree-vectorize` was added in 2009 in commit
  973859f5230e to avoid compiler errors.
- Re-enabled in 2016 in commit cb8646af24bd but caused failures due
  to inline CABAC assembly issues and was disabled again in
  fd6dbc53855fb.
- Commit 182663a58a7a in 2023 fixed the inline CABAC assembly issues.
- Recent versions of GCC, in particular 13 and newer, seem to
  generally work reliably with respect to vectorization, although bugs
  have been observed on Loongarch.

Cautiously allow the GCC default of having vectorization enabled,
on major architectures where we expect to see enough testing. If
further issues are observed, they should be reported and noted here in
configure, so the workarounds can be scoped and version limited.
---
 Changelog |  1 +
 configure | 20 +++++++++++++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/Changelog b/Changelog
index 04db8e15b2..b7704604f4 100644
--- a/Changelog
+++ b/Changelog
@@ -26,6 +26,7 @@ version <next>:
 - OpenHarmony hardware decoder/encoder
 - Colordetect filter
 - Add vf_scale_d3d11 filter
+- No longer disabling GCC autovectorization, on X86, ARM and AArch64
 
 
 version 7.1:
diff --git a/configure b/configure
index c0a4c3c87c..760e27fd70 100755
--- a/configure
+++ b/configure
@@ -7714,7 +7714,25 @@ if enabled icc; then
             disable aligned_stack
     fi
 elif enabled gcc; then
-    check_optflags -fno-tree-vectorize
+    gcc_version=$($cc -dumpversion)
+    major_version=${gcc_version%%.*}
+    if [ $major_version -lt 13 ]; then
+        # Disable tree-vectorize for GCC <13 - it has historically been buggy.
+        check_optflags -fno-tree-vectorize
+    else
+        case $arch in
+        x86|arm|aarch64)
+            # Allow the default of having tree-vectorize enabled on well tested
+            # architectures.
+            ;;
+        *)
+            # Disable tree-vectorize on potentially less tested
+            # architectures. Known issues:
+            # - https://gcc.gnu.org/PR121064 on Loongarch
+            check_optflags -fno-tree-vectorize
+            ;;
+        esac
+    fi
     check_cflags -Werror=format-security
     check_cflags -Werror=implicit-function-declaration
     check_cflags -Werror=missing-prototypes
-- 
2.49.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:[~2025-08-05 14:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20250805141526.9864D68C339@ffbox0-bg.ffmpeg.org \
    --to=code@ffmpeg.org \
    --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