-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
proposal: x/sys: add riscv vector extension detection #62238
Comments
Change https://go.dev/cl/508676 mentions this issue: |
(attn @golang/riscv64) |
We should also define what HasV actually means. Does it mean that Version 1.0 of the RISC-V Vector extension is supported or some earlier version? This is an issue as there are some boards on the market, e.g., Sipeed LicheePi that implement a draft version of the Vector specification (v0.7), and unfortunately, v0.7 and the ratified v1.0 are not binary compatible. Presumably we want HasV to be set to true only if the underlying CPU supports the ratified 1.0 version of the Vector specification or a backwardly compatible future version. Assuming this is the case, there's another problem. It seems that the LicheePi has a custom kernel that reports support for the 'V' extension via hwcap, even though it only supports v0.7 of the standard. Any Go programs that were to use hwcap to detect the vector extension before executing V1.0 vector code would most likely crash on the LicheePi. This is not just a hypothetical concern. An issue was raised in OpenJDK this week reporting binary incompatibility vector related crashes on the LicheePi in the JVM. The solution adopted in the OpenJDK was to stop using hwcap to detect the Vector extension and to instead rely exclusively riscv_hwprobe, as proposed in #61416, to detect Vector . riscv_hwprobe does not have these issues as the extensions it reports are explicitly versioned. |
Closed, as HasV had been abondon. |
Since Linux 6.5 will be released with riscv vector support, I proposal adding a vector feature detection for it.
Linux source code: https://github.com/torvalds/linux/blob/v6.5-rc7/arch/riscv/include/uapi/asm/hwcap.h
The API change in x/sys is simple by adding:
Other Linux architecture had already supported aux reading, nothing changed in
*_linux
.FreeBSD has not support riscv as Tier 1 platform, nothing changed in freebsd/riscv64.
p.s. In CL 508676, Mills wants a proposal for riscv64 vector extension detection.
Related #61416
The text was updated successfully, but these errors were encountered: