2 ms·
"CPUs are super restricted by the single threaded, branching nature of the code you run on them, and this is what makes CPU performance a little more nuanced, a
by varelse 11y ago
"CPUs are super restricted by the single threaded, branching nature of the code you run on them, and this is what makes CPU performance a little more nuanced, and not directly comparable."
Ironically, to really hit peak performance of a modern AVX2 or later CPU, you have to embrace many of the design principles that lead to efficient GPU code:
1. Multiple threads per core to make use of the dual vector units introduced in Haswell
2. SIMD-like thinking to remap tasks into the 8-way and soon to be 16-way vector units
3. Running multiple threads across multiple cores
4. Micromanaging the L1 cache and treating the AVX/SSE registers as L0 cache
Where the CPU prevails is for fundamentally serial algorithms that cannot be mapped into a SIMD implementation. Mike Acton's Data-Oriented Design covers this case nicely IMO.