[PATCH v3 2/2] Prevent divide-by-zero
Edwin Lu
ewlu@rivosinc.com
Wed Jul 24 19:05:12 GMT 2024
On 7/24/2024 3:03 AM, Robin Dapp wrote:
>> Thanks for the explanation! I have a few clarification questions about this.
>> If I understand correctly, B would represent the number of elements the
>> vector can have (for 128b vector operating on 32b elements, B == 4, but if
>> operating on 64b elements B == 2); however, I'm not too sure what A
>> represents.
> The runtime size of a vector is a polynomial with a "base size" of A and
> "increments beyond A" of B. B is compile-time variable/indeterminate and
> runtime invariant. For (non-zve32) RVV it specifies the number of 64-bit
> chunks beyond the minimum size of 64 bits. The polynomial is [2 2] in that
> case and the "vector bit size" would be
> 64 * [2 2] = [128 128] = 128 + x * 128.
> For a runtime vector size of 256 bits, x would be 1 and so on and we determine
> it at runtime via csrr.
>
>> On the poly_int docs, it says
>>> An indeterminate value of 0 should usually represent the minimum possible
>>> runtime value, with c0 specifying the value in that case.
>> "minimum possible runtime value" doesn't make sense to me. Does it mean the
>> potential minimum bound of elements it will operate on?
> This refers to the minimum runtime size of a vector, the constant 2 * 64 bit
> above. So it doesn't talk about the number of elements. The number of
> elements can be deducted from the "vector size" polynomial by dividing it by
> the element size. The minimum number of elements for an element size S could
> e.g. be [128 128] / S = 128 / S + x * (128 / S).
I think all of this makes sense to me! Thanks for all the explanations!
Edwin
More information about the Gcc-patches
mailing list