[PATCH] D128286: [RISCV] Disable <vscale x 1 x *> types with Zve32x or Zve32f.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 23 09:51:02 PDT 2022


craig.topper added a comment.

In D128286#3605512 <https://reviews.llvm.org/D128286#3605512>, @reames wrote:

> In D128286#3605455 <https://reviews.llvm.org/D128286#3605455>, @craig.topper wrote:
>
>> In D128286#3605390 <https://reviews.llvm.org/D128286#3605390>, @reames wrote:
>>
>>> Warning, I may be miss understanding the problem you're solving here, but...
>>>
>>> The case you mention appear to be specific to when VLEN=32 right?  If so, a cleaner way of phrasing the illegal cases would seem to be to compute the effective vector length after LMUL (i.e. VLEN/8 for mf8), and then disallow any case where the implied vector length is shorter than a single element of the element type.
>>
>> The problem is still valid for VLEN>=64 ELEN=32. While you are correct that a SEW=8 LMUL=1/8 would fit in a register for that config, there is no requirement in the spec for hardware to support it. The spec says that that the smallest fractional LMUL is SEWMIN/ELEN. Which would be 8/32 or 1/4 in this config. The spec goes on to say "For a given supported fractional LMUL setting, implementations must support SEW settings between SEWMIN and LMUL * ELEN, inclusive." So if ELEN is 32, LMUL=1/4 is only required to support SEW=8 and LMUL=1/2 is only required to support SEW=8 or 16.
>
> I think I can still phrase that in the "does this fit" manner.  I just need to introduce a MINVLEN (which is simply ELEN), and ask whether an implied vector length for a given LMUL contains a least one element.

Let's run through the math.

vscale is defined as (VLEN/RVVBitsPerBlock)
So a <vscale x 1 x i8> type is ((VLEN/RVVBitsPerBlock) * 1 * 8 bits).

Let's replace VLEN with MINVLEN(or ELEN).
size = ((ELEN/RVVBitsPerBlock) * 1 * 8 bits).

If we want to know how many 8 bit elements that holds we get
minnumelts = ((ELEN/RVVBitsPerBlock) * 1.

For ELEN = 32 and RVVBitsPerBlock=64 that value is less than 1.

We want to exclude all types <vscale x y x i8> that can't hold a whole element. Or types where ((ELEN/RVVBitsPerBlock) * y) < 1 is true.

This is true when y < (RVVBitsPerBlock / ELEN).

If we RVVBitsPerBlock followed ELEN, the definition of vscale would also follow ELEN and this would go away.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128286/new/

https://reviews.llvm.org/D128286



More information about the llvm-commits mailing list