RFR: 8319408: RISC-V: MaxVectorSize is not consistently checked in several situations
Hamlin Li
mli at openjdk.org
Mon Nov 6 08:50:11 UTC 2023
On Mon, 6 Nov 2023 07:05:14 GMT, Fei Yang <fyang at openjdk.org> wrote:
>> Hi,
>> Can you review the change to fix the MaxVectorSize checking in vm_version_riscv.cpp?
>> Thanks!
>>
>> Current logic will not check whether (MaxVectorSize < 16), after the assignment `MaxVectorSize = _initial_vector_length;`, in following situation.
>> a) if FLAG_IS_DEFAULT(MaxVectorSize) == true
>> b) if FLAG_IS_DEFAULT(MaxVectorSize) == false and (MaxVectorSize >= 16) and is_power_of_2(MaxVectorSize) and (MaxVectorSize > _initial_vector_length)
>>
>> And in original code, the logic is not consistent for the situations between MaxVectorSize < 16 and MaxVectorSize >= 16, when is_power_of_2(MaxVectorSize) == false; for the former (<16) it's to disable RVV, for the latter (>=16) it's vm_exit.
>
> src/hotspot/cpu/riscv/vm_version_riscv.cpp line 315:
>
>> 313: warning("RVV does not support vector length less than 16 bytes. Disabling RVV.");
>> 314: UseRVV = false;
>> 315: FLAG_SET_DEFAULT(MaxVectorSize, 0);
>
> I think setting `UseRVV` to false would be enough in this case. Why bother resetting MaxVectorSize to 0?
This is trying to be consistent with the code at LINE 295 in this file.
Or should I also remove L294-296?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16498#discussion_r1382946319
More information about the hotspot-dev
mailing list