Skip to content

8356875: RISC-V: extension flag UseZvfh should depends on UseZfh #25213

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/hotspot/cpu/riscv/vm_version_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,15 @@ void VM_Version::common_initialize() {
}

// UseZvfh (depends on RVV)
if (UseZvfh && !UseRVV) {
warning("Cannot enable UseZvfh on cpu without RVV support.");
FLAG_SET_DEFAULT(UseZvfh, false);
if (UseZvfh) {
if (!UseRVV) {
warning("Cannot enable UseZvfh on cpu without RVV support.");
FLAG_SET_DEFAULT(UseZvfh, false);
}
if (!UseZfh) {
warning("Cannot enable UseZvfh on cpu without Zfh support.");
FLAG_SET_DEFAULT(UseZvfh, false);
}
Copy link
Member

@RealFYang RealFYang May 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For QEMU, Zvfh also means Zvfhmin and Zfhmin. So there is no Zfh if you only enable Zvfh when start QEMU.
That means hwprobe syscall will detect Zvfh and Zfhmin but no Zfh. Is there a similar issue for this case?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question: Not sure if I understand you correctly, seems to me Zfh is also detected and automatically set by hwprobe when running with qemu?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this pr, it tries to address the situation: when neither Zfh/Zvfh can not be enabled automatically (no matter what's the reason), so user could enable Zvfh manually to get some optimization, in that case it will fail to get such optimization even if with -XX:+PrintFlagsFinal it shows that UseZvfh == true, this is very confusing.
So to make this situation more understanable for user (maybe more for developer) of jdk, we'd better to automatically unset UseZvfh when UseZfh is false.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for discussion.
Yes, short answer is this pr could also solve the issue you mentioned above for qemu.

}
}

Expand Down