* Re: [FFmpeg-devel] [PATCH] gcc: Don't disable '-ftree-vectorize' on GCC >= 13 on major architectures (PR #20120)
[not found] <20250805141526.67B6368C25D@ffbox0-bg.ffmpeg.org>
@ 2025-08-06 5:42 ` Rémi Denis-Courmont
2025-08-06 7:10 ` Martin Storsjö
0 siblings, 1 reply; 3+ messages in thread
From: Rémi Denis-Courmont @ 2025-08-06 5:42 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Hi,
FWIW I don't really care personally but judging by the original author and their affiliation, the intent was most probably to enable this for RISC-V / RVA23.
On that platform it is *probably* safe to enable vectorisation on all GCC versions but I have not tested it. In fact, I don't have an RVA23-conformant board.
Le 5 août 2025 21:15:26 GMT+07:00, "Martin Storsjö" <code@ffmpeg.org> a écrit :
>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".
_______________________________________________
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".
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [FFmpeg-devel] [PATCH] gcc: Don't disable '-ftree-vectorize' on GCC >= 13 on major architectures (PR #20120)
2025-08-06 5:42 ` [FFmpeg-devel] [PATCH] gcc: Don't disable '-ftree-vectorize' on GCC >= 13 on major architectures (PR #20120) Rémi Denis-Courmont
@ 2025-08-06 7:10 ` Martin Storsjö
0 siblings, 0 replies; 3+ messages in thread
From: Martin Storsjö @ 2025-08-06 7:10 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Wed, 6 Aug 2025, Rémi Denis-Courmont wrote:
> FWIW I don't really care personally but judging by the original author
> and their affiliation, the intent was most probably to enable this for
> RISC-V / RVA23.
>
> On that platform it is *probably* safe to enable vectorisation on all
> GCC versions but I have not tested it. In fact, I don't have an
> RVA23-conformant board.
Yeah I was on the fence about including RISC-V among the "modern major
architectures"; after merging this I'd welcome patches to enable the same
on more architectures, if the people contributing the patch can at least
indicate that it working without breaking fate tests for that
configuration.
// Martin
_______________________________________________
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".
^ permalink raw reply [flat|nested] 3+ messages in thread
* [FFmpeg-devel] [PATCH] gcc: Don't disable '-ftree-vectorize' on GCC >= 13 on major architectures (PR #20120)
@ 2025-08-05 14:15 Martin Storsjö
0 siblings, 0 replies; 3+ messages in thread
From: Martin Storsjö @ 2025-08-05 14:15 UTC (permalink / raw)
To: ffmpeg-devel
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".
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-08-06 7:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20250805141526.67B6368C25D@ffbox0-bg.ffmpeg.org>
2025-08-06 5:42 ` [FFmpeg-devel] [PATCH] gcc: Don't disable '-ftree-vectorize' on GCC >= 13 on major architectures (PR #20120) Rémi Denis-Courmont
2025-08-06 7:10 ` Martin Storsjö
2025-08-05 14:15 Martin Storsjö
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