RFR: 8353786: Migrate Vector API math library support to FFM API [v10]

Hamlin Li mli at openjdk.org
Wed Apr 23 08:56:44 UTC 2025


On Wed, 23 Apr 2025 00:23:46 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:

>> A simple fix could be:
>> 
>> diff --git a/src/hotspot/os_cpu/linux_riscv/vm_version_linux_riscv.cpp b/src/hotspot/os_cpu/linux_riscv/vm_version_linux_riscv.cpp
>> index 484a2a645aa..a785dc65c9e 100644
>> --- a/src/hotspot/os_cpu/linux_riscv/vm_version_linux_riscv.cpp
>> +++ b/src/hotspot/os_cpu/linux_riscv/vm_version_linux_riscv.cpp
>> @@ -196,25 +196,12 @@ void VM_Version::setup_cpu_available_features() {
>>  
>>    _cpu_info_string = os::strdup(buf);
>>  
>> -  _features_string = extract_features_string(_cpu_info_string,
>> -                                             strnlen(_cpu_info_string, sizeof(buf)),
>> -                                             features_offset);
>> +  _features_string = _cpu_info_string;
>>  }
>
> Alternatively, it's fine for now to completely drop `extract_features_string` call on linux-riscv  (as on some other platforms) and fix it separately. Then `VectorSupport.getCPUFeatures()` returns empty string. `VectorMathLibrary` doesn't rely on `CPUFeatures` on RISC-V.
> 
> Let me know how you prefer to handle it.

I think we still need this or similar thing on riscv. Please check my new comments below about rvv extension on riscv.
On the other hand, it's also good to have it on riscv for consistency, and there is a log output of "cpu features" in VectorMathLibrary.java

>> Mayber in `CPUFeatures`, could use the similar code as `CPUInfo` to split the cpu string into cpu features?
>
> The intention is to align `_features_string` with `_features` which enumerates well-known CPU capabilities JVM manages. As of now, `_features_string` contains more information, so I introduced `_cpu_info_string` to keep it.
> 
> Speaking of `test/lib/jdk/test/whitebox/cpuinfo/CPUInfo.java`, the approach chosen there may be fine for a test library, but we need a more stable API between JVM and JDK.

I'm fine with this.
But it might be better to change the spliting regex of  `_features_string` in CPUFeatures.java to support riscv cpu features format.

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

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


More information about the hotspot-compiler-dev mailing list