RISC-V Vector Primer
github.com
RISC-V Vector Primer
1–10 of 23 posts
Re: RISC-V Vector Primer
#2Re: RISC-V Vector Primer
#3I’d love a similar document for ARM NEON as well.
Re: RISC-V Vector Primer
#4RISC-V Vector is definitely tricky to get a handle on, especially if you just read the architecture documentation (which is to be expected really, good specification for an architecture isn't compatible with a useful beginners guide). I found I needed to look at some presentations given by various members of the vector working group to get a good grasp of the principles.
There's been precious little material beyond the specification and some now slightly old slide decks so this is a great contribution.
Re: RISC-V Vector Primer
#5Re: RISC-V Vector Primer
#6On a high level, do I understand correctly that SIMD is close to how the hardware works, while Vector Processor is more of an abstraction? The "Strip Mining" part looks like this translation to something SIMD-like. I seems like it's a good abstraction layers, but there is an implicit compilation step right? (making the "assembly" more easily run on different actual hardware)
Not quite. It still is the same “process whatever number of items you can in parallel, decrease count by that, repeat if necessary“ loop.
RISC-V decided to move the “decrease count by that, repeat if necessary” part into hardware, making the entire phrase “how the hardware works”.
Makes for shorter and nicer assembly. SIMD without it first has to query the CPU to find out how much parallelization it can handle (once) and do the “decrease count by that, repeat if necessary” part on the main CPU.
Re: RISC-V Vector Primer
#7You can implement both regular SIMD ISAs and scalable SIMD/Vector ISAs in a "Vector processor" style and both in a regular SIMD style.
Re: RISC-V Vector Primer
#8On a high level, do I understand correctly that SIMD is close to how the hardware works, while Vector Processor is more of an abstraction? The "Strip Mining" part looks like this translation to something SIMD-like. I seems like it's a good abstraction layers, but there is an implicit compilation step right? (making the "assembly" more easily run on different actual hardware)
> On a high level, do I understand correctly that SIMD is close to how the hardware works, while Vector Processor is more of an abstraction? Not quite. It still is the same “process whatever number of items you can in parallel, decrease count by that, repeat if necessary“ loop. RISC-V decided to move the “decrease count by that, repeat if necessary” part into hardware, making the entire phrase “how the hardware works…
Re: RISC-V Vector Primer
#9I like this document, but it seems to be written with a very specific implementation in mind. You can implement both regular SIMD ISAs and scalable SIMD/Vector ISAs in a "Vector processor" style and both in a regular SIMD style.
Re: RISC-V Vector Primer
#10Earlier quoted context omitted.
> On a high level, do I understand correctly that SIMD is close to how the hardware works, while Vector Processor is more of an abstraction? Not quite. It still is the same “process whatever number of items you can in parallel, decrease count by that, repeat if necessary“ loop. RISC-V decided to move the “decrease count by that, repeat if necessary” part into hardware, making the entire phrase “how the hardware works…
RVV still very much requires you to write a manual code/assembly loop doing the "compute how many elements can be handled, decrease count by that, repeat if necessary" thing. All it does is make it slightly less instructions to do so (and also allows handling a loops tail in the same loop while at it).
IIRC libc for x64 has several implementations of memcpy/memmov/strlen/etc. for different SSE/AVX extensions, which all get compiled in and shipped to your system; when libc is loaded for the first time, it figures out what is the latest extension the CPU it's running on actually supports and then patches its exports to point to the fastest working implementations.