[libre-riscv-dev] [llvm-dev] RFC: First-class Matrix type

Luke Kenneth Casson Leighton lkcl at lkcl.net
Thu Oct 11 09:26:41 BST 2018

[off llvm-dev list, link/ref here:

On Thu, Oct 11, 2018 at 8:59 AM Jacob Lifshay <programmerjake at gmail.com> wrote:
> This sounds like it would be really useful for 3D Graphics APIs as SPIR-V (the Vulkan/OpenCL2.1 intermediate representation) has matrices as first-class types. This will promote round-trip-ability. I have also heard that RISC-V's V extension wants to support matrices (not sure if it's as an additional extension on top of V or as part of V proper).

 if you can pseudo-code an example instruction, or load/store, that
would be great.

 i did consider last night adding a "remap" option to the register
file.  so whereas normally you do this:


 add r10, r20, r30


 add r10, r20, r30
 add r11, r21, r31
 add r12, r22, r33

it would be (assuming elwidth=8):

for i in range(VL):
   r10[i] = r11[i] + r12[i]

for elwidth = 16 it would be obviously r10[i..i+1] = .....

this could be set as a "mode" in the STATE.

not sure what to do if VL*elwidth goes beyond XLEN?

it *might* also solve the issues you were talking about for reordering
structs of arrays to arrays of structs, jacob.


More information about the libre-riscv-dev mailing list