2 ms·
> That doesn't make sense --- how would the code know how much to increment pointers by, how many times to loop, alignment, etc. ? You ask the hardware. The c
by monocasa 6y ago
> That doesn't make sense --- how would the code know how much to increment pointers by, how many times to loop, alignment, etc. ?
You ask the hardware. The current vector width is a register that can be set and queried.
https://gms.tf/riscv-vector.html https://gms.tf/riscv-vector.html
- userbinator 6y agoThat is interesting... and actually feels a bit CISCy, but this Configuring a grouping of 8 registers for a vector of 16 elements might look like overkill because 128 bit vector registers are sufficient and should be widely available. On the other hand, there might be a CPU with "V" support that just implements - say - 64 bit vector registers where we would need to group 2 registers. Since a grouping thus may be needed it really doesn't hurt to configure the maximum here. ...seems to imply that the generated code may still need to assume certain widths.
- brucehoult 6y agoNo, it doesn't imply that. It's just that if your code doesn't need 32 different vector variables then you can step down to, say, 4 variables with 8x longer registers for more efficiency. You need to know how many live variables your code has (which the compiler knows), not how long the registers are.