3 ms·
Counterpoint: it's not all positive to do multiversioning. - You pay for it in build times, more IR, more optimizations. - a lot of software is for servers, i
by p0nce 3y ago
Counterpoint: it's not all positive to do multiversioning.
- You pay for it in build times, more IR, more optimizations.
- a lot of software is for servers, in that case you mostly know the arch before-hand. Multi-versioning is best for consumer software.
- The lowest spec computers, in consumer software, need the optimizations the most. And they don't have latest instructions.
- SIMD has biggest gains from memory optimizations, and those do not necessarily require the latest and greatest instructions.
- burntsushi 3y agoIndeed. This is how ripgrep works. It's compiled for just plain `x86_64`, but it looks for whether things like AVX2 are enabled. And if so, uses vector algorithms for substring and multi-substring search. The nice thing about dealing with strings is that the "coarse" requirement is already somewhat natural to the domain. But, this functionality is absolutely critical. It doesn't even have to be automatic. Just the ability to compile functions with certain ISA extensions enabled, and then only call them when the requisite CPU features are enabled is enough. In a nutshell: https://github.com/BurntSushi/memchr/blob/8037d11b4357b0f07be2bb66dc2659d9cf28ad32/src/memchr/x86/mod.rs https://github.com/BurntSushi/memchr/blob/8037d11b4357b0f07b...