clarify
[libreriscv.git] / simple_v_extension / simple_v_chennai_2018.tex
index 993741313f492eea9300f6ca12cceb847f2486eb..79730673cf1cfe3779537efca3817b79ac8dd36b 100644 (file)
@@ -82,7 +82,8 @@
                 of pipeline setup, amount of state to context switch
                 and software portability\vspace{4pt}
    \item How?
-            By implicitly marking INT/FP regs as "Vectorised",\\
+            By marking INT/FP regs as "Vectorised" and
+            adding a level of indirection,
             SV expresses how existing instructions should act 
             on [contiguous] blocks of registers, in parallel.\vspace{4pt}
    \item What?
 \frame{\frametitle{How is Parallelism abstracted in Simple-V?}
 
  \begin{itemize}
-   \item Register "typing" turns any op into an implicit Vector op\vspace{10pt}
+   \item Register "typing" turns any op into an implicit Vector op:\\
+         registers are reinterpreted through a level of indirection
    \item Primarily at the Instruction issue phase (except SIMD)\\
          Note: it's ok to pass predication through to ALU (like SIMD)
    \item Standard (and future, and custom) opcodes now parallel\vspace{10pt}
   \end{itemize}
-  Notes:\vspace{6pt}
+  Note: EVERYTHING is parallelised:
    \begin{itemize}
    \item All LOAD/STORE (inc. Compressed, Int/FP versions)
    \item All ALU ops (soft / hybrid / full HW, on per-op basis)
-   \item All branches become predication targets (C.FNE added)
+   \item All branches become predication targets (C.FNE added?)
    \item C.MV of particular interest (s/v, v/v, v/s)
+   \item FCVT, FMV, FSGNJ etc. very similar to C.MV
   \end{itemize}
 }
 
 \frame{\frametitle{What's the deal / juice / score?}
 
  \begin{itemize}
-   \item Standard Register File(s) overloaded with CSR "vector span"\\
+   \item Standard Register File(s) overloaded with CSR "reg is vector"\\
             (see pseudocode slides for examples)
-   \item Element width and type concepts remain same as RVV\\
+   \item Element width (and type?) concepts remain same as RVV\\
             (CSRs are used to "interpret" elements in registers)
    \item CSRs are key-value tables (overlaps allowed)\vspace{10pt}
   \end{itemize}
    \item Predication in INT regs as a BIT field (max VL=XLEN)
    \item Minimum VL must be Num Regs - 1 (all regs single LD/ST)
    \item SV may condense sparse Vecs: RVV lets ALU do predication
-   \item NO ZEROING: non-predicated elements are skipped
+   \item Choice to Zero or skip non-predicated elements
   \end{itemize}
 }
 
@@ -301,7 +304,7 @@ else stride = areg[as2]; // constant-strided
 for (int i = 0; i < VL; ++i)
   if (preg_enabled[rd] && ([!]preg[rd] & 1<<i))
     for (int j = 0; j < seglen+1; j++)
-      if (reg_is_vectorised[rs2]) offs = vreg[rs2][i]
+      if (reg_is_vectorised[rs2]) offs = vreg[rs2+i]
       else offs = i*(seglen+1)*stride;
       vreg[rd+j][i] = mem[sreg[base] + offs + j*stride]
 \end{semiverbatim}
@@ -317,6 +320,7 @@ for (int i = 0; i < VL; ++i)
 
  \begin{itemize}
    \item Same register(s) can have multiple "interpretations"
+   \item Set "real" register (scalar) without needing to set/unset CSRs.
    \item xBitManip plus SIMD plus xBitManip = Hi/Lo bitops
    \item (32-bit GREV plus 4x8-bit SIMD plus 32-bit GREV:\\
             GREV @ VL=N,wid=32; SIMD @ VL=Nx4,wid=8)
@@ -324,7 +328,7 @@ for (int i = 0; i < VL; ++i)
             (BEXT/BDEP @ VL=N,wid=32; SIMD @ VL=Nx4,wid=8)
    \item Same register(s) can be offset (no need for VSLIDE)\vspace{6pt}
   \end{itemize}
-  Note:\vspace{10pt}
+  Note:
    \begin{itemize}
    \item xBitManip reduces O($N^{6}$) SIMD down to O($N^{3}$)
    \item Hi-Performance: Macro-op fusion (more pipeline stages?)
@@ -332,19 +336,22 @@ for (int i = 0; i < VL; ++i)
 }
 
 
