[libre-riscv-dev] [isa-dev] [RFC] SV branch behaviour: augmentation to store results of conditional tests

lkcl luke.leighton at gmail.com
Thu Sep 26 11:46:42 BST 2019


Example 1: Uncountable loop:

while (*p != NULL)
    *q++ = *p++;

well that's definitely vectorisable with fail-on-first, it's near-identical 
to the canonical strcpy.

bruce, i have a hunch that the idea of data-dependent early-VL-termination 
which i added to SV after looking at "normal" data-dependent behaviour may 
turn out to be really useful, i.e. applicable in a *lot* of 
otherwise-unvectoriseable loops.

the basic idea is that the predicate mask, when set up in the 
"vectorisation context", may be marked as being a "fail-on-first" predicate 
(where x0 and inversion may be used in order to set an "unconditional" 
predicate, where ffirst is then also set).

the "normal" fail-on-first is the data-dependent one which activates only 
after the first exception (such as a LD trap).

the *additional* fail-on-first capability that i added was that if the 
operation returns zero (or FP +/- 0) it *also* triggers termination of the 
vector-loop, and sets VL equal to the last successful element.

in combination with the consensual-branch capability (or by testing VL != 
expected length), looping may end at the correct point, safe in the 
knowledge that any operations carried out prior to the test-point were 
definitely done *only* on the range-limited VL up to the fail-point and 
*not* beyond.

i have a sneaking suspicion that this could be the kind of capability that 
would make it almost laughably trivial to vectorise loops that were 
formerly considered unworkable or just simply far too expensive.


More information about the libre-riscv-dev mailing list