[go] internal/cpu: repair VNNI feature check

2 views
Skip to first unread message

David Chase (Gerrit)

unread,
Dec 18, 2025, 1:59:34 PM (22 hours ago) Dec 18
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

David Chase has uploaded the change for review

Commit message

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.
Change-Id: I21be6b4f47134d81e89799b0f06f89fcb6563264

Change diff

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)
}
}

Change information

Files:
  • M src/internal/cpu/cpu_x86.go
Change size: XS
Delta: 1 file changed, 1 insertion(+), 1 deletion(-)
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newchange
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I21be6b4f47134d81e89799b0f06f89fcb6563264
Gerrit-Change-Number: 731240
Gerrit-PatchSet: 1
Gerrit-Owner: David Chase <drc...@google.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

David Chase (Gerrit)

unread,
Dec 18, 2025, 2:12:00 PM (22 hours ago) Dec 18
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

David Chase voted Commit-Queue+1

Commit-Queue+1
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I21be6b4f47134d81e89799b0f06f89fcb6563264
Gerrit-Change-Number: 731240
Gerrit-PatchSet: 1
Gerrit-Owner: David Chase <drc...@google.com>
Gerrit-Reviewer: David Chase <drc...@google.com>
Gerrit-Comment-Date: Thu, 18 Dec 2025 19:11:55 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
unsatisfied_requirement
satisfied_requirement
open
diffy

Keith Randall (Gerrit)

unread,
Dec 18, 2025, 2:36:19 PM (22 hours ago) Dec 18
to David Chase, goph...@pubsubhelper.golang.org, Keith Randall, Go LUCI, Martin Möhrmann, Gopher Robot, golang-co...@googlegroups.com
Attention needed from David Chase and Martin Möhrmann

Keith Randall voted and added 1 comment

Votes added by Keith Randall

Code-Review+2

1 comment

Patchset-level comments
File-level comment, Patchset 1 (Latest):
Keith Randall . resolved

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.

Open in Gerrit

Related details

Attention is currently required from:
  • David Chase
  • Martin Möhrmann
Submit Requirements:
  • requirement satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I21be6b4f47134d81e89799b0f06f89fcb6563264
Gerrit-Change-Number: 731240
Gerrit-PatchSet: 1
Gerrit-Owner: David Chase <drc...@google.com>
Gerrit-Reviewer: David Chase <drc...@google.com>
Gerrit-Reviewer: Keith Randall <k...@golang.org>
Gerrit-Reviewer: Martin Möhrmann <moeh...@google.com>
Gerrit-CC: Gopher Robot <go...@golang.org>
Gerrit-Attention: David Chase <drc...@google.com>
Gerrit-Attention: Martin Möhrmann <moeh...@google.com>
Gerrit-Comment-Date: Thu, 18 Dec 2025 19:36:15 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Keith Randall (Gerrit)

unread,
Dec 18, 2025, 2:36:29 PM (22 hours ago) Dec 18
to David Chase, goph...@pubsubhelper.golang.org, Keith Randall, Go LUCI, Martin Möhrmann, Gopher Robot, golang-co...@googlegroups.com
Attention needed from David Chase and Martin Möhrmann

Keith Randall voted Code-Review+1

Code-Review+1
Open in Gerrit

Related details

Attention is currently required from:
  • David Chase
  • Martin Möhrmann
