From f36dcf74ead4da26825747b5e1cd4280653e72e6 Mon Sep 17 00:00:00 2001 From: Andrey Miroshnikov Date: Thu, 9 Nov 2023 23:32:38 +0000 Subject: [PATCH] Added a bit of explanation for the three instructions --- openpower/sv/cookbook/remap_matrix.mdwn | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/openpower/sv/cookbook/remap_matrix.mdwn b/openpower/sv/cookbook/remap_matrix.mdwn index 973444f7a..8eefea51e 100644 --- a/openpower/sv/cookbook/remap_matrix.mdwn +++ b/openpower/sv/cookbook/remap_matrix.mdwn @@ -210,6 +210,24 @@ ISACaller)* sv.maddld *0, *16, *32, *0 ``` +As you can see, only three instructions are required to perform arbitrary +matrix multiplication, with non-power-of-2 matrices! + +The reason why the main part of matrix multiplication is so simple is down +to three reasons: + +- RISC ISA with powerful and simple instructions (Power ISA SFS/SFFS) +- REMAP indexing system - generates index schedules for a range of + problems: matrix multiply, FFT, DCT, programmer-defined, etc. +- Simple-V SVP64 looping system based on instruction prefixing which turns + any scalar instruction into a vector one. Can follow consecutive element + indexing, or REMAP schedule indexing. + +Additionally, if instead of matrix multiplication, a different operation is +required (say, to perform logical operations on rows/cols), the third +instruction - `maddld` - can be substituted for a different operation. This is +beyond the scope of this guide however. + ## svshape The `svshape` instruction is a convenient way to access the `SVSHAPE` Special @@ -220,7 +238,8 @@ would be possible. The REMAP system has 16 modes, all of which are accessible through the `svshape` instruction. However for the purpose of this guide, only SVrm=0 -(Matrix Multiply) will be covered. +(Matrix Multiply) will be covered. The Matrix Multiply mode can be used to +produce indices in the form of the inner product table shown above. ### SVSHAPE Remapping SPRs -- 2.30.2