riscv-v-spec icon indicating copy to clipboard operation
riscv-v-spec copied to clipboard

Provided vdecompress example may not work with SEW=8, VLMAX>256

Open zingaburga opened this issue 2 years ago • 0 comments

The provided example to simulate a 'vdecompress' instruction seems like it'd behave unexpectedly under certain configurations.

From what I can gather, with SEW=8, viota will wrap around after 255, and vrgather can only access the first 256 bytes of the vector. Thus the provided sequence will only work for SEW>8, or if VLMAX has been explicitly checked and found to be <=256.
A length-agnostic approach for SEW=8 might be: change SEW to 16-bit + double LMUL, viota, change back to SEW=8, then vrgatherei16 (this only works for LMUL<=4, but LMUL is user-controllable).

If my understanding is correct, I recommend clarifying this in the documentation.

zingaburga avatar Jun 22 '23 00:06 zingaburga