Submit Requirements:
    • requirement satisfiedCode-Review
    • requirement satisfiedNo-Unresolved-Comments
    • requirement satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I21be6b4f47134d81e89799b0f06f89fcb6563264
    Gerrit-Change-Number: 731240
    Gerrit-PatchSet: 1
    Gerrit-Owner: David Chase <drc...@google.com>
    Gerrit-Reviewer: David Chase <drc...@google.com>
    Gerrit-Reviewer: Keith Randall <k...@golang.org>
    Gerrit-Reviewer: Keith Randall <k...@google.com>
    Gerrit-Reviewer: Martin Möhrmann <moeh...@google.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-Attention: David Chase <drc...@google.com>
    Gerrit-Attention: Martin Möhrmann <moeh...@google.com>
    Gerrit-Comment-Date: Thu, 18 Dec 2025 19:36:26 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    David Chase (Gerrit)

    unread,
    Dec 18, 2025, 3:46:45 PM (21 hours ago) Dec 18
    to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
    Attention needed from David Chase, Keith Randall, Keith Randall and Martin Möhrmann

    David Chase uploaded new patchset

    David Chase uploaded patch set #2 to this change.
    Following approvals got outdated and were removed:
    • Code-Review: +1 by Keith Randall, +2 by Keith Randall
    • TryBots-Pass: LUCI-TryBot-Result-1 by Go LUCI
    Open in Gerrit

    Related details

    Attention is currently required from:
    • David Chase
    • Keith Randall
    • Keith Randall
    • Martin Möhrmann
    Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: newpatchset
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I21be6b4f47134d81e89799b0f06f89fcb6563264
    Gerrit-Change-Number: 731240
    Gerrit-PatchSet: 2
    Gerrit-Owner: David Chase <drc...@google.com>
    Gerrit-Reviewer: David Chase <drc...@google.com>
    Gerrit-Reviewer: Keith Randall <k...@golang.org>
    Gerrit-Reviewer: Keith Randall <k...@google.com>
    Gerrit-Reviewer: Martin Möhrmann <moeh...@google.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-Attention: Keith Randall <k...@golang.org>
    Gerrit-Attention: David Chase <drc...@google.com>
    Gerrit-Attention: Martin Möhrmann <moeh...@google.com>
    Gerrit-Attention: Keith Randall <k...@google.com>
    unsatisfied_requirement
    satisfied_requirement
    open
    diffy

    Cherry Mui (Gerrit)

    unread,
    Dec 18, 2025, 5:29:03 PM (19 hours ago) Dec 18
    to David Chase, goph...@pubsubhelper.golang.org, Go LUCI, Keith Randall, Keith Randall, Martin Möhrmann, Gopher Robot, golang-co...@googlegroups.com
    Attention needed from David Chase, Keith Randall, Keith Randall and Martin Möhrmann

    Cherry Mui voted Code-Review+2

    Code-Review+2
    Open in Gerrit

    Related details

    Attention is currently required from:
    • David Chase
    • Keith Randall
    • Keith Randall
    • Martin Möhrmann
    Submit Requirements:
    • requirement satisfiedCode-Review
    • requirement satisfiedNo-Unresolved-Comments
    • requirement satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I21be6b4f47134d81e89799b0f06f89fcb6563264
    Gerrit-Change-Number: 731240
    Gerrit-PatchSet: 2
    Gerrit-Owner: David Chase <drc...@google.com>
    Gerrit-Reviewer: Cherry Mui <cher...@google.com>
    Gerrit-Reviewer: David Chase <drc...@google.com>
    Gerrit-Reviewer: Keith Randall <k...@golang.org>
    Gerrit-Reviewer: Keith Randall <k...@google.com>
    Gerrit-Reviewer: Martin Möhrmann <moeh...@google.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-Attention: Keith Randall <k...@golang.org>
    Gerrit-Attention: David Chase <drc...@google.com>
    Gerrit-Attention: Martin Möhrmann <moeh...@google.com>
    Gerrit-Attention: Keith Randall <k...@google.com>
    Gerrit-Comment-Date: Thu, 18 Dec 2025 22:28:58 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Cherry Mui (Gerrit)

    unread,
    Dec 18, 2025, 5:32:08 PM (19 hours ago) Dec 18
    to David Chase, goph...@pubsubhelper.golang.org, Go LUCI, Keith Randall, Keith Randall, Martin Möhrmann, Gopher Robot, golang-co...@googlegroups.com
    Attention needed from David Chase, Keith Randall, Keith Randall and Martin Möhrmann

    Cherry Mui added 1 comment

    Patchset-level comments
    Keith Randall . resolved

    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.

    Cherry Mui

    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...

    Gerrit-Comment-Date: Thu, 18 Dec 2025 22:32:05 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Keith Randall <k...@golang.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    David Chase (Gerrit)

    unread,
    Dec 18, 2025, 9:36:49 PM (15 hours ago) Dec 18
    to goph...@pubsubhelper.golang.org, Cherry Mui, Go LUCI, Keith Randall, Keith Randall, Martin Möhrmann, Gopher Robot, golang-co...@googlegroups.com
    Attention needed from Keith Randall, Keith Randall and Martin Möhrmann

    David Chase voted and added 1 comment

    Votes added by David Chase

    TryBot-Bypass+1

    1 comment

    Patchset-level comments
    File-level comment, Patchset 2 (Latest):
    David Chase . resolved

    Failure is some other flake, former failure was reproduced and corrected in the second patch set.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Keith Randall
    • Keith Randall
    • Martin Möhrmann
    Submit Requirements:
      • requirement satisfiedCode-Review
      • requirement satisfiedNo-Unresolved-Comments
      • requirement satisfiedReview-Enforcement
      • requirement satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: I21be6b4f47134d81e89799b0f06f89fcb6563264
      Gerrit-Change-Number: 731240
      Gerrit-PatchSet: 2
      Gerrit-Owner: David Chase <drc...@google.com>
      Gerrit-Reviewer: Cherry Mui <cher...@google.com>
      Gerrit-Reviewer: David Chase <drc...@google.com>
      Gerrit-Reviewer: Keith Randall <k...@golang.org>
      Gerrit-Reviewer: Keith Randall <k...@google.com>
      Gerrit-Reviewer: Martin Möhrmann <moeh...@google.com>
      Gerrit-CC: Gopher Robot <go...@golang.org>
      Gerrit-Attention: Keith Randall <k...@golang.org>
      Gerrit-Attention: Martin Möhrmann <moeh...@google.com>
      Gerrit-Attention: Keith Randall <k...@google.com>
      Gerrit-Comment-Date: Fri, 19 Dec 2025 02:36:45 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      open
      diffy

      David Chase (Gerrit)

      unread,
      Dec 18, 2025, 9:37:14 PM (15 hours ago) Dec 18
      to goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Cherry Mui, Go LUCI, Keith Randall, Keith Randall, Martin Möhrmann, Gopher Robot, golang-co...@googlegroups.com

      David Chase submitted the change

      Change information

      Commit message:
      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.
      Change-Id: I21be6b4f47134d81e89799b0f06f89fcb6563264
      TryBot-Bypass: David Chase <drc...@google.com>
      Reviewed-by: Cherry Mui <cher...@google.com>
      Files:
      • M src/internal/cpu/cpu_x86.go
      • M src/simd/archsimd/internal/simd_test/simd_test.go
      Change size: S
      Delta: 2 files changed, 12 insertions(+), 8 deletions(-)
      Branch: refs/heads/master
      Submit Requirements:
      • requirement satisfiedCode-Review: +2 by Cherry Mui
      • requirement satisfiedTryBots-Pass: LUCI-TryBot-Result-1 by Go LUCI, TryBot-Bypass+1 by David Chase
      Open in Gerrit
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: merged
      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: I21be6b4f47134d81e89799b0f06f89fcb6563264
      Gerrit-Change-Number: 731240
      Gerrit-PatchSet: 3
      open
      diffy
      satisfied_requirement
      Reply all
      Reply to author
      Forward
      0 new messages