-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8333245: RISC-V: UseRVV option can't be enabled after JDK-8316859 #19472
Conversation
👋 Welcome back gcao! A progress list of the required criteria for merging this PR into |
❗ This change is not yet ready to be integrated. |
If you don't have RVV you are not guaranteed to have Zicsr, meaning the csrr read of vlenb may crash ? You also need kernel support for RVV:
Only kernels with hw_probe that is reporting RVV is guaranteed todo this. If this is a vanilla 6.1.15 you can't use V AFIAK. If there are out of tree patches on top of this to make V work, they need to add the hw_probe patches also. So I would suggest something like:
Or similar as we don't want the VM to crash just because an user added +UseRVV erroneously. Note in 6.7 there is |
That makes sense to me. I think you mean kernel versions >= 6.5 where process context switch and hwprobe support for RVV are both added at the same time [1].
That sounds very tricky given that we have both rvv-0.7.1 and rvv-1.0 hardwares for now. I think it will be safer and simpler for us to rely on the availability of hwprobe syscall. But I guess will won't be a big issue when we do some simple performance evaluations like a simple JMH run, but yes, you have to change the code to force enable UseRVV when running on the older kernels. |
Another suggestion, it seem like you can ge the triplet mvendorid/marchid/mimpid from /proc/cpuinfo. So that way THEAD is unaffected. From random internet user:
|
That does not make sense to me. In case of JMH performance evaluation, we can simply revert JDK-8316859. |
@robehn @RealFYang : Thanks for the review. I'm so sorry, I think I missed the fact that kernel support for Vector extension is only available since 6.5. I agree that that UseRVV option should only be turned on if kernel support for is guaranteed first, so I think this issue can be closed. |
We need to update our check from hwcap with something along the line of:
That will return whether v1.0 is supported since |
As we can be context switched after vsetvli and thus execute csrr on another hart, without kernel support, the flag will not be set even if it's RVV 0.7. So this check is not reliable. Or do 'unkown' flags propagate even if kernel is not aware of them? |
Because some dev boards only support RVV version 0.7, In JDK-8316859 we masked the use of HWCAP to probe for RVV extensions, and in the meantime, we can use hwprobe to probe for V extensions in Linux kernel 6.5 and above. But recently we got Banana Pi BPI-F3 board (has RVV1.0), but his kernel is 6.1.15, so the V extensions detected by HWCAP are masked. And we get the warning:
RVV is not supported on this CPU
when we enable UseRVV with the command, and we can't enable UseRVV correctly.Without Patch:
With Patch:
Progress
Issue
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/19472/head:pull/19472
$ git checkout pull/19472
Update a local copy of the PR:
$ git checkout pull/19472
$ git pull https://git.openjdk.org/jdk.git pull/19472/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 19472
View PR using the GUI difftool:
$ git pr show -t 19472
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/19472.diff
Webrev
Link to Webrev Comment