RFR: 8319408: RISC-V: MaxVectorSize is not consistently checked in several situations
Ludovic Henry
luhenry at openjdk.org
Tue Nov 7 01:39:28 UTC 2023
On Fri, 3 Nov 2023 16:11:15 GMT, Hamlin Li <mli 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 306:
> 304: MaxVectorSize = _initial_vector_length;
> 305: } else if (!is_power_of_2(MaxVectorSize)) {
> 306: vm_exit_during_initialization(err_msg("Unsupported MaxVectorSize: %d", (int)MaxVectorSize));
you can add an explanation, like the following:
Suggestion:
vm_exit_during_initialization(err_msg("Unsupported MaxVectorSize: %d, must be a power of 2", (int)MaxVectorSize));
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16498#discussion_r1382701444
More information about the hotspot-dev
mailing list