SSE code 6 times slower without VZEROUPPER on Skylake (2016)
stackoverflow.com
stackoverflow.com
AVX1 and VEX are supported by vast majority of CPUs made after 2011. Steam hardware survey says if you require AVX1, you gonna loose less than 7% of the audience. Maybe it’s time to move on already, and drop support for pre-AVX1 CPUs?
In one of my current projects (started as a green field about 1.5 years ago) the customer was willing to sacrifice compatibility for development cost, I told them I’ll ship sooner if we require AVX2 and D3D feature level 11.0 hardware, they agreed. Over these 1.5 years they only hit that once, trying to run my software on some 12-core Ivy Bridge Xeon, it doesn’t have AVX2 but it does support AVX1 and therefore VEX.
Probably these Pentiums and Celerons are used by the unfortunate 6.5% of Steam users without AVX1. If I would be working on a casual videogame instead of a resource-intensive CAM/CAE app, I probably wouldn’t want to require AVX.
But since you can't rely on it, nobody wants to maintain a slow path fallback. One that's going to be used on all the slowest machines anyway, so it had better be good too.
AVX code is much harder to port on ARM, as the registers are 256 bits. By disabling AVX in low-end CPUs, Intel is forcing many people to still maintain SSE 4.1 versions. This is making much easier to port software from Intel to ARM.
I think that’s an example of quarterly report-driven management, Intel picked short-term profits at the cost of long-term strategy.
They used to do everything - legal or otherwise - to stay on top. Now they're not even bothering with the legal stuff.
AMD would have played ball, because it would have benefited them just as much.
Post Sandy Bridge the x86 license was probably proportionally more valuable to them than to Intel. If it went away, Intel still had their fabs, which at that time showed no sign of danger.
https://ark.intel.com/content/www/us/en/ark/products/199285/...
https://ark.intel.com/content/www/us/en/ark/products/199290/...
AVX2 is supported with i3s:
https://ark.intel.com/content/www/us/en/ark/products/199283/...
Modern compilers are aware, e.g. check out gcc 10: https://godbolt.org/z/39v98r I asked it to compile for Sandy Bridge and the compiler has encoded all vector instruction in VEX, you can tell by opcodes starting with v, e.g. vmovmskpd instead of just movmskpd: https://www.felixcloutier.com/x86/movmskpd
The situation is ridiculous. I've played games that are simple reimplementations of DOS games (not via an emulator, but using SDL) that use 20% of a modern 2GHz CPU, while the original ran on a 12MhZ machine.
To answer the question:
>Is there any hope of actually getting the promised performance out of modern hardware without having a CPU/assembly expert on your team?
The answer is: it's complicated. Let's assume you want absolute maximum performance, so you use a uni-kernel design (quite a few super computers basically do this). Even without the overhead of virtual memory (minimal on modern hardware), the removal of multi-tasking (expensive but mitigatable) on a single core; you would still have to deal with all the complex things you need to do to run modern hardware. Modern hardware is complex, it's complex because we want things to be fast or have high bandwidth (usually both).
Ultimately you can usually get 90% percent of what the hardware can do with a good compiler, decent software architecture, and tuning to encourage vectorization; probably 95% with a great compiler. Even in user mode, even in Windows. So at the end of the day it's about what's more important: Using as few cycles of a CPU, or as few cycles of your time implementing it. I think the re-implementers chose the latter as they chose to let SDL follow its default FPS instead of tuning it downwards.
I remember a blog post full of very specific cases that compiler don't optimize at all because the case could never appear in a performance sensitive code, but you could meet this situation in many code.
There is a ratio benefit/cost in performance inspection, both human workload and compiler code maintenance/performance. You want to focus on what matter and on big code base where every performance curves are flat, you could think everything has been done.