对AVX2进行优化
Video engineer at Vimeo here. I previously worked on the AV1 video standard and started the rav1e open-source video encoder. As someone who specializes in the low-level details of video compression, I’m responsible for making sure Vimeo’s encoder software makes the most of our resources.
我是Vimeo的视频工程师。我之前从事AV1视频标准的研究,并开始了rav1e开源视频编码器的工作。作为一个专门研究视频压缩的低级细节的人,我负责确保Vimeo的编码器软件能够充分利用我们的资源。
At Vimeo, our transcoder is based around many pieces of software that take advantage of special CPU instruction set extensions that have been added to each newer generation of x86_64 CPUs. These include SSE4, AVX, and AVX2. Utilizing these instructions enables video and audio codecs to operate on more than one pixel at a time (or more than one audio sample), greatly increasing speed.
在Vimeo,我们的转码器是基于许多软件,利用特殊的CPU指令集扩展,已被添加到每个较新的一代x86_64 CPU的优势。这些指令包括SSE4、AVX和AVX2。利用这些指令可以使视频和音频编解码器一次对多个像素进行操作(或多个音频样本),从而大大提高速度。
Because support for these instruction sets in x86_64 is optional, most software has to be built in one of three ways: one, to match the minimum CPU of all possible users; two, to include multiple copies of the program built for a few different baselines of support; or three, to choose different code paths dynamically at runtime. Because simply assuming a modern CPU can cut out a lot of users (CPUs sold as recently as 2020 didn’t include AVX2), and building multiple copies multiplies build time and program size, most video software tends to use the dynamic method. However, at Vimeo, we know ahead of time what exact CPUs our virtual machine images will run on and can target them appropriately. Different software in our stack can take advantage of this in various ways.
由于x86_64中对这些指令集的支持是可选的,大多数软件必须以三种方式之一来构建:一是与所有可能的用户的最低CPU相匹配;二是包括为几个不同的支持基线构建的程序的多个副本;或者三是在运行时动态选择不同的代码路径。因为简单地假设一个现代的CPU可以砍掉很多用户(最近在2020年出售的CPU不包括AVX2),而构建多个副本会使构建时间和程序大小成倍增加,大多数视频软件倾向于使用动态方法。然而,在Vimeo,我们提前知道我们的虚拟机图像将在哪些确切的CPU上运行,并可以适当地针对它们。我们堆栈中的不同软件可以以不同的方式利用这一点。
Just keep in mind that, when it comes to measuring CPU time accurately, modern CPUs have many compo...