[FFmpeg-devel] [PATCH v5] gcc: Don't disable '-ftree-vectorize' if gcc version higher than 13.
Martin Storsjö
martin at martin.st
Tue Aug 5 16:02:18 EEST 2025
On Fri, 18 Jul 2025, Kacper Michajlow wrote:
> On Fri, 11 Jul 2025 at 23:41, Michael Niedermayer
> <michael at niedermayer.cc> wrote:
>>
>> Hi Martin
>>
>> On Thu, Jul 10, 2025 at 02:35:10PM +0300, Martin Storsjö wrote:
>> > On Thu, 10 Jul 2025, Jiawei wrote:
>> >
>> > > Hi Martin,
>> > >
>> > > Is there any progress for this patch, should I resend it to the mailing
>> > > list again?
>> >
>> > When I posted the updated version of the patch, the patchwork test runners
>> > noticed that this patch causes test failures on Loongarch. So modern
>> > versions of GCC still do have vectorization bugs, at least on some
>> > architectures.
>> >
>>
>> > I'm unsure if we should allow it everywhere, and just single out loongarch
>> > as a case where it is known broken, or if we should only let GCC enable it
>> > on the major architectures that we've tested.
>>
>> I think for architectures where there is an active maintainer,
>> that maintainer should decide.
>>
>> For architectures where there is noone looking after them, its
>> safer to leave it disabled. Otherwsie users could be having
>> complex to debug issues to deal with and noone in ffmpeg able to
>> replicate
>
> I agree. In a perfect world we would enable it everywhere, but if
> there is a worry that GCC is not a mature enough compiler to enable
> it, it's better to gradually roll it out on an opt-in basis. We can
> start with major architectures and for other architectures allow
> maintainers to decide.
>
> Alternatively enable it everywhere for start and selectively disable
> it, once issues are identified. This may cause breakage, but is easy
> to workaround (by adding a compiler flag), and will likely identify
> issues with GCC faster.
>
> Bottom line is that adding `-fno-tree-vectorize` in current year is
> quite a heavy hammer to avoid possible issues and especially on major
> architectures like x86 it should be safe to enable vectorization. It
> also currently gives clang and advantage over gcc if we compare pure c
> code in some cases.
I've tried to gather the consensus about this patch from the discussions
above, and reposted this patch at
https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20120 - hopefully that
captures the gist of it.
In short, this allows the GCC default on GCC >= 13, on x86/arm/aarch64.
People actively testing other architectures are welcome to try overriding
configure on their platform and suggesting other architectures that should
allow potential vectorization as well - and if other issues are observed
(and ideally reported) we can add that to the tracking list, so we don't
end up with this disabled forever.
(Keeping it disabled on all architectures is also making it harder for GCC
itself to get potential corner case bugs observed and fixed.)
// Martin
More information about the ffmpeg-devel
mailing list