5 ms·
How do they make these assembly instructions portable across different cpus?
by Alifatisk 1y ago
How do they make these assembly instructions portable across different cpus?
- KeplerBoy 1y agoThey don't. It's just x86-64.
- ahartmetz 1y agoThe lessons yes, but the repo contains assembly for the 5-6 architectures in wide use in consumer hardware today. Separate files of course. https://github.com/FFmpeg/FFmpeg/tree/master/libavcodec https://github.com/FFmpeg/FFmpeg/tree/master/libavcodec
- KeplerBoy 1y agoYeah, sure. I was specifically referring to the tutorials. Ffmpeg needs to run everywhere, although I believe they are more concerned about data center hardware than consumer hardware. So probably also stuff like power pc.
- duskwuff 1y agoTo a first approximation, the only architectures where people really care about ffmpeg performance (anymore) are x86_64 and arm64. Everything else is of minimal importance - the few assembly routines for other architectures were probably written more for fun than for practical reasons.
- CannotCarrot 1y agoI think there's a generic C fallback, which can also serve as a baseline. But for the big (targeted) architectures, there one handwritten assembly version per arch.
- faluzure 1y agoYup. On startup, it runs cpuid and assigns each operation the most optimal function pointer for that architecture. In addition to things like ‘supports avx’ or ‘supports sse4’ some operations even have more explicit checks like ‘is a fifth generation celeron’. The level of optimization in that case was optimizing around the cache architecture on the cpu iirc. Source: I did some dirty things with chromes native client and ffmpeg 10 years ago.
- deleted 1y ago[deleted]