-\frame{\frametitle{Why no Zeroing (place zeros in non-predicated elements)?}
+\frame{\frametitle{To Zero or not to place zeros in non-predicated elements?}
 
  \begin{itemize}
-   \item Zeroing is an implementation optimisation favouring OoO\vspace{8pt}
-   \item Simple implementations may skip non-predicated operations\vspace{8pt}
-   \item Simple implementations explicitly have to destroy data\vspace{8pt}
+   \item Zeroing is an implementation optimisation favouring OoO
+   \item Simple implementations may skip non-predicated operations
+   \item Simple implementations explicitly have to destroy data
    \item Complex implementations may use reg-renames to save power\\
             Zeroing on predication chains makes optimisation harder
+   \item Compromise: REQUIRE both (specified in predication CSRs).
   \end{itemize}
-  Considerations:\vspace{10pt}
+  Considerations:
   \begin{itemize}
-   \item Complex not really impacted, Simple impacted a LOT
-   \item Overlapping "Vectors" may issue overlapping ops
+   \item Complex not really impacted, simple impacted a LOT\\
+         with Zeroing... however it's useful (memzero)
+   \item Non-zero'd overlapping "Vectors" may issue overlapping ops\\
+            (2nd op's predicated elements slot in 1st's non-predicated ops)
    \item Please don't use Vectors for "security" (use Sec-Ext)
   \end{itemize}
 }
@@ -362,8 +369,8 @@ for (int i = 0; i < VL; ++i)
    \item key is int regfile number or FP regfile number (1 bit)\vspace{6pt}
    \item register to be predicated if referred to (5 bits, key)\vspace{6pt}
    \item register to store actual predication in (5 bits, value)\vspace{6pt}
-   \item predication is inverted (1 bit)\vspace{6pt}
-   \item non-predicated elements are to be zero'd (1 bit)\vspace{6pt}
+   \item predication is inverted Y/N (1 bit)\vspace{6pt}
+   \item non-predicated elements are to be zero'd Y/N (1 bit)\vspace{6pt}
   \end{itemize}
   Notes:\vspace{10pt}
    \begin{itemize}
@@ -374,6 +381,30 @@ for (int i = 0; i < VL; ++i)
 }
 
 
+\begin{frame}[fragile]
+\frametitle{Predication key-value CSR table decoding pseudocode}
+
+\begin{semiverbatim}
+struct pred fp_pred[32];
+struct pred int_pred[32];
+
+for (i = 0; i < 16; i++) // 16 CSRs?
+   tb = int\_pred if CSRpred[i].type == 0 else fp\_pred
+   idx = CSRpred[i].regidx
+   tb[idx].zero     = CSRpred[i].zero
+   tb[idx].inv      = CSRpred[i].inv
+   tb[idx].predidx  = CSRpred[i].predidx
+   tb[idx].enabled  = true
+\end{semiverbatim}
+
+ \begin{itemize}
+   \item Entries zero'd before setting
+   \item Might be a bit complex to set up (TBD)
+  \end{itemize}
+
+\end{frame}
+
+
 \frame{\frametitle{Register key-value CSR store}
 
  \begin{itemize}
@@ -391,13 +422,21 @@ for (int i = 0; i < VL; ++i)
 }
 
 
+\frame{\frametitle{Register key-value CSR pseudocode}
+
+ \begin{itemize}
+   \item TODO
+  \end{itemize}
+}
+
+
 \frame{\frametitle{C.MV extremely flexible!}
 
  \begin{itemize}
    \item scalar-to-vector (w/ no pred): VSPLAT
    \item scalar-to-vector (w/ dest-pred): Sparse VSPLAT
    \item scalar-to-vector (w/ 1-bit dest-pred): VINSERT
-   \item vector-to-scalar (w/ src-pred): VEXTRACT
+   \item vector-to-scalar (w/ [1-bit?] src-pred): VEXTRACT
    \item vector-to-vector (w/ no pred): Vector Copy
    \item vector-to-vector (w/ src pred): Vector Gather
    \item vector-to-vector (w/ dest pred): Vector Scatter
@@ -406,8 +445,8 @@ for (int i = 0; i < VL; ++i)
   \vspace{4pt}
   Notes:
    \begin{itemize}
-   \item Really powerful!
-   \item Any other options?
+   \item Surprisingly powerful!
+   \item Same arrangement for FVCT, FMV, FSGNJ etc.
   \end{itemize}
 }