4 ms·
Is there float8 support in any common CPU intrinsics? It sounds interesting but curious what will be the impact if any on CPU inference.
by andy99 3y ago
Is there float8 support in any common CPU intrinsics? It sounds interesting but curious what will be the impact if any on CPU inference.
- deleted 3y ago[deleted]
- ashvardanian 3y agoNope. Moreover, simulating it even with AVX-512 is quite an experience. Been postponing it for 2 years now... But first of all, you need to choose the version of float8 you want to implement, as the standards differ between GPU vendors.
- janwas 3y agoWe use it in gemma.cpp [1]. This hybrid of E5M2 and E4M3 decodes to bf16 in ~14 instructions, so we can do that on the fly during dot products. [1]: github.com/google/gemma.cpp
- danielhanchen 3y agoCongratulations on gemma.cpp!!
- teaearlgraycold 3y agoI’m curious if there’s a meaningful quality difference between float8 and some uint8 alternative (fixed precision or a look up table).
- CraigJPerry 3y agoA LUT could be a significant performance penalty would it not? Instead of a float8 (potentially multiple in simd case) in a register, you’re now having to head out to at least L1 cache to dereference the value in the LUT. Plain uint8 wouldn’t allow for the same accuracy range as float8 and it’s the accuracy not the precision (which uint would win for the largest values it can represent) that counts most.
- danielhanchen 3y agoOh oh was just gonna comment as well, but saw this! I think x86 has like pshufb for LUTs (used them like ages ago, but forgot now :() I think also some game (was it Spiderman) used loads of lookup tables. The issue with LUTs is don't you have to update the LUT itself? You can select which memory address to load up, but the LUT itself has to be differentiable maybe? TBH I'm not an expert on LUTs. On fixed point - similarly ye you have to fix the precision ranges as well, so again I'm unsure on how one changes the fixed point numbers over time. I'll have to read more on fixed point. Maybe 1.58bit using (-1, 0, 1) which gets rid of multiplications and just additions might be more useful, although you'll only get a 2x FLOP boost since you still need fp8 or fp16 addition.
- protomolecule 3y ago>I think x86 has like pshufb for LUTs There is also VPERMI2B [0] which operates on a 128 byte LUT. [0] https://en.wikichip.org/wiki/x86/avx512_vbmi https://en.wikichip.org/wiki/x86/avx512_vbmi
- danielhanchen 3y agoOh I forgot about that!! But ye LUTs are very interesting and fascinating :) One of the hidden gems of CPU optimizations :)