[Libre-soc-dev] MVL unclear

Lauri Kasanen cand at gmx.com
Fri May 21 12:58:29 BST 2021

On Fri, 21 May 2021 12:46:51 +0100
Luke Kenneth Casson Leighton <lkcl at lkcl.net> wrote:

> On Fri, May 21, 2021 at 12:35 PM Lauri Kasanen <cand at gmx.com> wrote:
> > Hi,
> >
> > I've read the entire openpower/sv section, and it's still unclear to
> > me what exactly is the point of MVL. Nowhere is it stated clearly what
> > implications are setting it low and setting it high. Nor why is it
> > limited to 64 when there are 96 extra registers.
> >
> it's a static compile-time declaration of the absolute maximum quantity
> of registers that may be permitted to be used *at runtime*.
> let us imagine that MVL does not exist as a concept, and attempt to
> implement DAXPY.  take the example here:
> https://www.sigarch.org/simd-instructions-considered-harmful/
> let us imagine that the loop amount has been set to 10,000 on
> calling the function.
>   8:  setvl  t0, a0           # vl = t0 = min(mvl, n)

This will fail to compile because the compiler knows there are only 128

> it now becomes necessary to have *two* instructions where one
> would do (actually, even more if there is no hardware integer "min"):
>      cmpi a0, 8 # we have no MVL, must do the equivalent of MVL manually
>      blt limit_ok
>      addi a0, r0, 8
> limit_ok:
>      setvl t0, a0 # now and only now is this "safe" (under limit of MVL)
> it's basically absolutely essentlal, and has been a fundamental part
> of Cray-style Vectors for decades.

Sorry, still not understanding why is it essential. To my reading, it's
a completely useless duplication of VL, because you end up calling
setvl with VL=MVL every time.

- Lauri

More information about the Libre-soc-dev mailing list