0
It finally happened! A raspberry pi like device, with a RISC-V CPU supporting
the v
extension. Aka RVV
. Aka vector instructions.
I bought one, and explored it a bit.
SIMD background
First some background on SIMD.
SIMD is a set of instructions allowing you to do the same operation to multiple
independent pieces of data. As an example, say you had four 8 bit integers, and
you wanted to multiply them all by 2, then add 1. You could do this with a
single operation without any special instructions.
# x86 example assembly.
mov eax, [myvalues] # load our four bytes.
mov ebx, 2 # we want to multiply by two
imul eax, ebx # single operation, multiple data!
# After this, eax contains 0x02040608
add eax, 0x01010101 # single operation, multiple data!
# After this, eax contains 0x03050709
mov [myvalues], eax # store back the new value.
section .data
myvalues db 1,2,3,4
Success, right? No, of course not. This naive code doesn’t handle
over/underflow, and doesn’t even remotely work for floating point data. For
that, we need special SIMD instructions.
x86 and ARM have gone the way of fixed sized registers. In 1997 Intel introduced
MMX, to great Continue reading