1 \documentclass[slidestop
]{beamer
}
2 \usepackage{beamerthemesplit
}
6 \title{Simple-V RISC-V Extension for Vectorisation and SIMD
}
7 \author{Luke Kenneth Casson Leighton
}
14 \huge{Simple-V RISC-V Parallelism Abstraction Extension
}\\
16 \Large{Flexible Vectorisation
}\\
17 \Large{(aka not so Simple-V?)
}\\
18 \Large{(aka A Parallelism API for the RISC-V ISA)
}\\
20 \Large{[proposed for
] Chennai
9th RISC-V Workshop
}\\
27 \frame{\frametitle{Credits and Acknowledgements
}
30 \item The Designers of RISC-V
\vspace{15pt
}
31 \item The RVV Working Group and contributors
\vspace{15pt
}
32 \item Allen Baum, Jacob Bachmeyer, Xan Phung, Chuanhua Chang,\\
33 Guy Lemurieux, Jonathan Neuschafer, Roger Brussee,
34 and others
\vspace{15pt
}
35 \item ISA-Dev Group Members
\vspace{10pt
}
40 \frame{\frametitle{Quick refresher on SIMD
}
43 \item SIMD very easy to implement (and very seductive)
\vspace{8pt
}
44 \item Parallelism is in the ALU
\vspace{8pt
}
45 \item Zero-to-Negligeable impact for rest of core
\vspace{8pt
}
47 Where SIMD Goes Wrong:
\vspace{10pt
}
49 \item See "SIMD instructions considered harmful"
50 https://sigarch.org/simd-instructions-considered-harmful
51 \item Setup and corner-cases alone are extremely complex.\\
52 Hardware is easy, but software is hell.
53 \item O($N^
{6}$) ISA opcode proliferation (
1000s of instructions)\\
54 opcode, elwidth, veclen, src1-src2-dest hi/lo
58 \frame{\frametitle{Quick refresher on RVV
}
61 \item Effectively a variant of SIMD / SIMT (arbitrary length)
\vspace{4pt
}
62 \item Fascinatingly, despite being a SIMD-variant, RVV only has
63 O(N) opcode proliferation! (extremely well designed)
64 \item Extremely powerful (extensible to
256 registers)
\vspace{4pt
}
65 \item Supports polymorphism, several datatypes (inc. FP16)
\vspace{4pt
}
66 \item Requires a separate Register File (
32 w/ext to
256)
\vspace{4pt
}
67 \item Implemented as a separate pipeline (no impact on scalar)
71 \item 98 percent opcode duplication with rest of RV
72 \item Extending RVV requires customisation not just of h/w:\\
73 gcc, binutils also need customisation (and maintenance)
78 \frame{\frametitle{The Simon Sinek lowdown (Why, How, What)
}
82 Implementors need flexibility in vectorisation to optimise for
83 area or performance depending on the scope:
84 embedded DSP, Mobile GPU's, Server CPU's and more.\\
85 Compilers also need flexibility in vectorisation to optimise for cost
86 of pipeline setup, amount of state to context switch
87 and software portability
89 By marking INT/FP regs as "Vectorised" and
90 adding a level of indirection,
91 SV expresses how existing instructions should act
92 on
[contiguous
] blocks of registers, in parallel, WITHOUT
93 needing any new extra arithmetic opcodes.
95 Simple-V is an "API" that implicitly extends
96 existing (scalar) instructions with explicit parallelisation\\
97 i.e. SV is actually about parallelism NOT vectors per se.\\
98 Has a lot in common with VLIW (without the actual VLIW).
103 \frame{\frametitle{What's the value of SV? Why adopt it even in non-V?
}
106 \item memcpy has a much higher bang-per-buck ratio
107 \item context-switch (LOAD/STORE multiple):
1-
2 instructions
108 \item Compressed instrs further reduces I-cache (etc.)
109 \item Reduced I-cache load (and less I-reads)
110 \item Amazingly, SIMD becomes tolerable (no corner-cases)
111 \item Modularity/Abstraction in both the h/w and the toolchain.
112 \item "Reach" of registers accessible by Compressed is enhanced
113 \item Future: double the standard INT/FP register file sizes.
117 \item It's not just about Vectors: it's about instruction effectiveness
118 \item Anything implementor is not interested in HW-optimising,\\
119 let it fall through to exceptions (implement as a trap).
124 \frame{\frametitle{How does Simple-V relate to RVV? What's different?
}
127 \item RVV very heavy-duty (excellent for supercomputing)
\vspace{4pt
}
128 \item Simple-V abstracts parallelism (based on best of RVV)
\vspace{4pt
}
129 \item Graded levels: hardware, hybrid or traps (fit impl. need)
\vspace{4pt
}
130 \item Even Compressed become vectorised (RVV can't)
\vspace{4pt
}
131 \item No polymorphism in SV (too complex)
\vspace{4pt
}
133 What Simple-V is not:
\vspace{4pt
}
135 \item A full supercomputer-level Vector Proposal\\
136 (it's not actually a Vector Proposal at all!)
137 \item A replacement for RVV (SV is designed to be over-ridden\\
138 by - or augmented to become - RVV)
143 \frame{\frametitle{How is Parallelism abstracted in Simple-V?
}
146 \item Register "typing" turns any op into an implicit Vector op:\\
147 registers are reinterpreted through a level of indirection
148 \item Primarily at the Instruction issue phase (except SIMD)\\
149 Note: it's ok to pass predication through to ALU (like SIMD)
150 \item Standard and future and custom opcodes now parallel\\
151 (crucially: with NO extra instructions needing to be added)
153 Note: EVERY scalar op now paralleliseable
155 \item All LOAD/STORE (inc. Compressed, Int/FP versions)
156 \item All ALU ops (Int, FP, SIMD, DSP, everything)
157 \item All branches become predication targets (note: no FNE)
158 \item C.MV of particular interest (s/v, v/v, v/s)
159 \item FCVT, FMV, FSGNJ etc. very similar to C.MV
164 \frame{\frametitle{What's the deal / juice / score?
}
167 \item Standard Register File(s) overloaded with CSR "reg is vector"\\
168 (see pseudocode slides for examples)
169 \item "
2nd FP\&INT register bank" possibility, reserved for future\\
170 (would allow standard regfiles to remain unmodified)
171 \item Element width concept remain same as RVV\\
172 (CSRs give new size: overrides opcode-defined meaning)
173 \item CSRs are key-value tables (overlaps allowed: v. important)
175 Key differences from RVV:
177 \item Predication in INT reg as a BIT field (max VL=XLEN)
178 \item Minimum VL must be Num Regs -
1 (all regs single LD/ST)
179 \item SV may condense sparse Vecs: RVV cannot (SIMD-like):\\
180 SV gives choice to Zero or skip non-predicated elements\\
181 (no such choice in RVV: zeroing-only)
186 \begin{frame
}[fragile
]
187 \frametitle{ADD pseudocode (or trap, or actual hardware loop)
}
190 function op
\_add(rd, rs1, rs2, predr) # add not VADD!
191 int i, id=
0, irs1=
0, irs2=
0;
192 for (i =
0; i < VL; i++)
193 if (ireg
[predr
] &
1<<i) # predication uses intregs
194 ireg
[rd+id
] <= ireg
[rs1+irs1
] + ireg
[rs2+irs2
];
195 if (reg
\_is\_vectorised[rd
] ) \
{ id +=
1; \
}
196 if (reg
\_is\_vectorised[rs1
]) \
{ irs1 +=
1; \
}
197 if (reg
\_is\_vectorised[rs2
]) \
{ irs2 +=
1; \
}
201 \item Above is oversimplified: Reg. indirection left out (for clarity).
202 \item SIMD slightly more complex (case above is elwidth = default)
203 \item Scalar-scalar and scalar-vector and vector-vector now all in one
204 \item OoO may choose to push ADDs into instr. queue (v. busy!)
208 % yes it really *is* ADD not VADD. that's the entire point of
209 % this proposal, that *standard* operations are overloaded to
210 % become vectorised-on-demand
213 \begin{frame
}[fragile
]
214 \frametitle{Predication-Branch (or trap, or actual hardware loop)
}
217 s1 = reg
\_is\_vectorised(src1);
218 s2 = reg
\_is\_vectorised(src2);
219 if (!s2 && !s1) goto branch;
220 for (int i =
0; i < VL; ++i)
221 if (cmp(s1 ? reg
[src1+i
]:reg
[src1
],
222 s2 ? reg
[src2+i
]:reg
[src2
])
227 \item SIMD slightly more complex (case above is elwidth = default)
228 \item If s1 and s2 both scalars, Standard branch occurs
229 \item Predication stored in integer regfile as a bitfield
230 \item Scalar-vector and vector-vector supported
231 \item Overload Branch immediate to be predication target rs3
235 \begin{frame
}[fragile
]
236 \frametitle{VLD/VLD.S/VLD.X (or trap, or actual hardware loop)
}
239 if (unit-strided) stride = elsize;
240 else stride = areg
[as2
]; // constant-strided
241 for (int i =
0; i < VL; ++i)
242 if (
[!
]preg
[rd
] &
1<<i)
243 for (int j =
0; j < seglen+
1; j++)
244 if (reg
\_is\_vectorised[rs2
]) offs = vreg
[rs2+i
]
245 else offs = i*(seglen+
1)*stride;
246 vreg
[rd+j
][i
] = mem
[sreg
[base
] + offs + j*stride
]
250 \item Again: elwidth != default slightly more complex
251 \item rs2 vectorised taken to implicitly indicate VLD.X
256 \frame{\frametitle{Register key-value CSR store (lookup table / CAM)
}
259 \item key is int regfile number or FP regfile number (
1 bit)
260 \item treated as vector if referred to in op (
5 bits, key)
261 \item starting register to actually be used (
5 bits, value)
262 \item element bitwidth: default, dflt/
2,
8,
16 (
2 bits)
263 \item is vector: Y/N (
1 bit)
264 \item is packed SIMD: Y/N (
1 bit)
265 \item register bank:
0/reserved for future ext. (
1 bit)
269 \item References different (internal) mapping table for INT or FP
270 \item Level of indirection has implications for pipeline latency
271 \item (future) bank bit, no need to extend opcodes: set bank=
1,
272 just use normal
5-bit regs, indirection takes care of the rest.
277 \frame{\frametitle{Register element width and packed SIMD
}
281 \item default: RV32/
64/
128 opcodes define elwidth =
32/
64/
128
282 \item default/
2: RV32/
64/
128 opcodes, elwidth =
16/
32/
64 with
283 top half of register ignored (src), zero'd/s-ext (dest)
284 \item 8 or
16: elwidth =
8 (or
16), similar to default/
2
286 Packed SIMD = Y (default is moot, packing is
1:
1)
288 \item default/
2:
2 elements per register @ opcode-defined bitwidth
289 \item 8 or
16: standard
8 (or
16) packed SIMD
293 \item Different src/dest widths (and packs) PERMITTED
294 \item RV* already allows (and defines) how RV32 ops work in RV64\\
295 so just logically follow that lead/example.
300 \begin{frame
}[fragile
]
301 \frametitle{Register key-value CSR table decoding pseudocode
}
304 struct vectorised fp
\_vec[32], int
\_vec[32];
305 for (i =
0; i <
16; i++) //
16 CSRs?
306 tb = int
\_vec if CSRvec
[i
].type ==
0 else fp
\_vec
307 idx = CSRvec
[i
].regkey // INT/FP src/dst reg in opcode
308 tb
[idx
].elwidth = CSRvec
[i
].elwidth
309 tb
[idx
].regidx = CSRvec
[i
].regidx // indirection
310 tb
[idx
].regidx += CSRvec
[i
].bank <<
5 //
0 (
1=rsvd)
311 tb
[idx
].isvector = CSRvec
[i
].isvector
312 tb
[idx
].packed = CSRvec
[i
].packed // SIMD or not
313 tb
[idx
].enabled = true
317 \item All
32 int (and
32 FP) entries zero'd before setup
318 \item Might be a bit complex to set up in hardware (keep as CAM?)
324 \frame{\frametitle{Predication key-value CSR store
}
327 \item key is int regfile number or FP regfile number (
1 bit)
328 \item register to be predicated if referred to (
5 bits, key)
329 \item INT reg with actual predication mask (
5 bits, value)
330 \item predication is inverted Y/N (
1 bit)
331 \item non-predicated elements are to be zero'd Y/N (
1 bit)
332 \item register bank:
0/reserved for future ext. (
1 bit)
336 \item Table should be expanded out for high-speed implementations
337 \item Key-value overlaps permitted, but (key+type) must be unique
338 \item RVV rules about deleting higher-indexed CSRs followed
343 \begin{frame
}[fragile
]
344 \frametitle{Predication key-value CSR table decoding pseudocode
}
347 struct pred fp
\_pred[32], int
\_pred[32];
348 for (i =
0; i <
16; i++) //
16 CSRs?
349 tb = int
\_pred if CSRpred
[i
].type ==
0 else fp
\_pred
350 idx = CSRpred
[i
].regkey
351 tb
[idx
].zero = CSRpred
[i
].zero // zeroing
352 tb
[idx
].inv = CSRpred
[i
].inv // inverted
353 tb
[idx
].predidx = CSRpred
[i
].predidx // actual reg
354 tb
[idx
].predidx += CSRvec
[i
].bank <<
5 //
0 (
1=rsvd)
355 tb
[idx
].enabled = true
359 \item All
32 int and
32 FP entries zero'd before setting\\
360 (predication disabled)
361 \item Might be a bit complex to set up in hardware (keep as CAM?)
367 \begin{frame
}[fragile
]
368 \frametitle{Get Predication value pseudocode
}
371 def get
\_pred\_val(bool is
\_fp\_op, int reg):
372 tb = int
\_pred if is
\_fp\_op else fp
\_pred
373 if (!tb
[reg
].enabled): return ~
0x0 // all ops enabled
374 predidx = tb
[reg
].predidx // redirection occurs HERE
375 predidx += tb
[reg
].bank <<
5 //
0 (
1=rsvd)
376 predicate = intreg
[predidx
] // actual predicate HERE
378 predicate = ~predicate // invert ALL bits
383 \item References different (internal) mapping table for INT or FP
384 \item Actual predicate bitmask ALWAYS from the INT regfile
385 \item Hard-limit on MVL of XLEN (predication only
1 intreg)
391 \frame{\frametitle{To Zero or not to place zeros in non-predicated elements?
}
394 \item Zeroing is an implementation optimisation favouring OoO
395 \item Simple implementations may skip non-predicated operations
396 \item Simple implementations explicitly have to destroy data
397 \item Complex implementations may use reg-renames to save power\\
398 Zeroing on predication chains makes optimisation harder
399 \item Compromise: REQUIRE both (specified in predication CSRs).
403 \item Complex not really impacted, simple impacted a LOT\\
404 with Zeroing... however it's useful (memzero)
405 \item Non-zero'd overlapping "Vectors" may issue overlapping ops\\
406 (
2nd op's predicated elements slot in
1st's non-predicated ops)
407 \item Please don't use Vectors for "security" (use Sec-Ext)
410 % with overlapping "vectors" - bearing in mind that "vectors" are
411 % just a remap onto the standard register file, if the top bits of
412 % predication are zero, and there happens to be a second vector
413 % that uses some of the same register file that happens to be
414 % predicated out, the second vector op may be issued *at the same time*
415 % if there are available parallel ALUs to do so.
418 \frame{\frametitle{Implementation Options
}
421 \item Absolute minimum: Exceptions: if CSRs indicate "V", trap.\\
422 (Requires as absolute minimum that CSRs be in Hardware)
423 \item Hardware loop, single-instruction issue\\
424 (Do / Don't send through predication to ALU)
425 \item Hardware loop, parallel (multi-instruction) issue\\
426 (Do / Don't send through predication to ALU)
427 \item Hardware loop, full parallel ALU (not recommended)
431 \item 4 (or more?) options above may be deployed on per-op basis
432 \item SIMD always sends predication bits to ALU (if requested)
433 \item Minimum MVL MUST be sufficient to cover regfile LD/ST
434 \item Instr. FIFO may repeatedly split off N scalar ops at a time
437 % Instr. FIFO may need its own slide. Basically, the vectorised op
438 % gets pushed into the FIFO, where it is then "processed". Processing
439 % will remove the first set of ops from its vector numbering (taking
440 % predication into account) and shoving them **BACK** into the FIFO,
441 % but MODIFYING the remaining "vectorised" op, subtracting the now
442 % scalar ops from it.
444 \frame{\frametitle{Predicated
8-parallel ADD:
1-wide ALU (no zeroing)
}
446 \includegraphics[height=
2.5in
]{padd9_alu1.png
}\\
447 {\bf \red Predicated adds are shuffled down:
6 cycles in total
}
452 \frame{\frametitle{Predicated
8-parallel ADD:
4-wide ALU (no zeroing)
}
454 \includegraphics[height=
2.5in
]{padd9_alu4.png
}\\
455 {\bf \red Predicated adds are shuffled down:
4 in
1st cycle,
2 in
2nd
}
460 \frame{\frametitle{Predicated
8-parallel ADD:
3 phase FIFO expansion
}
462 \includegraphics[height=
2.5in
]{padd9_fifo.png
}\\
463 {\bf \red First cycle takes first four
1s; second takes the rest
}
468 \begin{frame
}[fragile
]
469 \frametitle{ADD pseudocode with redirection (and proper predication)
}
472 function op
\_add(rd, rs1, rs2) # add not VADD!
473 int i, id=
0, irs1=
0, irs2=
0;
474 predval = get
\_pred\_val(FALSE, rd);
475 rd = int
\_vec[rd
].isvector ? int
\_vec[rd
].regidx : rd;
476 rs1 = int
\_vec[rs1
].isvector ? int
\_vec[rs1
].regidx : rs1;
477 rs2 = int
\_vec[rs2
].isvector ? int
\_vec[rs2
].regidx : rs2;
478 for (i =
0; i < VL; i++)
479 if (predval \&
1<<i) # predication uses intregs
480 ireg
[rd+id
] <= ireg
[rs1+irs1
] + ireg
[rs2+irs2
];
481 if (int
\_vec[rd
].isvector) \
{ id +=
1; \
}
482 if (int
\_vec[rs1
].isvector) \
{ irs1 +=
1; \
}
483 if (int
\_vec[rs2
].isvector) \
{ irs2 +=
1; \
}
487 \item SIMD (elwidth != default) not covered above
492 \frame{\frametitle{How are SIMD Instructions Vectorised?
}
495 \item SIMD ALU(s) primarily unchanged
496 \item Predication added down to each SIMD element (if requested,
497 otherwise entire block will be predicated as a whole)
498 \item Predication bits sent in groups to the ALU (if requested,
499 otherwise just one bit for the entire packed block)
500 \item End of Vector enables (additional) predication:
501 completely nullifies end-case code (ONLY in multi-bit
506 \item Many SIMD ALUs possible (parallel execution)
507 \item Implementor free to choose (API remains the same)
508 \item Unused ALU units wasted, but s/w DRASTICALLY simpler
509 \item Very long SIMD ALUs could waste significant die area
512 % With multiple SIMD ALUs at for example 32-bit wide they can be used
513 % to either issue 64-bit or 128-bit or 256-bit wide SIMD operations
514 % or they can be used to cover several operations on totally different
515 % vectors / registers.
517 \frame{\frametitle{Predicated
9-parallel SIMD ADD (Packed=Y)
}
519 \includegraphics[height=
2.5in
]{padd9_simd.png
}\\
520 {\bf \red 4-wide
8-bit SIMD,
4 bits of predicate passed to ALU
}
525 \frame{\frametitle{Why are overlaps allowed in Regfiles?
}
528 \item Same target register(s) can have multiple "interpretations"
529 \item CSRs are costly to write to (do it once)
530 \item Set "real" register (scalar) without needing to set/unset CSRs.
531 \item xBitManip plus SIMD plus xBitManip = Hi/Lo bitops
532 \item (
32-bit GREV plus
4x8-bit SIMD plus
32-bit GREV:\\
533 GREV @ VL=N,wid=
32; SIMD @ VL=Nx4,wid=
8)
534 \item RGB
565 (video): BEXTW plus
4x8-bit SIMD plus BDEPW\\
535 (BEXT/BDEP @ VL=N,wid=
32; SIMD @ VL=Nx4,wid=
8)
536 \item Same register(s) can be offset (no need for VSLIDE)
\vspace{6pt
}
540 \item xBitManip reduces O($N^
{6}$) SIMD down to O($N^
{3}$) on its own.
541 \item Hi-Performance: Macro-op fusion (more pipeline stages?)
546 \frame{\frametitle{C.MV extremely flexible!
}
549 \item scalar-to-vector (w/ no pred): VSPLAT
550 \item scalar-to-vector (w/ dest-pred): Sparse VSPLAT
551 \item scalar-to-vector (w/
1-bit dest-pred): VINSERT
552 \item vector-to-scalar (w/
[1-bit?
] src-pred): VEXTRACT
553 \item vector-to-vector (w/ no pred): Vector Copy
554 \item vector-to-vector (w/ src pred): Vector Gather (inc VSLIDE)
555 \item vector-to-vector (w/ dest pred): Vector Scatter (inc. VSLIDE)
556 \item vector-to-vector (w/ src \& dest pred): Vector Gather/Scatter
561 \item Surprisingly powerful! Zero-predication even more so
562 \item Same arrangement for FCVT, FMV, FSGNJ etc.
567 \begin{frame
}[fragile
]
568 \frametitle{MV pseudocode with predication
}
571 function op
\_mv(rd, rs) # MV not VMV!
572 rd = int
\_vec[rd
].isvector ? int
\_vec[rd
].regidx : rd;
573 rs = int
\_vec[rs
].isvector ? int
\_vec[rs
].regidx : rs;
574 ps = get
\_pred\_val(FALSE, rs); # predication on src
575 pd = get
\_pred\_val(FALSE, rd); # ... AND on dest
576 for (int i =
0, int j =
0; i < VL && j < VL;):
577 if (int
\_vec[rs
].isvec) while (!(ps \&
1<<i)) i++;
578 if (int
\_vec[rd
].isvec) while (!(pd \&
1<<j)) j++;
579 ireg
[rd+j
] <= ireg
[rs+i
];
580 if (int
\_vec[rs
].isvec) i++;
581 if (int
\_vec[rd
].isvec) j++;
585 \item elwidth != default not covered above (might be a bit hairy)
586 \item Ending early with
1-bit predication not included (VINSERT)
591 \begin{frame
}[fragile
]
592 \frametitle{VSELECT: stays or goes? Stays if MV.X exists...
}
595 def op_mv_x(rd, rs): # (hypothetical) RV MX.X
596 rs = regfile
[rs
] # level of indirection (MV.X)
597 regfile
[rd
] = regfile
[rs
] # straight regcopy
600 Vectorised version aka "VSELECT":
603 def op_mv_x(rd, rs): # SV version of MX.X
605 rs1 = regfile
[rs+i
] # indirection
606 regfile
[rd+i
] = regfile
[rs
] # straight regcopy
610 \item However MV.X does not exist in RV, so neither can VSELECT
611 \item \red SV is not about adding new functionality, only parallelism
618 \frame{\frametitle{Opcodes, compared to RVV
}
621 \item All integer and FP opcodes all removed (no CLIP, FNE)
622 \item VMPOP, VFIRST etc. all removed (use xBitManip)
623 \item VSLIDE removed (use regfile overlaps)
624 \item C.MV covers VEXTRACT VINSERT and VSPLAT (and more)
625 \item Vector (or scalar-vector) copy: use C.MV (MV is a pseudo-op)
626 \item VMERGE: twin predicated C.MVs (one inverted. macro-op'd)
627 \item VSETVL, VGETVL stay (the only ops that do!)
631 \item VSELECT stays? no MV.X, so no (add with custom ext?)
632 \item VSNE exists, but no FNE (use predication inversion?)
633 \item VCLIP is not in RV* (add with custom ext? or CSR?)
638 \begin{frame
}[fragile
]
639 \frametitle{Example c code: DAXPY
}
642 void daxpy(size_t n, double a,
643 const double x
[], double y
[])
645 for (size_t i =
0; i < n; i++) \
{
646 y
[i
] = a*x
[i
] + y
[i
];
652 \item See "SIMD Considered Harmful" for SIMD/RVV analysis\\
653 https://sigarch.org/simd-instructions-considered-harmful/
660 \begin{frame
}[fragile
]
661 \frametitle{RVV DAXPY assembly (RV32V)
}
664 # a0 is n, a1 is ptr to x
[0], a2 is ptr to y
[0], fa0 is a
666 vsetdcfg t0 # enable
2 64b Fl.Pt. registers
668 setvl t0, a0 # vl = t0 = min(mvl, n)
669 vld v0, a1 # load vector x
670 slli t1, t0,
3 # t1 = vl *
8 (in bytes)
671 vld v1, a2 # load vector y
672 add a1, a1, t1 # increment pointer to x by vl*
8
673 vfmadd v1, v0, fa0, v1 # v1 += v0 * fa0 (y = a * x + y)
674 sub a0, a0, t0 # n -= vl (t0)
676 add a2, a2, t1 # increment pointer to y by vl*
8
677 bnez a0, loop # repeat if n !=
0
682 \begin{frame
}[fragile
]
683 \frametitle{SV DAXPY assembly (RV64D)
}
686 # a0 is n, a1 is ptr to x
[0], a2 is ptr to y
[0], fa0 is a
687 CSRvect1 = \
{type: F, key: a3, val: a3, elwidth: dflt\
}
688 CSRvect2 = \
{type: F, key: a7, val: a7, elwidth: dflt\
}
690 setvl t0, a0,
4 # vl = t0 = min(min(
63,
4), a0))
691 ld a3, a1 # load
4 registers a3-
6 from x
692 slli t1, t0,
3 # t1 = vl *
8 (in bytes)
693 ld a7, a2 # load
4 registers a7-
10 from y
694 add a1, a1, t1 # increment pointer to x by vl*
8
695 fmadd a7, a3, fa0, a7 # v1 += v0 * fa0 (y = a * x + y)
696 sub a0, a0, t0 # n -= vl (t0)
697 st a7, a2 # store
4 registers a7-
10 to y
698 add a2, a2, t1 # increment pointer to y by vl*
8
699 bnez a0, loop # repeat if n !=
0
704 \frame{\frametitle{Under consideration (some answers documented)
}
707 \item Should future extra bank be included now?
708 \item How many Register and Predication CSRs should there be?\\
709 (and how many in RV32E)
710 \item How many in M-Mode (for doing context-switch)?
711 \item Should use of registers be allowed to "wrap" (x30 x31 x1 x2)?
712 \item Can CLIP be done as a CSR (mode, like elwidth)
713 \item SIMD saturation (etc.) also set as a mode?
714 \item Include src1/src2 predication on Comparison Ops?\\
715 (same arrangement as C.MV, with same flexibility/power)
716 \item 8/
16-bit ops is it worthwhile adding a "start offset"? \\
717 (a bit like misaligned addressing... for registers)\\
718 or just use predication to skip start?
719 \item see http://libre-riscv.org/simple
\_v\_extension/\#issues
724 \frame{\frametitle{What's the downside(s) of SV?
}
726 \item EVERY register operation is inherently parallelised\\
727 (scalar ops are just vectors of length
1)
\vspace{4pt
}
728 \item Tightly coupled with the core (instruction issue)\\
729 could be disabled through MISA switch
\vspace{4pt
}
730 \item An extra pipeline phase almost certainly essential\\
731 for fast low-latency implementations
\vspace{4pt
}
732 \item With zeroing off, skipping non-predicated elements is hard:\\
733 it is however an optimisation (and need not be done).
\vspace{4pt
}
734 \item Setting up the Register/Predication tables (interpreting the\\
735 CSR key-value stores) might be a bit complex to optimise
736 (any change to a CSR key-value entry needs to redo the table)
741 \frame{\frametitle{Summary
}
744 \item Actually about parallelism, not Vectors (or SIMD) per se\\
745 and NOT about adding new ALU/logic/functionality.
746 \item Only needs
2 actual instructions (plus the CSRs).\\
747 RVV - and "standard" SIMD - require ISA duplication
748 \item Designed for flexibility (graded levels of complexity)
749 \item Huge range of implementor freedom
750 \item Fits RISC-V ethos: achieve more with less
751 \item Reduces SIMD ISA proliferation by
3-
4 orders of magnitude \\
752 (without SIMD downsides or sacrificing speed trade-off)
753 \item Covers
98\% of RVV, allows RVV to fit "on top"
754 \item Byproduct of SV is a reduction in code size, power usage
755 etc. (increase efficiency, just like Compressed)
762 {\Huge The end
\vspace{20pt
}\\
763 Thank you
\vspace{20pt
}\\
764 Questions?
\vspace{20pt
}
769 \item Discussion: ISA-DEV mailing list
770 \item http://libre-riscv.org/simple
\_v\_extension/