internal/cpu: repair VNNI feature check
This is a pain to test.
It looks like processors that might lack this features
include Intel 11th generation and AMD Zen 4. These might
or might not have bit 2 set in the 7th cpuid "leaf" (SM4)
which is what the incorrect test was checking; the bug
is triggered by ^VNNI & SM4.
The "Lion Cove" microarchitecture (Arrow Lake, Lunar Lake)
appears to trigger this problem, it's not clear if there are
others. It was hard to verify this from online information.
Fixes #76881.
diff --git a/src/internal/cpu/cpu_x86.go b/src/internal/cpu/cpu_x86.go
index 4610ce8..711fb04 100644
--- a/src/internal/cpu/cpu_x86.go
+++ b/src/internal/cpu/cpu_x86.go
@@ -219,7 +219,7 @@
if eax7 >= 1 {
eax71, _, _, _ := cpuid(7, 1)
if X86.HasAVX {
- X86.HasAVXVNNI = isSet(4, eax71)
+ X86.HasAVXVNNI = isSet(eax71, cpuid_AVXVNNI)
}
}
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +2 |
Looks like this may have been copied from x/sys/cpu:
https://cs.opensource.google/go/x/sys/+/refs/tags/v0.39.0:cpu/cpu_x86.go;l=154#:~:text=153-,154,-155
Definitely confusing that x/sys/cpu and internal/cpu have very different conventions.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +2 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Looks like this may have been copied from x/sys/cpu:
https://cs.opensource.google/go/x/sys/+/refs/tags/v0.39.0:cpu/cpu_x86.go;l=154#:~:text=153-,154,-155
Definitely confusing that x/sys/cpu and internal/cpu have very different conventions.
I looked a bit into the history: x/sys/cpu and internal/cpu initially matched, until CL 94759 changed internal/cpu's x86 to match other architectures, which is a good thing itself, but diverged from x/sys. Maybe we want to update x/sys's x86 code as well...
| TryBot-Bypass | +1 |
Failure is some other flake, former failure was reproduced and corrected in the second patch set.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
internal/cpu: repair VNNI feature check
This is a pain to test.
Also the original test was never executed, because it was wrong.
It looks like processors that might lack this features
include Intel 11th generation and AMD Zen 4. These might
or might not have bit 2 set in the 7th cpuid "leaf" (SM4)
which is what the incorrect test was checking; the bug
is triggered by ^VNNI & SM4. Apparently the SM4 bit is
not usually set, else we would have seen a test failure.
The "Lion Cove" microarchitecture (Arrow Lake, Lunar Lake)
appears to trigger this problem, it's not clear if there are
others. It was hard to verify this from online information.
Fixes #76881.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |