[Libre-soc-dev] [RFC] Matrix and DCT/FFT SVP64 REMAP

Luke Kenneth Casson Leighton lkcl at lkcl.net
Sat Jul 3 01:56:28 BST 2021

hm. to create the appearance of matrix multiply as 3 flattened arrays,
if the formula is this:

for x in x_r:
 for y in y_r:
   for z in z_r:
     result[y][z] +=
        a[x][y] *

(something like that)

then the flattened indices are actually:

for x in x_r:
 for y in y_r:
   for z in z_r:
     ridx = zlen*y+z
     aidx = ylen*x+y
     bidx = zlen*x+z

and the 1D array form would be:

     result[zidz] +=
          a[aidx] *

which actually means, the 3 bits currently allocated to "permute
order" are redundant, and can be replaced with:

index = 0
multby = 1
if permute[0]
    index = z
    multby *= zdim
if permute[1]:
    index *= multby
    index += y
    multby *= ydim
if permute[2]:
    index *= multby
    index += x

then, to generate ridx you would set:

  permute = 0b011

for aidx:

  permute = 0b101

for bidx:

  permute = 0b110

something like that?

no, it's more sophisticated than that, isn't it.  the order of what
gets added and multby'd has to be controlled, doesn't it?

needs more thought.


More information about the Libre-soc-dev mailing list