whitespace cleanup
[libreriscv.git] / simple_v_extension.mdwn
1 # Variable-width Variable-packed SIMD / Simple-V / Parallelism Extension Proposal
2
3 [[!toc ]]
4
5 # Summary
6
7 Key insight: Simple-V is intended as an abstraction layer to provide
8 a consistent "API" to parallelisation of existing *and future* operations.
9 *Actual* internal hardware-level parallelism is *not* required, such
10 that Simple-V may be viewed as providing a "compact" or "consolidated"
11 means of issuing multiple near-identical arithmetic instructions to an
12 instruction queue (FILO), pending execution.
13
14 *Actual* parallelism, if added independently of Simple-V in the form
15 of Out-of-order restructuring (including parallel ALU lanes) or VLIW
16 implementations, or SIMD, or anything else, would then benefit *if*
17 Simple-V was added on top.
18
19 # Introduction
20
21 This proposal exists so as to be able to satisfy several disparate
22 requirements: power-conscious, area-conscious, and performance-conscious
23 designs all pull an ISA and its implementation in different conflicting
24 directions, as do the specific intended uses for any given implementation.
25
26 Additionally, the existing P (SIMD) proposal and the V (Vector) proposals,
27 whilst each extremely powerful in their own right and clearly desirable,
28 are also:
29
30 * Clearly independent in their origins (Cray and AndesStar v3 respectively)
31 so need work to adapt to the RISC-V ethos and paradigm
32 * Are sufficiently large so as to make adoption (and exploration for
33 analysis and review purposes) prohibitively expensive
34 * Both contain partial duplication of pre-existing RISC-V instructions
35 (an undesirable characteristic)
36 * Both have independent and disparate methods for introducing parallelism
37 at the instruction level.
38 * Both require that their respective parallelism paradigm be implemented
39 along-side and integral to their respective functionality *or not at all*.
40 * Both independently have methods for introducing parallelism that
41 could, if separated, benefit
42 *other areas of RISC-V not just DSP or Floating-point respectively*.
43
44 Therefore it makes a huge amount of sense to have a means and method
45 of introducing instruction parallelism in a flexible way that provides
46 implementors with the option to choose exactly where they wish to offer
47 performance improvements and where they wish to optimise for power
48 and/or area (and if that can be offered even on a per-operation basis that
49 would provide even more flexibility).
50
51 Additionally it makes sense to *split out* the parallelism inherent within
52 each of P and V, and to see if each of P and V then, in *combination* with
53 a "best-of-both" parallelism extension, could be added on *on top* of
54 this proposal, to topologically provide the exact same functionality of
55 each of P and V.
56
57 Furthermore, an additional goal of this proposal is to reduce the number
58 of opcodes utilised by each of P and V as they currently stand, leveraging
59 existing RISC-V opcodes where possible, and also potentially allowing
60 P and V to make use of Compressed Instructions as a result.
61
62 **TODO**: reword this to better suit this document:
63
64 Having looked at both P and V as they stand, they're _both_ very much
65 "separate engines" that, despite both their respective merits and
66 extremely powerful features, don't really cleanly fit into the RV design
67 ethos (or the flexible extensibility) and, as such, are both in danger
68 of not being widely adopted. I'm inclined towards recommending:
69
70 * splitting out the DSP aspects of P-SIMD to create a single-issue DSP
71 * splitting out the polymorphism, esoteric data types (GF, complex
72 numbers) and unusual operations of V to create a single-issue "Esoteric
73 Floating-Point" extension
74 * splitting out the loop-aspects, vector aspects and data-width aspects
75 of both P and V to a *new* "P-SIMD / Simple-V" and requiring that they
76 apply across *all* Extensions, whether those be DSP, M, Base, V, P -
77 everything.
78
79 **TODO**: propose overflow registers be actually one of the integer regs
80 (flowing to multiple regs).
81
82 **TODO**: propose "mask" (predication) registers likewise. combination with
83 standard RV instructions and overflow registers extremely powerful
84
85 ## CSRs marking registers as Vector
86
87 A 32-bit CSR would be needed (1 bit per integer register) to indicate
88 whether a register was, if referred to, implicitly to be treated as
89 a vector.
90
91 A second 32-bit CSR would be needed (1 bit per floating-point register)
92 to indicate whether a floating-point register was to be treated as a
93 vector.
94
95 In this way any standard (current or future) operation involving
96 register operands may detect if the operation is to be vector-vector,
97 vector-scalar or scalar-scalar (standard) simply through a single
98 bit test.
99
100 ## CSR vector-length and CSR SIMD packed-bitwidth
101
102 **TODO** analyse each of these:
103
104 * splitting out the loop-aspects, vector aspects and data-width aspects
105 * integer reg 0 *and* fp reg0 share CSR vlen 0 *and* CSR packed-bitwidth 0
106 * integer reg 1 *and* fp reg1 share CSR vlen 1 *and* CSR packed-bitwidth 1
107 * ....
108 * .... 
109
110 instead:
111
112 * CSR vlen 0 *and* CSR packed-bitwidth 0 register contain extra bits
113 specifying an *INDEX* of WHICH int/fp register they refer to
114 * CSR vlen 1 *and* CSR packed-bitwidth 1 register contain extra bits
115 specifying an *INDEX* of WHICH int/fp register they refer to
116 * ...
117 * ...
118
119 Have to be very *very* careful about not implementing too few of those
120 (or too many). Assess implementation impact on decode latency. Is it
121 worth it?
122
123 Implementation of the latter:
124
125 Operation involving (referring to) register M:
126
127 bitwidth = default # default for opcode?
128 vectorlen = 1 # scalar
129
130 for (o = 0, o < 2, o++)
131   if (CSR-Vector_registernum[o] == M)
132       bitwidth = CSR-Vector_bitwidth[o]
133       vectorlen = CSR-Vector_len[o]
134       break
135
136 and for the former it would simply be:
137
138 bitwidth = CSR-Vector_bitwidth[M]
139 vectorlen = CSR-Vector_len[M]
140
141 Alternatives:
142
143 * One single "global" vector-length CSR
144
145 ## Stride
146
147 **TODO**: propose two LOAD/STORE offset CSRs, which mark a particular
148 register as being "if you use this reg in LOAD/STORE, use the offset
149 amount CSRoffsN (N=0,1) instead of treating LOAD/STORE as contiguous".
150 can be used for matrix spanning.
151
152 > For LOAD/STORE, could a better option be to interpret the offset in the
153 > opcode as a stride instead, so "LOAD t3, 12(t2)" would, if t3 is
154 > configured as a length-4 vector base, result in t3 = *t2, t4 = *(t2+12),
155 > t5 = *(t2+24), t6 = *(t2+32)?  Perhaps include a bit in the
156 > vector-control CSRs to select between offset-as-stride and unit-stride
157 > memory accesses?
158
159 So there would be an instruction like this:
160
161 | SETOFF | On=rN | OBank={float|int} | Smode={offs|unit} | OFFn=rM |
162 | opcode | 5 bit | 1 bit | 1 bit | 5 bit, OFFn=XLEN |
163
164
165 which would mean:
166
167 * CSR-Offset register n <= (float|int) register number N
168 * CSR-Offset Stride-mode = offset or unit
169 * CSR-Offset amount register n = contents of register M
170
171 LOAD rN, ldoffs(rM) would then be (assuming packed bit-width not set):
172
173 offs = 0
174 stride = 1
175 vector-len = CSR-Vector-length register N
176
177 for (o = 0, o < 2, o++)
178 if (CSR-Offset register o == M)
179 offs = CSR-Offset amount register o
180 if CSR-Offset Stride-mode == offset:
181 stride = ldoffs
182 break
183
184 for (i = 0, i < vector-len; i++)
185 r[N+i] = mem[(offs*i + r[M+i])*stride]
186
187 # Analysis and discussion of Vector vs SIMD
188
189 There are four combined areas between the two proposals that help with
190 parallelism without over-burdening the ISA with a huge proliferation of
191 instructions:
192
193 * Fixed vs variable parallelism (fixed or variable "M" in SIMD)
194 * Implicit vs fixed instruction bit-width (integral to instruction or not)
195 * Implicit vs explicit type-conversion (compounded on bit-width)
196 * Implicit vs explicit inner loops.
197 * Masks / tagging (selecting/preventing certain indexed elements from execution)
198
199 The pros and cons of each are discussed and analysed below.
200
201 ## Fixed vs variable parallelism length
202
203 In David Patterson and Andrew Waterman's analysis of SIMD and Vector
204 ISAs, the analysis comes out clearly in favour of (effectively) variable
205 length SIMD. As SIMD is a fixed width, typically 4, 8 or in extreme cases
206 16 or 32 simultaneous operations, the setup, teardown and corner-cases of SIMD
207 are extremely burdensome except for applications whose requirements
208 *specifically* match the *precise and exact* depth of the SIMD engine.
209
210 Thus, SIMD, no matter what width is chosen, is never going to be acceptable
211 for general-purpose computation, and in the context of developing a
212 general-purpose ISA, is never going to satisfy 100 percent of implementors.
213
214 That basically leaves "variable-length vector" as the clear *general-purpose*
215 winner, at least in terms of greatly simplifying the instruction set,
216 reducing the number of instructions required for any given task, and thus
217 reducing power consumption for the same.
218
219 ## Implicit vs fixed instruction bit-width
220
221 SIMD again has a severe disadvantage here, over Vector: huge proliferation
222 of specialist instructions that target 8-bit, 16-bit, 32-bit, 64-bit, and
223 have to then have operations *for each and between each*. It gets very
224 messy, very quickly.
225
226 The V-Extension on the other hand proposes to set the bit-width of
227 future instructions on a per-register basis, such that subsequent instructions
228 involving that register are *implicitly* of that particular bit-width until
229 otherwise changed or reset.
230
231 This has some extremely useful properties, without being particularly
232 burdensome to implementations, given that instruction decode already has
233 to direct the operation to a correctly-sized width ALU engine, anyway.
234
235 Not least: in places where an ISA was previously constrained (due for
236 whatever reason, including limitations of the available operand spcace),
237 implicit bit-width allows the meaning of certain operations to be
238 type-overloaded *without* pollution or alteration of frozen and immutable
239 instructions, in a fully backwards-compatible fashion.
240
241 ## Implicit and explicit type-conversion
242
243 The Draft 2.3 V-extension proposal has (deprecated) polymorphism to help
244 deal with over-population of instructions, such that type-casting from
245 integer (and floating point) of various sizes is automatically inferred
246 due to "type tagging" that is set with a special instruction. A register
247 will be *specifically* marked as "16-bit Floating-Point" and, if added
248 to an operand that is specifically tagged as "32-bit Integer" an implicit
249 type-conversion will take placce *without* requiring that type-conversion
250 to be explicitly done with its own separate instruction.
251
252 However, implicit type-conversion is not only quite burdensome to
253 implement (explosion of inferred type-to-type conversion) but also is
254 never really going to be complete. It gets even worse when bit-widths
255 also have to be taken into consideration.
256
257 Overall, type-conversion is generally best to leave to explicit
258 type-conversion instructions, or in definite specific use-cases left to
259 be part of an actual instruction (DSP or FP)
260
261 ## Zero-overhead loops vs explicit loops
262
263 The initial Draft P-SIMD Proposal by Chuanhua Chang of Andes Technology
264 contains an extremely interesting feature: zero-overhead loops. This
265 proposal would basically allow an inner loop of instructions to be
266 repeated indefinitely, a fixed number of times.
267
268 Its specific advantage over explicit loops is that the pipeline in a DSP
269 can potentially be kept completely full *even in an in-order single-issue
270 implementation*. Normally, it requires a superscalar architecture and
271 out-of-order execution capabilities to "pre-process" instructions in
272 order to keep ALU pipelines 100% occupied.
273
274 By bringing that capability in, this proposal could offer a way to increase
275 pipeline activity even in simpler implementations in the one key area
276 which really matters: the inner loop.
277
278 However when looking at much more comprehensive schemes
279 "A portable specification of zero-overhead loop control hardware
280 applied to embedded processors" (ZOLC), optimising only the single
281 inner loop seems inadequate, tending to suggest that ZOLC may be
282 better off being proposed as an entirely separate Extension.
283
284 ## Mask and Tagging (Predication)
285
286 Tagging (aka Masks aka Predication) is a pseudo-method of implementing
287 simplistic branching in a parallel fashion, by allowing execution on
288 elements of a vector to be switched on or off depending on the results
289 of prior operations in the same array position.
290
291 The reason for considering this is simple: by *definition* it
292 is not possible to perform individual parallel branches in a SIMD
293 (Single-Instruction, **Multiple**-Data) context. Branches (modifying
294 of the Program Counter) will result in *all* parallel data having
295 a different instruction executed on it: that's just the definition of
296 SIMD, and it is simply unavoidable.
297
298 So these are the ways in which conditional execution may be implemented:
299
300 * explicit compare and branch: BNE x, y -> offs would jump offs
301 instructions if x was not equal to y
302 * explicit store of tag condition: CMP x, y -> tagbit
303 * implicit (condition-code) ADD results in a carry, carry bit implicitly
304 (or sometimes explicitly) goes into a "tag" (mask) register
305
306 The first of these is a "normal" branch method, which is flat-out impossible
307 to parallelise without look-ahead and effectively rewriting instructions.
308 This would defeat the purpose of RISC.
309
310 The latter two are where parallelism becomes easy to do without complexity:
311 every operation is modified to be "conditionally executed" (in an explicit
312 way directly in the instruction format *or* implicitly).
313
314 RVV (Vector-Extension) proposes to have *explicit* storing of the compare
315 in a tag/mask register, and to *explicitly* have every vector operation
316 *require* that its operation be "predicated" on the bits within an
317 explicitly-named tag/mask register.
318
319 SIMD (P-Extension) has not yet published precise documentation on what its
320 schema is to be: there is however verbal indication at the time of writing
321 that:
322
323 > The "compare" instructions in the DSP/SIMD ISA proposed by Andes will
324 > be executed using the same compare ALU logic for the base ISA with some
325 > minor modifications to handle smaller data types. The function will not
326 > be duplicated.
327
328 This is an *implicit* form of predication as the base RV ISA does not have
329 condition-codes or predication. By adding a CSR it becomes possible
330 to also tag certain registers as "predicated if referenced as a destination".
331 Example:
332
333 // in future operations if r0 is the destination use r5 as
334 // the PREDICATION register
335 IMPLICICSRPREDICATE r0, r5
336 // store the compares in r5 as the PREDICATION register
337 CMPEQ8 r5, r1, r2
338 // r0 is used here. ah ha! that means it's predicated using r5!
339 ADD8 r0, r1, r3
340
341 With enough registers (and there are enough registers) some fairly
342 complex predication can be set up and yet still execute without significant
343 stalling, even in a simple non-superscalar architecture.
344
345 ### Retro-fitting Predication into branch-explicit ISA
346
347 One of the goals of this parallelism proposal is to avoid instruction
348 duplication. However, with the base ISA having been designed explictly
349 to *avoid* condition-codes entirely, shoe-horning predication into it
350 bcomes quite challenging.
351
352 However what if all branch instructions, if referencing a vectorised
353 register, were instead given *completely new analogous meanings* that
354 resulted in a parallel bit-wise predication register being set? This
355 would have to be done for both C.BEQZ and C.BNEZ, as well as BEQ, BNE,
356 BLT and BGE.
357
358 We might imagine that FEQ, FLT and FLT would also need to be converted,
359 however these are effectively *already* in the precise form needed and
360 do not need to be converted *at all*! The difference is that FEQ, FLT
361 and FLE *specifically* write a 1 to an integer register if the condition
362 holds, and 0 if not. All that needs to be done here is to say, "if
363 the integer register is tagged with a bit that says it is a predication
364 register, the **bit** in the integer register is set based on the
365 current vector index" instead.
366
367 There is, in the standard Conditional Branch instruction, more than
368 adequate space to interpret it in a similar fashion:
369
370 [[!table data="""
371 31 |30 ..... 25 |24 ... 20 | 19 ... 15 | 14 ...... 12 | 11 ....... 8 | 7 | 6 ....... 0 |
372 imm[12] | imm[10:5] | rs2 | rs1 | funct3 | imm[4:1] | imm[11] | opcode |
373 1 | 6 | 5 | 5 | 3 | 4 | 1 | 7 |
374 offset[12,10:5] || src2 | src1 | BEQ | offset[11,4:1] || BRANCH |
375 """]]
376
377 This would become:
378
379 [[!table data="""
380 31 |30 ..... 25 |24 ... 20 | 19 ... 15 | 14 ...... 12 | 11 ....... 8 | 7 | 6 ....... 0 |
381 imm[12] | imm[10:5] | rs2 | rs1 | funct3 | imm[4:1] | imm[11] | opcode |
382 1 | 6 | 5 | 5 | 3 | 4 | 1 | 7 |
383 reserved || src2 | src1 | BEQ | predicate rs3 || BRANCH |
384 """]]
385
386 Similarly the C.BEQZ and C.BNEZ instruction format may be retro-fitted,
387 with the interesting side-effect that there is space within what is presently
388 the "immediate offset" field to reinterpret that to add in not only a bit
389 field to distinguish between floating-point compare and integer compare,
390 not only to add in a second source register, but also use some of the bits as
391 a predication target as well.
392
393 [[!table data="""
394 15 ...... 13 | 12 ........... 10 | 9..... 7 | 6 ................. 2 | 1 .. 0 |
395 funct3 | imm | rs10 | imm | op |
396 3 | 3 | 3 | 5 | 2 |
397 C.BEQZ | offset[8,4:3] | src | offset[7:6,2:1,5] | C1 |
398 """]]
399
400 Now uses the CS format:
401
402 [[!table data="""
403 15 ...... 13 | 12 ........... 10 | 9..... 7 | 6 .. 5 | 4......... 2 | 1 .. 0 |
404 funct3 | imm | rs10 | imm | | op |
405 3 | 3 | 3 | 2 | 3 | 2 |
406 C.BEQZ | predicate rs3 | src1 | I/F B | src2 | C1 |
407 """]]
408
409 Bit 6 would be decoded as "operation refers to Integer or Float" including
410 interpreting src1 and src2 accordingly as outlined in Table 12.2 of the
411 "C" Standard, version 2.0,
412 whilst Bit 5 would allow the operation to be extended, in combination with
413 funct3 = 110 or 111: a combination of four distinct comparison operators.
414
415 ## Conclusions
416
417 In the above sections the five different ways where parallel instruction
418 execution has closely and loosely inter-related implications for the ISA and
419 for implementors, were outlined. The pluses and minuses came out as
420 follows:
421
422 * Fixed vs variable parallelism: <b>variable</b>
423 * Implicit (indirect) vs fixed (integral) instruction bit-width: <b>indirect</b>
424 * Implicit vs explicit type-conversion: <b>explicit</b>
425 * Implicit vs explicit inner loops: <b>implicit but best done separately</b>
426 * Tag or no-tag: <b>Complex but highly beneficial</b>
427
428 In particular:
429
430 * variable-length vectors came out on top because of the high setup, teardown
431 and corner-cases associated with the fixed width of SIMD.
432 * Implicit bit-width helps to extend the ISA to escape from
433 former limitations and restrictions (in a backwards-compatible fashion),
434 whilst also leaving implementors free to simmplify implementations
435 by using actual explicit internal parallelism.
436 * Implicit (zero-overhead) loops provide a means to keep pipelines
437 potentially 100% occupied in a single-issue in-order implementation
438 i.e. *without* requiring a super-scalar or out-of-order architecture,
439 but doing a proper, full job (ZOLC) is an entirely different matter.
440
441 Constructing a SIMD/Simple-Vector proposal based around four of these five
442 requirements would therefore seem to be a logical thing to do.
443
444 # Instruction Format
445
446 **TODO** *basically borrow from both P and V, which should be quite simple
447 to do, with the exception of Tag/no-tag, which needs a bit more
448 thought. V's Section 17.19 of Draft V2.3 spec is reminiscent of B's BGS
449 gather-scatterer, and, if implemented, could actually be a really useful
450 way to span 8-bit up to 64-bit groups of data, where BGS as it stands
451 and described by Clifford does **bits** of up to 16 width. Lots to
452 look at and investigate!*
453
454 # Note on implementation of parallelism
455
456 One extremely important aspect of this proposal is to respect and support
457 implementors desire to focus on power, area or performance. In that regard,
458 it is proposed that implementors be free to choose whether to implement
459 the Vector (or variable-width SIMD) parallelism as sequential operations
460 with a single ALU, fully parallel (if practical) with multiple ALUs, or
461 a hybrid combination of both.
462
463 In Broadcom's Videocore-IV, they chose hybrid, and called it "Virtual
464 Parallelism". They achieve a 16-way SIMD at an **instruction** level
465 by providing a combination of a 4-way parallel ALU *and* an externally
466 transparent loop that feeds 4 sequential sets of data into each of the
467 4 ALUs.
468
469 Also in the same core, it is worth noting that particularly uncommon
470 but essential operations (Reciprocal-Square-Root for example) are
471 *not* part of the 4-way parallel ALU but instead have a *single* ALU.
472 Under the proposed Vector (varible-width SIMD) implementors would
473 be free to do precisely that: i.e. free to choose *on a per operation
474 basis* whether and how much "Virtual Parallelism" to deploy.
475
476 It is absolutely critical to note that it is proposed that such choices MUST
477 be **entirely transparent** to the end-user and the compiler. Whilst
478 a Vector (varible-width SIM) may not precisely match the width of the
479 parallelism within the implementation, the end-user **should not care**
480 and in this way the performance benefits are gained but the ISA remains
481 straightforward. All that happens at the end of an instruction run is: some
482 parallel units (if there are any) would remain offline, completely
483 transparently to the ISA, the program, and the compiler.
484
485 The "SIMD considered harmful" trap of having huge complexity and extra
486 instructions to deal with corner-cases is thus avoided, and implementors
487 get to choose precisely where to focus and target the benefits of their
488 implementation efforts, without "extra baggage".
489
490 # Example of vector / vector, vector / scalar, scalar / scalar => vector add
491
492 register CSRvectorlen[XLEN][4]; # not quite decided yet about this one...
493 register CSRpredicate[XLEN][4]; # 2^4 is max vector length
494 register CSRreg_is_vectorised[XLEN]; # just for fun support scalars as well
495 register x[32][XLEN];
496
497 function op_add(rd, rs1, rs2, predr)
498 {
499    /* note that this is ADD, not PADD */
500    int i, id, irs1, irs2;
501    # checks CSRvectorlen[rd] == CSRvectorlen[rs] etc. ignored
502    # also destination makes no sense as a scalar but what the hell...
503    for (i = 0, id=0, irs1=0, irs2=0; i<CSRvectorlen[rd]; i++)
504       if (CSRpredicate[predr][i]) # i *think* this is right...
505          x[rd+id] <= x[rs1+irs1] + x[rs2+irs2];
506       # now increment the idxs
507       if (CSRreg_is_vectorised[rd]) # bitfield check rd, scalar/vector?
508          id += 1;
509       if (CSRreg_is_vectorised[rs1]) # bitfield check rs1, scalar/vector?
510          irs1 += 1;
511       if (CSRreg_is_vectorised[rs2]) # bitfield check rs2, scalar/vector?
512          irs2 += 1;
513 }
514
515 # V-Extension to Simple-V Comparative Analysis
516
517 This section covers the ways in which Simple-V is comparable
518 to, or more flexible than, V-Extension (V2.3-draft). Also covered is
519 one major weak-point (register files are fixed size, where V is
520 arbitrary length), and how best to deal with that, should V be adapted
521 to be on top of Simple-V.
522
523 The first stages of this section go over each of the sections of V2.3-draft V
524 where appropriate
525
526 ## 17.3 Shape Encoding
527
528 Simple-V's proposed means of expressing whether a register (from the
529 standard integer or the standard floating-point file) is a scalar or
530 a vector is to simply set the vector length to 1. The instruction
531 would however have to specify which register file (integer or FP) that
532 the vector-length was to be applied to.
533
534 Extended shapes (2-D etc) would not be part of Simple-V at all.
535
536 ## 17.4 Representation Encoding
537
538 Simple-V would not have representation-encoding. This is part of
539 polymorphism, which is considered too complex to implement (TODO: confirm?)
540
541 ## 17.5 Element Bitwidth
542
543 This is directly equivalent to Simple-V's "Packed", and implies that
544 integer (or floating-point) are divided down into vector-indexable
545 chunks of size Bitwidth.
546
547 In this way it becomes possible to have ADD effectively and implicitly
548 turn into ADDb (8-bit add), ADDw (16-bit add) and so on, and where
549 vector-length has been set to greater than 1, it becomes a "Packed"
550 (SIMD) instruction.
551
552 It remains to be decided what should be done when RV32 / RV64 ADD (sized)
553 opcodes are used. One useful idea would be, on an RV64 system where
554 a 32-bit-sized ADD was performed, to simply use the least significant
555 32-bits of the register (exactly as is currently done) but at the same
556 time to *respect the packed bitwidth as well*.
557
558 The extended encoding (Table 17.6) would not be part of Simple-V.
559
560 ## 17.6 Base Vector Extension Supported Types
561
562 TODO: analyse. probably exactly the same.
563
564 ## 17.7 Maximum Vector Element Width
565
566 No equivalent in Simple-V
567
568 ## 17.8 Vector Configuration Registers
569
570 TODO: analyse.
571
572 ## 17.9 Legal Vector Unit Configurations
573
574 TODO: analyse
575
576 ## 17.10 Vector Unit CSRs
577
578 TODO: analyse
579
580 > Ok so this is an aspect of Simple-V that I hadn't thought through,
581 > yet (proposal / idea only a few days old!).  in V2.3-Draft ISA Section
582 > 17.10 the CSRs are listed.  I note that there's some general-purpose
583 > CSRs (including a global/active vector-length) and 16 vcfgN CSRs.  i
584 > don't precisely know what those are for.
585
586 >  In the Simple-V proposal, *every* register in both the integer
587 > register-file *and* the floating-point register-file would have at
588 > least a 2-bit "data-width" CSR and probably something like an 8-bit
589 > "vector-length" CSR (less in RV32E, by exactly one bit).
590
591 >  What I *don't* know is whether that would be considered perfectly
592 > reasonable or completely insane.  If it turns out that the proposed
593 > Simple-V CSRs can indeed be stored in SRAM then I would imagine that
594 > adding somewhere in the region of 10 bits per register would be... okay? 
595 > I really don't honestly know.
596
597 >  Would these proposed 10-or-so-bit per-register Simple-V CSRs need to
598 > be multi-ported? No I don't believe they would.
599
600 ## 17.11 Maximum Vector Length (MVL)
601
602 Basically implicitly this is set to the maximum size of the register
603 file multiplied by the number of 8-bit packed ints that can fit into
604 a register (4 for RV32, 8 for RV64 and 16 for RV128).
605
606 ## !7.12 Vector Instruction Formats
607
608 No equivalent in Simple-V because *all* instructions of *all* Extensions
609 are implicitly parallelised (and packed).
610
611 ## 17.13 Polymorphic Vector Instructions
612
613 Polymorphism (implicit type-casting) is deliberately not supported
614 in Simple-V.
615
616 ## 17.14 Rapid Configuration Instructions
617
618 TODO: analyse if this is useful to have an equivalent in Simple-V
619
620 ## 17.15 Vector-Type-Change Instructions
621
622 TODO: analyse if this is useful to have an equivalent in Simple-V
623
624 ## 17.16 Vector Length
625
626 Has a direct corresponding equivalent.
627
628 ## 17.17 Predicated Execution
629
630 Predicated Execution is another name for "masking" or "tagging". Masked
631 (or tagged) implies that there is a bit field which is indexed, and each
632 bit associated with the corresponding indexed offset register within
633 the "Vector". If the tag / mask bit is 1, when a parallel operation is
634 issued, the indexed element of the vector has the operation carried out.
635 However if the tag / mask bit is *zero*, that particular indexed element
636 of the vector does *not* have the requested operation carried out.
637
638 In V2.3-draft V, there is a significant (not recommended) difference:
639 the zero-tagged elements are *set to zero*. This loses a *significant*
640 advantage of mask / tagging, particularly if the entire mask register
641 is itself a general-purpose register, as that general-purpose register
642 can be inverted, shifted, and'ed, or'ed and so on. In other words
643 it becomes possible, especially if Carry/Overflow from each vector
644 operation is also accessible, to do conditional (step-by-step) vector
645 operations including things like turn vectors into 1024-bit or greater
646 operands with very few instructions, by treating the "carry" from
647 one instruction as a way to do "Conditional add of 1 to the register
648 next door". If V2.3-draft V sets zero-tagged elements to zero, such
649 extremely powerful techniques are simply not possible.
650
651 It is noted that there is no mention of an equivalent to BEXT (element
652 skipping) which would be particularly fascinating and powerful to have.
653 In this mode, the "mask" would skip elements where its mask bit was zero
654 in either the source or the destination operand.
655
656 Lots to be discussed.
657
658 ## 17.18 Vector Load/Store Instructions
659
660 The Vector Load/Store instructions as proposed in V are extremely powerful
661 and can be used for reordering and regular restructuring.
662
663 Vector Load:
664
665 if (unit-strided) stride = elsize;
666 else stride = areg[as2]; // constant-strided
667 for (int i=0; i<vl; ++i)
668 if ([!]preg[p][i])
669 for (int j=0; j<seglen+1; j++)
670 vreg[vd+j][i] = mem[areg[as1] + (i*(seglen+1)+j)*stride];
671
672 Store:
673
674 if (unit-strided) stride = elsize;
675 else stride = areg[as2]; // constant-strided
676 for (int i=0; i<vl; ++i)
677 if ([!]preg[p][i])
678 for (int j=0; j<seglen+1; j++)
679 mem[areg[base] + (i*(seglen+1)+j)*stride] = vreg[vd+j][i];
680
681 Indexed Load:
682
683 for (int i=0; i<vl; ++i)
684 if ([!]preg[p][i])
685 for (int j=0; j<seglen+1; j++)
686 vreg[vd+j][i] = mem[sreg[base] + vreg[vs2][i] + j*elsize];
687
688 Indexed Store:
689
690 for (int i=0; i<vl; ++i)
691 if ([!]preg[p][i])
692 for (int j=0; j<seglen+1; j++)
693 mem[sreg[base] + vreg[vs2][i] + j*elsize] = vreg[vd+j][i];
694
695 Keeping these instructions as-is for Simple-V is highly recommended.
696 However: one of the goals of this Extension is to retro-fit (re-use)
697 existing RV Load/Store:
698
699 [[!table data="""
700 31 20 | 19 15 | 14 12 | 11 7 | 6 0 |
701 imm[11:0] | rs1 | funct3 | rd | opcode |
702 12 | 5 | 3 | 5 | 7 |
703 offset[11:0] | base | width | dest | LOAD |
704 """]]
705
706 [[!table data="""
707 31 25 | 24 20 | 19 15 | 14 12 | 11 7 | 6 0 |
708 imm[11:5] | rs2 | rs1 | funct3 | imm[4:0] | opcode |
709 7 | 5 | 5 | 3 | 5 | 7 |
710 offset[11:5] | src | base | width | offset[4:0] | STORE |
711 """]]
712
713 The RV32 instruction opcodes as follows:
714
715 [[!table data="""
716 31 28 27 | 26 25 | 24 20 |19 15 |14| 13 12 | 11 7 | 6 0 | op |
717 imm[4:0] | 00 | 00000 | rs1 | 1| m | vd | 0000111 | VLD |
718 imm[4:0] | 01 | rs2 | rs1 | 1| m | vd | 0000111 | VLDS|
719 imm[4:0] | 11 | vs2 | rs1 | 1| m | vd | 0000111 | VLDX|
720 vs3 | 00 | 00000 | rs1 |1 | m |imm[4:0]| 0100111 |VST |
721 vs3 | 01 | rs2 | rs1 |1 | m |imm[4:0]| 0100111 |VSTS |
722 vs3 | 11 | vs2 | rs1 |1 | m |imm[4:0]| 0100111 |VSTX |
723 """]]
724
725 Conversion on LOAD as follows:
726
727 * rd or rs1 are CSR-vectorised indicating "Vector Mode"
728 * rd equivalent to vd
729 * rs1 equivalent to rs1
730 * imm[4:0] from RV format (11..7]) is same
731 * imm[9:5] from RV format (29..25] is rs2 (rs2=00000 for VLD)
732 * imm[11:10] from RV format (31..30] is opcode (VLD, VLDS, VLDX)
733 * width from RV format (14..12) is same (width and zero/sign extend)
734
735 [[!table data="""
736 31 30 | 29 25 | 24 20 | 19 15 | 14 12 | 11 7 | 6 0 |
737 imm[11:0] ||| rs1 | funct3 | rd | opcode |
738 2 | 5 | 5 | 5 | 3 | 5 | 7 |
739 00 | 00000 | imm[4:0] | base | width | dest | LOAD |
740 01 | rs2 | imm[4:0] | base | width | dest | LOAD.S |
741 11 | rs2 | imm[4:0] | base | width | dest | LOAD.X |
742 """]]
743
744 Similar conversion on STORE as follows:
745
746 [[!table data="""
747 31 30 | 29 25 | 24 20 | 19 15 | 14 12 | 11 7 | 6 0 |
748 imm[11:0] ||| rs1 | funct3 | rd | opcode |
749 2 | 5 | 5 | 5 | 3 | 5 | 7 |
750 00 | 00000 | src | base | width | offs[4:0] | LOAD |
751 01 | rs3 | src | base | width | offs[4:0] | LOAD.S |
752 11 | rs3 | src | base | width | offs[4:0] | LOAD.X |
753 """]]
754
755 Notes:
756
757 * Predication CSR-marking register is not explicitly shown in instruction
758 * In both LOAD and STORE, it is possible now to rs2 (or rs3) as a vector.
759 * That in turn means that Indexed Load need not have an explicit opcode
760 * That in turn means that bit 30 may indicate "stride" and bit 31 is free
761
762 Revised LOAD:
763
764 [[!table data="""
765 31 | 30 | 29 25 | 24 20 | 19 15 | 14 12 | 11 7 | 6 0 |
766 imm[11:0] |||| rs1 | funct3 | rd | opcode |
767 1 | 1 | 5 | 5 | 5 | 3 | 5 | 7 |
768 ? | s | rs2 | imm[4:0] | base | width | dest | LOAD |
769 """]]
770
771 Where in turn the pseudo-code may now combine the two:
772
773 if (unit-strided) stride = elsize;
774 else stride = areg[as2]; // constant-strided
775 for (int i=0; i<vl; ++i)
776 if ([!]preg[p][i])
777 for (int j=0; j<seglen+1; j++)
778 {
779 if CSRvectorised[rs2])
780 offs = vreg[rs2][i]
781 else
782 offs = i*(seglen+1)*stride;
783 vreg[vd+j][i] = mem[sreg[base] + offs + j*stride];
784 }
785
786 Notes:
787
788 * j is multiplied by stride, not elsize, including in the rs2 vectorised case.
789 * There may be more sophisticated variants involving the 31st bit, however
790 it would be nice to reserve that bit for post-increment of address registers
791
792 ## 17.19 Vector Register Gather
793
794 TODO
795
796 ## TODO, sort
797
798 > However, there are also several features that go beyond simply attaching VL
799 > to a scalar operation and are crucial to being able to vectorize a lot of
800 > code. To name a few:
801 > - Conditional execution (i.e., predicated operations)
802 > - Inter-lane data movement (e.g. SLIDE, SELECT)
803 > - Reductions (e.g., VADD with a scalar destination)
804
805 Ok so the Conditional and also the Reductions is one of the reasons
806 why as part of SimpleV / variable-SIMD / parallelism (gah gotta think
807 of a decent name) i proposed that it be implemented as "if you say r0
808 is to be a vector / SIMD that means operations actually take place on
809 r0,r1,r2... r(N-1)".
810
811 Consequently any parallel operation could be paused (or... more
812 specifically: vectors disabled by resetting it back to a default /
813 scalar / vector-length=1) yet the results would actually be in the
814 *main register file* (integer or float) and so anything that wasn't
815 possible to easily do in "simple" parallel terms could be done *out*
816 of parallel "mode" instead.
817
818 I do appreciate that the above does imply that there is a limit to the
819 length that SimpleV (whatever) can be parallelised, namely that you
820 run out of registers! my thought there was, "leave space for the main
821 V-Ext proposal to extend it to the length that V currently supports".
822 Honestly i had not thought through precisely how that would work.
823
824 Inter-lane (SELECT) i saw 17.19 in V2.3-Draft p117, I liked that,
825 it reminds me of the discussion with Clifford on bit-manipulation
826 (gather-scatter except not Bit Gather Scatter, *data* gather scatter): if
827 applied "globally and outside of V and P" SLIDE and SELECT might become
828 an extremely powerful way to do fast memory copy and reordering [2[.
829
830 However I haven't quite got my head round how that would work: i am
831 used to the concept of register "tags" (the modern term is "masks")
832 and i *think* if "masks" were applied to a Simple-V-enhanced LOAD /
833 STORE you would get the exact same thing as SELECT.
834
835 SLIDE you could do simply by setting say r0 vector-length to say 16
836 (meaning that if referred to in any operation it would be an implicit
837 parallel operation on *all* registers r0 through r15), and temporarily
838 set say.... r7 vector-length to say... 5. Do a LOAD on r7 and it would
839 implicitly mean "load from memory into r7 through r11". Then you go
840 back and do an operation on r0 and ta-daa, you're actually doing an
841 operation on a SLID {SLIDED?) vector.
842
843 The advantage of Simple-V (whatever) over V would be that you could
844 actually do *operations* in the middle of vectors (not just SLIDEs)
845 simply by (as above) setting r0 vector-length to 16 and r7 vector-length
846 to 5. There would be nothing preventing you from doing an ADD on r0
847 (which meant do an ADD on r0 through r15) followed *immediately in the
848 next instruction with no setup cost* a MUL on r7 (which actually meant
849 "do a parallel MUL on r7 through r11").
850
851 btw it's worth mentioning that you'd get scalar-vector and vector-scalar
852 implicitly by having one of the source register be vector-length 1
853 (the default) and one being N > 1. but without having special opcodes
854 to do it. i *believe* (or more like "logically infer or deduce" as
855 i haven't got access to the spec) that that would result in a further
856 opcode reduction when comparing [draft] V-Ext to [proposed] Simple-V.
857
858 Also, Reduction *might* be possible by specifying that the destination be
859 a scalar (vector-length=1) whilst the source be a vector. However... it
860 would be an awful lot of work to go through *every single instruction*
861 in *every* Extension, working out which ones could be parallelised (ADD,
862 MUL, XOR) and those that definitely could not (DIV, SUB). Is that worth
863 the effort? maybe. Would it result in huge complexity? probably.
864 Could an implementor just go "I ain't doing *that* as parallel!
865 let's make it virtual-parallelism (sequential reduction) instead"?
866 absolutely. So, now that I think it through, Simple-V (whatever)
867 covers Reduction as well. huh, that's a surprise.
868
869
870 > - Vector-length speculation (making it possible to vectorize some loops with
871 > unknown trip count) - I don't think this part of the proposal is written
872 > down yet.
873
874 Now that _is_ an interesting concept. A little scary, i imagine, with
875 the possibility of putting a processor into a hard infinite execution
876 loop... :)
877
878
879 > Also, note the vector ISA consumes relatively little opcode space (all the
880 > arithmetic fits in 7/8ths of a major opcode). This is mainly because data
881 > type and size is a function of runtime configuration, rather than of opcode.
882
883 yes. i love that aspect of V, i am a huge fan of polymorphism [1]
884 which is why i am keen to advocate that the same runtime principle be
885 extended to the rest of the RISC-V ISA [3]
886
887 Yikes that's a lot. I'm going to need to pull this into the wiki to
888 make sure it's not lost.
889
890 [1] inherent data type conversion: 25 years ago i designed a hypothetical
891 hyper-hyper-hyper-escape-code-sequencing ISA based around 2-bit
892 (escape-extended) opcodes and 2-bit (escape-extended) operands that
893 only required a fixed 8-bit instruction length. that relied heavily
894 on polymorphism and runtime size configurations as well. At the time
895 I thought it would have meant one HELL of a lot of CSRs... but then I
896 met RISC-V and was cured instantly of that delusion^Wmisapprehension :)
897
898 [2] Interestingly if you then also add in the other aspect of Simple-V
899 (the data-size, which is effectively functionally orthogonal / identical
900 to "Packed" of Packed-SIMD), masked and packed *and* vectored LOAD / STORE
901 operations become byte / half-word / word augmenters of B-Ext's proposed
902 "BGS" i.e. where B-Ext's BGS dealt with bits, masked-packed-vectored
903 LOAD / STORE would deal with 8 / 16 / 32 bits at a time. Where it
904 would get really REALLY interesting would be masked-packed-vectored
905 B-Ext BGS instructions. I can't even get my head fully round that,
906 which is a good sign that the combination would be *really* powerful :)
907
908 [3] ok sadly maybe not the polymorphism, it's too complicated and I
909 think would be much too hard for implementors to easily "slide in" to an
910 existing non-Simple-V implementation.  i say that despite really *really*
911 wanting IEEE 704 FP Half-precision to end up somewhere in RISC-V in some
912 fashion, for optimising 3D Graphics.  *sigh*.
913
914 ## TODO: analyse, auto-increment on unit-stride and constant-stride
915
916 so i thought about that for a day or so, and wondered if it would be
917 possible to propose a variant of zero-overhead loop that included
918 auto-incrementing the two address registers a2 and a3, as well as
919 providing a means to interact between the zero-overhead loop and the
920 vsetvl instruction. a sort-of pseudo-assembly of that would look like:
921
922 # a2 to be auto-incremented by t0 times 4
923 zero-overhead-set-auto-increment a2, t0, 4
924 # a2 to be auto-incremented by t0 times 4
925 zero-overhead-set-auto-increment a3, t0, 4
926 zero-overhead-set-loop-terminator-condition a0 zero
927 zero-overhead-set-start-end stripmine, stripmine+endoffset
928 stripmine:
929 vsetvl t0,a0
930 vlw v0, a2
931 vlw v1, a3
932 vfma v1, a1, v0, v1
933 vsw v1, a3
934 sub a0, a0, t0
935 stripmine+endoffset:
936
937 the question is: would something like this even be desirable? it's a
938 variant of auto-increment [1]. last time i saw any hint of auto-increment
939 register opcodes was in the 1980s... 68000 if i recall correctly... yep
940 see [1]
941
942 [1] http://fourier.eng.hmc.edu/e85_old/lectures/instruction/node6.html
943
944 Reply:
945
946 Another option for auto-increment is for vector-memory-access instructions
947 to support post-increment addressing for unit-stride and constant-stride
948 modes. This can be implemented by the scalar unit passing the operation
949 to the vector unit while itself executing an appropriate multiply-and-add
950 to produce the incremented address. This does *not* require additional
951 ports on the scalar register file, unlike scalar post-increment addressing
952 modes.
953
954 ## TODO: instructions (based on Hwacha) V-Ext duplication analysis
955
956 This is partly speculative due to lack of access to an up-to-date
957 V-Ext Spec (V2.3-draft RVV 0.4-Draft at the time of writing). However
958 basin an analysis instead on Hwacha, a cursory examination shows over
959 an **85%** duplication of V-Ext operand-related instructions when
960 compared to Simple-V on a standard RG64G base. Even Vector Fetch
961 is analogous to "zero-overhead loop".
962
963 Exceptions are:
964
965 * Vector Indexed Memory Instructions (non-contiguous)
966 * Vector Atomic Memory Instructions.
967 * Some of the Vector Misc ops: VEIDX, VFIRST, VCLASS, VPOPC
968 and potentially more.
969 * Consensual Jump
970
971 Table of RV32V Instructions
972
973 | RV32V | RV Equivalent (FP) | RV Equivalent (Int) | Notes |
974 | ----- | --- | | |
975 | VADD | FADD | ADD | |
976 | VSUB | FSUB | SUB | |
977 | VSL | | SLL | |
978 | VSR | | SRL | |
979 | VAND | | AND | |
980 | VOR | | OR | |
981 | VXOR | | XOR | |
982 | VSEQ | FEQ | BEQ | {1} |
983 | VSNE | !FEQ | BNE | {1} |
984 | VSLT | FLT | BLT | {1} |
985 | VSGE | !FLE | BGE | {1} |
986 | VCLIP | | | |
987 | VCVT | FCVT | | |
988 | VMPOP | | | |
989 | VMFIRST | | | |
990 | VEXTRACT | | | |
991 | VINSERT | | | |
992 | VMERGE | | | |
993 | VSELECT | | | |
994 | VSLIDE | | | |
995 | VDIV | FDIV | DIV | |
996 | VREM | | REM | |
997 | VMUL | FMUL | MUL | |
998 | VMULH | | | |
999 | VMIN | FMIN | | |
1000 | VMAX | FMUX | | |
1001 | VSGNJ | FSGNJ | | |
1002 | VSGNJN | FSGNJN | | |
1003 | VSGNJX | FSNGJX | | |
1004 | VSQRT | FSQRT | | |
1005 | VCLASS | | | |
1006 | VPOPC | | | |
1007 | VADDI | | ADDI | |
1008 | VSLI | | SLI | |
1009 | VSRI | | SRI | |
1010 | VANDI | | ANDI | |
1011 | VORI | | ORI | |
1012 | VXORI | | XORI | |
1013 | VCLIPI | | | |
1014 | VMADD | FMADD | | |
1015 | VMSUB | FMSUB | | |
1016 | VNMADD | FNMSUB | | |
1017 | VNMSUB | FNMADD | | |
1018 | VLD | FLD | LD | |
1019 | VLDS | | LW | |
1020 | VLDX | | LWU | |
1021 | VST | FST | ST | |
1022 | VSTS | | | |
1023 | VSTX | | | |
1024 | VAMOSWAP | | AMOSWAP | |
1025 | VAMOADD | | AMOADD | |
1026 | VAMOAND | | AMOAND | |
1027 | VAMOOR | | AMOOR | |
1028 | VAMOXOR | | AMOXOR | |
1029 | VAMOMIN | | AMOMIN | |
1030 | VAMOMAX | | AMOMAX | |
1031
1032 Notes:
1033
1034 * {1} retro-fit predication variants into branch instructions (base and C),
1035 decoding triggered by CSR bit marking register as "Vector type".
1036
1037 ## TODO: sort
1038
1039 > I suspect that the "hardware loop" in question is actually a zero-overhead
1040 > loop unit that diverts execution from address X to address Y if a certain
1041 > condition is met.
1042
1043  not quite.  The zero-overhead loop unit interestingly would be at
1044 an [independent] level above vector-length.  The distinctions are
1045 as follows:
1046
1047 * Vector-length issues *virtual* instructions where the register
1048 operands are *specifically* altered (to cover a range of registers),
1049 whereas zero-overhead loops *specifically* do *NOT* alter the operands
1050 in *ANY* way.
1051
1052 * Vector-length-driven "virtual" instructions are driven by *one*
1053 and *only* one instruction (whether it be a LOAD, STORE, or pure
1054 one/two/three-operand opcode) whereas zero-overhead loop units
1055 specifically apply to *multiple* instructions.
1056
1057 Where vector-length-driven "virtual" instructions might get conceptually
1058 blurred with zero-overhead loops is LOAD / STORE.  In the case of LOAD /
1059 STORE, to actually be useful, vector-length-driven LOAD / STORE should
1060 increment the LOAD / STORE memory address to correspondingly match the
1061 increment in the register bank.  example:
1062
1063 * set vector-length for r0 to 4
1064 * issue RV32 LOAD from addr 0x1230 to r0
1065
1066 translates effectively to:
1067
1068 * RV32 LOAD from addr 0x1230 to r0
1069 * ...
1070 * ...
1071 * RV32 LOAD from addr 0x123B to r3
1072
1073 # P-Ext ISA
1074
1075 ## 16-bit Arithmetic
1076
1077 | Mnemonic | 16-bit Instruction | Simple-V Equivalent |
1078 | ------------------ | ------------------------- | ------------------- |
1079 | ADD16 rt, ra, rb | add | RV ADD (bitwidth=16) |
1080 | RADD16 rt, ra, rb | Signed Halving add | |
1081 | URADD16 rt, ra, rb | Unsigned Halving add | |
1082 | KADD16 rt, ra, rb | Signed Saturating add | |
1083 | UKADD16 rt, ra, rb | Unsigned Saturating add | |
1084 | SUB16 rt, ra, rb | sub | RV SUB (bitwidth=16) |
1085 | RSUB16 rt, ra, rb | Signed Halving sub | |
1086 | URSUB16 rt, ra, rb | Unsigned Halving sub | |
1087 | KSUB16 rt, ra, rb | Signed Saturating sub | |
1088 | UKSUB16 rt, ra, rb | Unsigned Saturating sub | |
1089 | CRAS16 rt, ra, rb | Cross Add & Sub | |
1090 | RCRAS16 rt, ra, rb | Signed Halving Cross Add & Sub | |
1091 | URCRAS16 rt, ra, rb| Unsigned Halving Cross Add & Sub | |
1092 | KCRAS16 rt, ra, rb | Signed Saturating Cross Add & Sub | |
1093 | UKCRAS16 rt, ra, rb| Unsigned Saturating Cross Add & Sub | |
1094 | CRSA16 rt, ra, rb | Cross Sub & Add | |
1095 | RCRSA16 rt, ra, rb | Signed Halving Cross Sub & Add | |
1096 | URCRSA16 rt, ra, rb| Unsigned Halving Cross Sub & Add | |
1097 | KCRSA16 rt, ra, rb | Signed Saturating Cross Sub & Add | |
1098 | UKCRSA16 rt, ra, rb| Unsigned Saturating Cross Sub & Add | |
1099
1100 ## 8-bit Arithmetic
1101
1102 | Mnemonic | 16-bit Instruction | Simple-V Equivalent |
1103 | ------------------ | ------------------------- | ------------------- |
1104 | ADD8 rt, ra, rb | add | RV ADD (bitwidth=8)|
1105 | RADD8 rt, ra, rb | Signed Halving add | |
1106 | URADD8 rt, ra, rb | Unsigned Halving add | |
1107 | KADD8 rt, ra, rb | Signed Saturating add | |
1108 | UKADD8 rt, ra, rb | Unsigned Saturating add | |
1109 | SUB8 rt, ra, rb | sub | RV SUB (bitwidth=8)|
1110 | RSUB8 rt, ra, rb | Signed Halving sub | |
1111 | URSUB8 rt, ra, rb | Unsigned Halving sub | |
1112
1113 # Exceptions
1114
1115 > What does an ADD of two different-sized vectors do in simple-V?
1116
1117 * if the two source operands are not the same, throw an exception.
1118 * if the destination operand is also a vector, and the source is longer
1119 than the destination, throw an exception.
1120
1121 > And what about instructions like JALR? 
1122 > What does jumping to a vector do?
1123
1124 * Throw an exception. Whether that actually results in spawning threads
1125 as part of the trap-handling remains to be seen.
1126
1127 # Comparison of "Traditional" SIMD, Alt-RVP, Simple-V and RVV Proposals <a name="parallelism_comparisons"></a>
1128
1129 This section compares the various parallelism proposals as they stand,
1130 including traditional SIMD, in terms of features, ease of implementation,
1131 complexity, flexibility, and die area.
1132
1133 ## [[alt_rvp]]
1134
1135 Primary benefit of Alt-RVP is the simplicity with which parallelism
1136 may be introduced (effective multiplication of regfiles and associated ALUs).
1137
1138 * plus: the simplicity of the lanes (combined with the regularity of
1139 allocating identical opcodes multiple independent registers) meaning
1140 that SRAM or 2R1W can be used for entire regfile (potentially).
1141 * minus: a more complex instruction set where the parallelism is much
1142 more explicitly directly specified in the instruction and
1143 * minus: if you *don't* have an explicit instruction (opcode) and you
1144 need one, the only place it can be added is... in the vector unit and
1145 * minus: opcode functions (and associated ALUs) duplicated in Alt-RVP are
1146 not useable or accessible in other Extensions.
1147 * plus-and-minus: Lanes may be utilised for high-speed context-switching
1148 but with the down-side that they're an all-or-nothing part of the Extension.
1149 No Alt-RVP: no fast register-bank switching.
1150 * plus: Lane-switching would mean that complex operations not suited to
1151 parallelisation can be carried out, followed by further parallel Lane-based
1152 work, without moving register contents down to memory (and back)
1153 * minus: Access to registers across multiple lanes is challenging. "Solution"
1154 is to drop data into memory and immediately back in again (like MMX).
1155
1156 ## Simple-V
1157
1158 Primary benefit of Simple-V is the OO abstraction of parallel principles
1159 from actual (internal) parallel hardware. It's an API in effect that's
1160 designed to be slotted in to an existing implementation (just after
1161 instruction decode) with minimum disruption and effort.
1162
1163 * minus: the complexity of having to use register renames, OoO, VLIW,
1164 register file cacheing, all of which has been done before but is a
1165 pain
1166 * plus: transparent re-use of existing opcodes as-is just indirectly
1167 saying "this register's now a vector" which
1168 * plus: means that future instructions also get to be inherently
1169 parallelised because there's no "separate vector opcodes"
1170 * plus: Compressed instructions may also be (indirectly) parallelised
1171 * minus: the indirect nature of Simple-V means that setup (setting
1172 a CSR register to indicate vector length, a separate one to indicate
1173 that it is a predicate register and so on) means a little more setup
1174 time than Alt-RVP or RVV's "direct and within the (longer) instruction"
1175 approach.
1176 * plus: shared register file meaning that, like Alt-RVP, complex
1177 operations not suited to parallelisation may be carried out interleaved
1178 between parallelised instructions *without* requiring data to be dropped
1179 down to memory and back (into a separate vectorised register engine).
1180 * plus-and-maybe-minus: re-use of integer and floating-point 32-wide register
1181 files means that huge parallel workloads would use up considerable
1182 chunks of the register file. However in the case of RV64 and 32-bit
1183 operations, that effectively means 64 slots are available for parallel
1184 operations.
1185 * plus: inherent parallelism (actual parallel ALUs) doesn't actually need to
1186 be added, yet the instruction opcodes remain unchanged (and still appear
1187 to be parallel). consistent "API" regardless of actual internal parallelism:
1188 even an in-order single-issue implementation with a single ALU would still
1189 appear to have parallel vectoristion.
1190 * hard-to-judge: if actual inherent underlying ALU parallelism is added it's
1191 hard to say if there would be pluses or minuses (on die area). At worse it
1192 would be "no worse" than existing register renaming, OoO, VLIW and register
1193 file cacheing schemes.
1194
1195 ## RVV (as it stands, Draft 0.4 Section 17, RISC-V ISA V2.3-Draft)
1196
1197 RVV is extremely well-designed and has some amazing features, including
1198 2D reorganisation of memory through LOAD/STORE "strides".
1199
1200 * plus: regular predictable workload means that implementations may
1201 streamline effects on L1/L2 Cache.
1202 * plus: regular and clear parallel workload also means that lanes
1203 (similar to Alt-RVP) may be used as an implementation detail,
1204 using either SRAM or 2R1W registers.
1205 * plus: separate engine with no impact on the rest of an implementation
1206 * minus: separate *complex* engine with no RTL (ALUs, Pipeline stages) reuse
1207 really feasible.
1208 * minus: no ISA abstraction or re-use either: additions to other Extensions
1209 do not gain parallelism, resulting in prolific duplication of functionality
1210 inside RVV *and out*.
1211 * minus: when operations require a different approach (scalar operations
1212 using the standard integer or FP regfile) an entire vector must be
1213 transferred out to memory, into standard regfiles, then back to memory,
1214 then back to the vector unit, this to occur potentially multiple times.
1215 * minus: will never fit into Compressed instruction space (as-is. May
1216 be able to do so if "indirect" features of Simple-V are partially adopted).
1217 * plus-and-slight-minus: extended variants may address up to 256
1218 vectorised registers (requires 48/64-bit opcodes to do it).
1219 * minus-and-partial-plus: separate engine plus complexity increases
1220 implementation time and die area, meaning that adoption is likely only
1221 to be in high-performance specialist supercomputing (where it will
1222 be absolutely superb).
1223
1224 ## Traditional SIMD
1225
1226 The only really good things about SIMD are how easy it is to implement and
1227 get good performance. Unfortunately that makes it quite seductive...
1228
1229 * plus: really straightforward, ALU basically does several packed operations
1230 at once. Parallelism is inherent at the ALU, making the addition of
1231 SIMD-style parallelism an easy decision that has zero significant impact
1232 on the rest of any given architectural design and layout.
1233 * plus (continuation): SIMD in simple in-order single-issue designs can
1234 therefore result in superb throughput, easily achieved even with a very
1235 simple execution model.
1236 * minus: ridiculously complex setup and corner-cases that disproportionately
1237 increase instruction count on what would otherwise be a "simple loop",
1238 should the number of elements in an array not happen to exactly match
1239 the SIMD group width.
1240 * minus: getting data usefully out of registers (if separate regfiles
1241 are used) means outputting to memory and back.
1242 * minus: quite a lot of supplementary instructions for bit-level manipulation
1243 are needed in order to efficiently extract (or prepare) SIMD operands.
1244 * minus: MASSIVE proliferation of ISA both in terms of opcodes in one
1245 dimension and parallelism (width): an at least O(N^2) and quite probably
1246 O(N^3) ISA proliferation that often results in several thousand
1247 separate instructions. all requiring separate and distinct corner-case
1248 algorithms!
1249 * minus: EVEN BIGGER proliferation of SIMD ISA if the functionality of
1250 8, 16, 32 or 64-bit reordering is built-in to the SIMD instruction.
1251 For example: add (high|low) 16-bits of r1 to (low|high) of r2 requires
1252 four separate and distinct instructions: one for (r1:low r2:high),
1253 one for (r1:high r2:low), one for (r1:high r2:high) and one for
1254 (r1:low r2:low) *per function*.
1255 * minus: EVEN BIGGER proliferation of SIMD ISA if there is a mismatch
1256 between operand and result bit-widths. In combination with high/low
1257 proliferation the situation is made even worse.
1258 * minor-saving-grace: some implementations *may* have predication masks
1259 that allow control over individual elements within the SIMD block.
1260
1261 # Comparison *to* Traditional SIMD: Alt-RVP, Simple-V and RVV Proposals <a name="simd_comparison"></a>
1262
1263 This section compares the various parallelism proposals as they stand,
1264 *against* traditional SIMD as opposed to *alongside* SIMD. In other words,
1265 the question is asked "How can each of the proposals effectively implement
1266 (or replace) SIMD, and how effective would they be"?
1267
1268 ## [[alt_rvp]]
1269
1270 * Alt-RVP would not actually replace SIMD but would augment it: just as with
1271 a SIMD architecture where the ALU becomes responsible for the parallelism,
1272 Alt-RVP ALUs would likewise be so responsible... with *additional*
1273 (lane-based) parallelism on top.
1274 * Thus at least some of the downsides of SIMD ISA O(N^3) proliferation by
1275 at least one dimension are avoided (architectural upgrades introducing
1276 128-bit then 256-bit then 512-bit variants of the exact same 64-bit
1277 SIMD block)
1278 * Thus, unfortunately, Alt-RVP would suffer the same inherent proliferation
1279 of instructions as SIMD, albeit not quite as badly (due to Lanes).
1280 * In the same discussion for Alt-RVP, an additional proposal was made to
1281 be able to subdivide the bits of each register lane (columns) down into
1282 arbitrary bit-lengths (RGB 565 for example).
1283 * A recommendation was given instead to make the subdivisions down to 32-bit,
1284 16-bit or even 8-bit, effectively dividing the registerfile into
1285 Lane0(H), Lane0(L), Lane1(H) ... LaneN(L) or further. If inter-lane
1286 "swapping" instructions were then introduced, some of the disadvantages
1287 of SIMD could be mitigated.
1288
1289 ## RVV
1290
1291 * RVV is designed to replace SIMD with a better paradigm: arbitrary-length
1292 parallelism.
1293 * However whilst SIMD is usually designed for single-issue in-order simple
1294 DSPs with a focus on Multimedia (Audio, Video and Image processing),
1295 RVV's primary focus appears to be on Supercomputing: optimisation of
1296 mathematical operations that fit into the OpenCL space.
1297 * Adding functions (operations) that would normally fit (in parallel)
1298 into a SIMD instruction requires an equivalent to be added to the
1299 RVV Extension, if one does not exist. Given the specialist nature of
1300 some SIMD instructions (8-bit or 16-bit saturated or halving add),
1301 this possibility seems extremely unlikely to occur, even if the
1302 implementation overhead of RVV were acceptable (compared to
1303 normal SIMD/DSP-style single-issue in-order simplicity).
1304
1305 ## Simple-V
1306
1307 * Simple-V borrows hugely from RVV as it is intended to be easy to
1308 topologically transplant every single instruction from RVV (as
1309 designed) into Simple-V equivalents, with *zero loss of functionality
1310 or capability*.
1311 * With the "parallelism" abstracted out, a hypothetical SIMD-less "DSP"
1312 Extension which contained the basic primitives (non-parallelised
1313 8, 16 or 32-bit SIMD operations) inherently *become* parallel,
1314 automatically.
1315 * Additionally, standard operations (ADD, MUL) that would normally have
1316 to have special SIMD-parallel opcodes added need no longer have *any*
1317 of the length-dependent variants (2of 32-bit ADDs in a 64-bit register,
1318 4of 32-bit ADDs in a 128-bit register) because Simple-V takes the
1319 *standard* RV opcodes (present and future) and automatically parallelises
1320 them.
1321 * By inheriting the RVV feature of arbitrary vector-length, then just as
1322 with RVV the corner-cases and ISA proliferation of SIMD is avoided.
1323 * Whilst not entirely finalised, registers are expected to be
1324 capable of being subdivided down to an implementor-chosen bitwidth
1325 in the underlying hardware (r1 becomes r1[31..24] r1[23..16] r1[15..8]
1326 and r1[7..0], or just r1[31..16] r1[15..0]) where implementors can
1327 choose to have separate independent 8-bit ALUs or dual-SIMD 16-bit
1328 ALUs that perform twin 8-bit operations as they see fit, or anything
1329 else including no subdivisions at all.
1330 * Even though implementors have that choice even to have full 64-bit
1331 (with RV64) SIMD, they *must* provide predication that transparently
1332 switches off appropriate units on the last loop, thus neatly fitting
1333 underlying SIMD ALU implementations *into* the arbitrary vector-length
1334 RVV paradigm, keeping the uniform consistent API that is a key strategic
1335 feature of Simple-V.
1336 * With Simple-V fitting into the standard register files, certain classes
1337 of SIMD operations such as High/Low arithmetic (r1[31..16] + r2[15..0])
1338 can be done by applying *Parallelised* Bit-manipulation operations
1339 followed by parallelised *straight* versions of element-to-element
1340 arithmetic operations, even if the bit-manipulation operations require
1341 changing the bitwidth of the "vectors" to do so. Predication can
1342 be utilised to skip high words (or low words) in source or destination.
1343 * In essence, the key downside of SIMD - massive duplication of
1344 identical functions over time as an architecture evolves from 32-bit
1345 wide SIMD all the way up to 512-bit, is avoided with Simple-V, through
1346 vector-style parallelism being dropped on top of 8-bit or 16-bit
1347 operations, all the while keeping a consistent ISA-level "API" irrespective
1348 of implementor design choices (or indeed actual implementations).
1349
1350 # Impementing V on top of Simple-V
1351
1352 * Number of Offset CSRs extends from 2
1353 * Extra register file: vector-file
1354 * Setup of Vector length and bitwidth CSRs now can specify vector-file
1355 as well as integer or float file.
1356 * TODO
1357
1358 # Implementing P (renamed to DSP) on top of Simple-V
1359
1360 * Implementors indicate chosen bitwidth support in Vector-bitwidth CSR
1361 (caveat: anything not specified drops through to software-emulation / traps)
1362 * TODO
1363
1364 # Register reordering <a name="register_reordering"></a>
1365
1366 ## Register File
1367
1368 | Reg Num | Bits |
1369 | ------- | ---- |
1370 | r0 | (32..0) |
1371 | r1 | (32..0) |
1372 | r2 | (32..0) |
1373 | r3 | (32..0) |
1374 | r4 | (32..0) |
1375 | r5 | (32..0) |
1376 | r6 | (32..0) |
1377 | r7 | (32..0) |
1378
1379 ## Vectorised CSR
1380
1381 May not be an actual CSR: may be generated from Vector Length CSR:
1382 single-bit is less burdensome on instruction decode phase.
1383
1384 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
1385 | - | - | - | - | - | - | - | - |
1386 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 |
1387
1388 ## Vector Length CSR
1389
1390 | Reg Num | (3..0) |
1391 | ------- | ---- |
1392 | r0 | 2 |
1393 | r1 | 0 |
1394 | r2 | 1 |
1395 | r3 | 1 |
1396 | r4 | 3 |
1397 | r5 | 0 |
1398 | r6 | 0 |
1399 | r7 | 1 |
1400
1401 ## Virtual Register Reordering:
1402
1403 | Reg Num | Bits (0) | Bits (1) | Bits (2) |
1404 | ------- | -------- | -------- | -------- |
1405 | r0 | (32..0) | (32..0) |
1406 | r2 | (32..0) |
1407 | r3 | (32..0) |
1408 | r4 | (32..0) | (32..0) | (32..0) |
1409 | r7 | (32..0) |
1410
1411 ## Example Instruction translation: <a name="example_translation"></a>
1412
1413 Instructions "ADD r2 r4 r4" would result in three instructions being
1414 generated and placed into the FILO:
1415
1416 * ADD r2 r4 r4
1417 * ADD r2 r5 r5
1418 * ADD r2 r6 r6
1419
1420 ## Insights
1421
1422 SIMD register file splitting still to consider. For RV64, benefits of doubling
1423 (quadrupling in the case of Half-Precision IEEE754 FP) the apparent
1424 size of the floating point register file to 64 (128 in the case of HP)
1425 seem pretty clear and worth the complexity.
1426
1427 64 virtual 32-bit F.P. registers and given that 32-bit FP operations are
1428 done on 64-bit registers it's not so conceptually difficult.  May even
1429 be achieved by *actually* splitting the regfile into 64 virtual 32-bit
1430 registers such that a 64-bit FP scalar operation is dropped into (r0.H
1431 r0.L) tuples.  Implementation therefore hidden through register renaming.
1432
1433 Implementations intending to introduce VLIW, OoO and parallelism
1434 (even without Simple-V) would then find that the instructions are
1435 generated quicker (or in a more compact fashion that is less heavy
1436 on caches). Interestingly we observe then that Simple-V is about
1437 "consolidation of instruction generation", where actual parallelism
1438 of underlying hardware is an implementor-choice that could just as
1439 equally be applied *without* Simple-V even being implemented.
1440
1441 # Analysis of CSR decoding on latency <a name="csr_decoding_analysis"></a>
1442
1443 It could indeed have been logically deduced (or expected), that there
1444 would be additional decode latency in this proposal, because if
1445 overloading the opcodes to have different meanings, there is guaranteed
1446 to be some state, some-where, directly related to registers.
1447
1448 There are several cases:
1449
1450 * All operands vector-length=1 (scalars), all operands
1451 packed-bitwidth="default": instructions are passed through direct as if
1452 Simple-V did not exist.  Simple-V is, in effect, completely disabled.
1453 * At least one operand vector-length > 1, all operands
1454 packed-bitwidth="default": any parallel vector ALUs placed on "alert",
1455 virtual parallelism looping may be activated.
1456 * All operands vector-length=1 (scalars), at least one
1457 operand packed-bitwidth != default: degenerate case of SIMD,
1458 implementation-specific complexity here (packed decode before ALUs or
1459 *IN* ALUs)
1460 * At least one operand vector-length > 1, at least one operand
1461 packed-bitwidth != default: parallel vector ALUs (if any)
1462 placed on "alert", virtual parallelsim looping may be activated,
1463 implementation-specific SIMD complexity kicks in (packed decode before
1464 ALUs or *IN* ALUs).
1465
1466 Bear in mind that the proposal includes that the decision whether
1467 to parallelise in hardware or whether to virtual-parallelise (to
1468 dramatically simplify compilers and also not to run into the SIMD
1469 instruction proliferation nightmare) *or* a transprent combination
1470 of both, be done on a *per-operand basis*, so that implementors can
1471 specifically choose to create an application-optimised implementation
1472 that they believe (or know) will sell extremely well, without having
1473 "Extra Standards-Mandated Baggage" that would otherwise blow their area
1474 or power budget completely out the window.
1475
1476 Additionally, two possible CSR schemes have been proposed, in order to
1477 greatly reduce CSR space:
1478
1479 * per-register CSRs (vector-length and packed-bitwidth)
1480 * a smaller number of CSRs with the same information but with an *INDEX*
1481 specifying WHICH register in one of three regfiles (vector, fp, int)
1482 the length and bitwidth applies to.
1483
1484 (See "CSR vector-length and CSR SIMD packed-bitwidth" section for details)
1485
1486 In addition, LOAD/STORE has its own associated proposed CSRs that
1487 mirror the STRIDE (but not yet STRIDE-SEGMENT?) functionality of
1488 V (and Hwacha).
1489
1490 Also bear in mind that, for reasons of simplicity for implementors,
1491 I was coming round to the idea of permitting implementors to choose
1492 exactly which bitwidths they would like to support in hardware and which
1493 to allow to fall through to software-trap emulation.
1494
1495 So the question boils down to:
1496
1497 * whether either (or both) of those two CSR schemes have significant
1498 latency that could even potentially require an extra pipeline decode stage
1499 * whether there are implementations that can be thought of which do *not*
1500 introduce significant latency
1501 * whether it is possible to explicitly (through quite simply
1502 disabling Simple-V-Ext) or implicitly (detect the case all-vlens=1,
1503 all-simd-bitwidths=default) switch OFF any decoding, perhaps even to
1504 the extreme of skipping an entire pipeline stage (if one is needed)
1505 * whether packed bitwidth and associated regfile splitting is so complex
1506 that it should definitely, definitely be made mandatory that implementors
1507 move regfile splitting into the ALU, and what are the implications of that
1508 * whether even if that *is* made mandatory, is software-trapped
1509 "unsupported bitwidths" still desirable, on the basis that SIMD is such
1510 a complete nightmare that *even* having a software implementation is
1511 better, making Simple-V have more in common with a software API than
1512 anything else.
1513
1514 Whilst the above may seem to be severe minuses, there are some strong
1515 pluses:
1516
1517 * Significant reduction of V's opcode space: over 85%.
1518 * Smaller reduction of P's opcode space: around 10%.
1519 * The potential to use Compressed instructions in both Vector and SIMD
1520 due to the overloading of register meaning (implicit vectorisation,
1521 implicit packing)
1522 * Not only present but also future extensions automatically gain parallelism.
1523 * Already mentioned but worth emphasising: the simplification to compiler
1524 writers and assembly-level writers of having the same consistent ISA
1525 regardless of whether the internal level of parallelism (number of
1526 parallel ALUs) is only equal to one ("virtual" parallelism), or is
1527 greater than one, should not be underestimated.
1528
1529 # Appendix
1530
1531 # Reducing Register Bank porting
1532
1533 This looks quite reasonable.
1534 <https://www.princeton.edu/~rblee/ELE572Papers/MultiBankRegFile_ISCA2000.pdf>
1535
1536 The main details are outlined on page 4.  They propose a 2-level register
1537 cache hierarchy, note that registers are typically only read once, that
1538 you never write back from upper to lower cache level but always go in a
1539 cycle lower -> upper -> ALU -> lower, and at the top of page 5 propose
1540 a scheme where you look ahead by only 2 instructions to determine which
1541 registers to bring into the cache.
1542
1543 The nice thing about a vector architecture is that you *know* that
1544 *even more* registers are going to be pulled in: Hwacha uses this fact
1545 to optimise L1/L2 cache-line usage (avoid thrashing), strangely enough
1546 by *introducing* deliberate latency into the execution phase.
1547
1548
1549
1550 # References
1551
1552 * SIMD considered harmful <https://www.sigarch.org/simd-instructions-considered-harmful/>
1553 * Link to first proposal <https://groups.google.com/a/groups.riscv.org/forum/#!topic/isa-dev/GuukrSjgBH8>
1554 * Recommendation by Jacob Bachmeyer to make zero-overhead loop an
1555 "implicit program-counter" <https://groups.google.com/a/groups.riscv.org/d/msg/isa-dev/vYVi95gF2Mo/SHz6a4_lAgAJ>
1556 * Re-continuing P-Extension proposal <https://groups.google.com/a/groups.riscv.org/forum/#!msg/isa-dev/IkLkQn3HvXQ/SEMyC9IlAgAJ>
1557 * First Draft P-SIMD (DSP) proposal <https://groups.google.com/a/groups.riscv.org/forum/#!topic/isa-dev/vYVi95gF2Mo>
1558 * B-Extension discussion <https://groups.google.com/a/groups.riscv.org/forum/#!topic/isa-dev/zi_7B15kj6s>
1559 * Broadcom VideoCore-IV <https://docs.broadcom.com/docs/12358545>
1560 Figure 2 P17 and Section 3 on P16.
1561 * Hwacha <https://www2.eecs.berkeley.edu/Pubs/TechRpts/2015/EECS-2015-262.html>
1562 * Hwacha <https://www2.eecs.berkeley.edu/Pubs/TechRpts/2015/EECS-2015-263.html>
1563 * Vector Workshop <http://riscv.org/wp-content/uploads/2015/06/riscv-vector-workshop-june2015.pdf>
1564 * Predication <https://groups.google.com/a/groups.riscv.org/forum/#!topic/isa-dev/XoP4BfYSLXA>
1565 * Branch Divergence <https://jbush001.github.io/2014/12/07/branch-divergence-in-parallel-kernels.html>
1566 * Life of Triangles (3D) <https://jbush001.github.io/2016/02/27/life-of-triangle.html>
1567 * Videocore-IV <https://github.com/hermanhermitage/videocoreiv/wiki/VideoCore-IV-3d-Graphics-Pipeline>
1568 * Discussion proposing CSRs that change ISA definition
1569 <https://groups.google.com/a/groups.riscv.org/forum/#!topic/isa-dev/InzQ1wr_3Ak>
1570 * Zero-overhead loops <https://pdfs.semanticscholar.org/dbaa/66985cc730d4b44d79f519e96ec9c43ab5b7.pdf>
1571 * Multi-ported VLIW Register File Implementation <https://ce-publications.et.tudelft.nl/publications/1517_multiple_contexts_in_a_multiported_vliw_register_file_impl.pdf>
1572 * Fast context save/restore proposal <https://groups.google.com/a/groups.riscv.org/d/msgid/isa-dev/57F823FA.6030701%40gmail.com>
1573 * Register File Bank Cacheing <https://www.princeton.edu/~rblee/ELE572Papers/MultiBankRegFile_ISCA2000.pdf>