Live data from Hacker News

Transcoding Unicode with AVX-512: AMD Zen 4 vs. Intel Ice Lake

lemire.me

21–30 of 70 posts

Re: Transcoding Unicode with AVX-512: AMD Zen 4 vs. Intel Ice Lake

#21
post #17

Earlier quoted context omitted.

Noob question- must one write avx512 assembly directly by hand, or is this something a c compiler would do for you?

typically if it's available, compilers will use the avx512 register file. This means you'll see things like xmm25 and ymm25 (128 and 256 bit registers) and those are avx512 only. However, compilers using 512-wide instructions is kinda rare from what I've seen

so then, if i want my code to "explicitly" use avx512, i have to do something like this?

``` void myNotOptimizedThing(my_data* d){ _SPECIAL_CPU_MANUFACTURER_0X3D512(d); } ```

edit: and include some header from the manufacturer most likely?

Re: Transcoding Unicode with AVX-512: AMD Zen 4 vs. Intel Ice Lake

#22
post #5

AVX-512 is wider, but also needs special instructions to leverage the hardware. This is unlike RISC-V V extension, where the same code will run and utilize the hardware, regardless of vector unit width.

Is there a RISC-V chip with SIMD available for purchase with roughly comparable price/performance to current Intel/AMD offerings?

Re: Transcoding Unicode with AVX-512: AMD Zen 4 vs. Intel Ice Lake

#23
post #12
post #9

Earlier quoted context omitted.

I wonder to what extent compilers even emit avx512 instructions apart from the common ones (load, store, shuffle, arithmetic) in case you don’t want to manually optimize for sse / avx / avx2 / avx512.

How much code is compiled with `-march=native` or function multiversioning? I would guess the percentage is relatively small, at least when it comes to distributed binaries. Compiler autovectorizers also aren't very good at producing fast AVX512 code, so most of the benefit would probably come from using optimized libraries like Intel's MKL or simdjson.

> How much code is compiled with `-march=native`

Any installation of Gentoo is, presumably. (Otherwise, what's the point of compiling it all yourself?)

More interestingly, possibly all OEM firmware-installed copies of ChromeOS are -march=native builds as well, given that ChromeOS is based off of a Gentoo upstream.

Re: Transcoding Unicode with AVX-512: AMD Zen 4 vs. Intel Ice Lake

#24
post #2

I saw this once before, and both times, it's pretty shocking. Is this really something that needs to be inside the CPU itself? I don't want my CPU doing this. I would rather just take the performance hit and keep the CPU "dumb".

> keep the CPU "dumb"

Users started dumb, develooers became dumb, now you want CPUs dumb too? Who will deal with the consequences??

Re: Transcoding Unicode with AVX-512: AMD Zen 4 vs. Intel Ice Lake

#26
post #14

Earlier quoted context omitted.

Most of what's interesting about avx512 is the new instructions; the wider vectors are just icing on the cake. You would need to rewrite your code regardless.

Using the RISC-V V vector instructions means that the underlying hardware vector width can change and the code will automatically take advantage of the larger width. That said, many of the avx512 instructions are simply extended width AVX2/avx2 instructions. The interesting things about it are really the increased width and the additional registers. Not many of the new instructions that are not bitwidtg extended vers…

I've only scratched the surface of the avx512 instructions, but they are much more broad and useful. Masked gather, scatter, double precision exp and mantissa extraction, and floating point to integer conversions are all new and all proving useful to me.

Re: Transcoding Unicode with AVX-512: AMD Zen 4 vs. Intel Ice Lake

#27

Wonder if this piece by Linus about AVX512 is still relevant https://news.ycombinator.com/item?id=23809335

It’s not, as long as you’re using a recent CPU architecture. I think the slowdown problem was mostly related to Intel’s first version of AVX512, and the underlying issue has since been addressed (at least to the point that it’s not nearly as much a problem as it used to be).

This is also why it’s impressive that this is only AMD’s first attempt: it appears to work really well, where it took Intel multiple attempts to get it working well.

Re: Transcoding Unicode with AVX-512: AMD Zen 4 vs. Intel Ice Lake

#29

Wonder if this piece by Linus about AVX512 is still relevant https://news.ycombinator.com/item?id=23809335

AVX-512 one major problem and a bunch of minor ones. The major problem is that most computers still don't have it. Intel tried to segment their lineup and only put AVX-512 in their high end server CPUs for the first 2 generations that had it, but as a result normal programmers didn't have access to it, compiler devs didn't have access to it, and users didn't have access to it. As a result, most compilers don't do a good job generating AVX-512 code, and most programmers think AVX-512 isn't useful.

AVX-512 is great. The new instructions are incredibly useful for a wide variety of applications, but the fragmentation and segmentation by Intel has made it a total mess.

Re: Transcoding Unicode with AVX-512: AMD Zen 4 vs. Intel Ice Lake

#30

Earlier quoted context omitted.

Most of what's interesting about avx512 is the new instructions; the wider vectors are just icing on the cake. You would need to rewrite your code regardless.

Noob question- must one write avx512 assembly directly by hand, or is this something a c compiler would do for you?

You should use Intel intrinsics - generally, they are supported by all compilers.

E.g. https://www.intel.com/content/www/us/en/develop/documentatio...

Post reply on HN