[FFmpeg-devel] [FFmpeg-devel, v2] gcc: Relaxing auto-vectorization limitation.

Rémi Denis-Courmont remi at remlab.net
Fri May 30 10:36:09 EEST 2025



Le 29 mai 2025 19:02:24 GMT+03:00, Michael Niedermayer <michael at niedermayer.cc> a écrit :
>can gcc or clang not build code like our runtime cpudetect ?

You can, on some versions and some architectures, select the target CPU per function, but you can't select multiple targets, nor have the compiler automatically select "relevant" targets (i.e. those that it can optimise differently).

>i mean build functions for each major type and detect cpu once
>and switch accordingly ?

GCC supports resolving a symbol at runtime, but it requires support from the run-time linker (of course), which is not portable. I'm not sure if anything other than GNU/libc actually supports it.

And it requires a lot of boilerplate (less than FFmpeg's approach but still).

>I cannot be the first person thinking of that

No, indeed - auto vectorisation has been a thing for twenty years. But, either nobody has cared to fund that runtime detection bit, or compiler developers somehow block that work on some technical basis. My uninformed guess is the former.


More information about the ffmpeg-devel mailing list