[FFmpeg-devel] gcc: Remove auto-vectorization limitation.

Michael Niedermayer michael at niedermayer.cc
Sat May 31 16:39:06 EEST 2025


Hi Remi

On Fri, May 30, 2025 at 09:58:48AM +0300, Rémi Denis-Courmont wrote:
> 
> 
> Le 30 mai 2025 03:46:05 GMT+03:00, Michael Niedermayer <michael at niedermayer.cc> a écrit :
> >On Mon, May 26, 2025 at 11:43:15AM +0300, Rémi Denis-Courmont wrote:
> >> 
> >> 
> >> Le 26 mai 2025 00:37:08 GMT+03:00, Michael Niedermayer <michael at niedermayer.cc> a écrit :
> >> >Hi Rémi
> >> >
> >> >On Sat, May 24, 2025 at 07:10:57PM +0300, Rémi Denis-Courmont wrote:
> >> >> Le torstaina 22. toukokuuta 2025, 9.32.18 Itä-Euroopan kesäaika Jiawei a écrit 
> >> >> :
> >> >> > > The RISC-V autovectorised output looks like it has a warning "Odd
> >> >> > > rotation angle" which is not present in the non-autovectorised output.
> >> >> > 
> >> >> > I found this occured when using '-ffast-math' in RISC-V, also occur in
> >> >> > -O3 -ffast-math -fno-tree-vectorize case(much slower due to the
> >> >> > -ffast-math),supplementary more comparison results here:
> >> >> 
> >> >
> >> >> Unfortunately, the FFmpeg code is written with x87 semantics in mind.
> >> >
> >> >I dont remember ever writing code intentionally with x87 semantics. And i
> >> >have doubts other people did.
> >> 
> >> It doesn't have to be intentional. FFmpeg was started and mostly developed with x86-32 then x86-64 in mind. It's entirely possible that this happened innocently.
> >> 
> >> Specifically, FFmpeg uses open-code for minimum, maximum, absolute value and so on (see FFMIN, FFMAX, FFABS). They work nicely for integer maths. They also work nicely on x87 with the current set of FPU optimisations, but they differ from IEEE semantics because of NaNs, negative zeros and such.
> >> 
> >> Because of that the compiler will *not* use the native FPU instructions on platforms with native IEEE floats.
> >
> >replace all FFMIN with fminf() / fmin() where the arguments are float or
> >double, assuming that has no ill performance effects
> 

> That will harm performance on x87, whence fminf() and co are function calls rather than single instructions. What we actually should do is define separate macros for integer vs float vs double.

ok


> 
> But there are hundreds of use sites to patch. To be bluntly honest, I don't have the motivation to carry that tedious repetitive work out in my free time.

ok, can you review my patch ?


thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20250531/634fd476/attachment.sig>


More information about the ffmpeg-devel mailing list