On Wed, 23 Apr 2025 08:43:47 GMT, Hamlin Li <m...@openjdk.org> wrote:

>> src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorMathLibrary.java
>>  line 288:
>> 
>>> 286:                   IntFunction<VectorSupport.UnaryOperation<V,?>> 
>>> implSupplier,
>>> 287:                   V v) {
>>> 288:         var entry = lookup(op, opc, vspecies, implSupplier);
>> 
>> Seems there is another issue for riscv here.
>> If the rvv extension is not supported on the running machine, it will still 
>> generate the code using rvv, this should lead to a crash at runtime?
>
> In previous code, we use `UseRVV` to detect if rvv extension is supported.
> 
> On the other hand, user can choose to disable UseRVV if they want even if rvv 
> extension is supported on the running machine. In this sense, there could be 
> similar issue on other platforms?

Does the following check catch `UseRVV == false` case on RISC-V? 

public boolean isSupported(Operator op, VectorSpecies<?> vspecies) {
...
            int maxLaneCount = 
VectorSupport.getMaxLaneCount(vspecies.elementType());
            if (vspecies.length() > maxLaneCount) {
                return false; // lacking vector support
            }
...

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/24462#discussion_r2056642914

Reply via email to