Cherry Mui
4f4f1c6fea
Revert "cpu: add HPDS, LOR, PAN detection for arm64"
...
This reverts CL 704075.
Reason for revert: Based on golang/go#76386 , it doesn't seem to work correctly.
Fixes golang/go#76386 .
Change-Id: I51ccbc8715c25c0d061d56dfbf0e8158f1207018
Reviewed-on: https://go-review.googlesource.com/c/sys/+/724160
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Michael Knyszek <mknyszek@google.com >
Auto-Submit: Cherry Mui <cherryyz@google.com >
2025-11-24 15:42:25 -08:00
Chongyi Zheng
6239615695
cpu: add HPDS, LOR, PAN detection for arm64
...
This CL gets ID_AA64MMFR1_EL1, Memory Model Feature Register 1, and
grabs HPDS, LOR, PAN features from its bits.
Fixes golang/go#75472 .
Change-Id: Ic04b109d79aceba9b3b1d3a1ea514fcf132007c5
GitHub-Last-Rev: f938ff468b
GitHub-Pull-Request: golang/sys#263
Reviewed-on: https://go-review.googlesource.com/c/sys/+/704075
Reviewed-by: Keith Randall <khr@google.com >
Auto-Submit: Keith Randall <khr@golang.org >
Reviewed-by: Michael Knyszek <mknyszek@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Keith Randall <khr@golang.org >
2025-10-28 09:43:50 -07:00
Meng Zhuo
c0a9559877
cpu: add crypto extensions detection for riscv64
...
This CL adds RISC-V cryptography extensions detection.
Direct detection of the extensions zvkned, zvknhb, zvksed and
zvksh is not supported, since the crypto spec requires these
extensions implemented with data independent timing (zkt).
However, their presence may be inferred by checking for
the shorthand extensions: zvkn, zvknc, zvkng, zvks, zvksc, zvksg.
Change-Id: Ic00038cebf1b9f77426876b06b08f206473ad6fb
Reviewed-on: https://go-review.googlesource.com/c/sys/+/664375
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Junyang Shao <shaojunyang@google.com >
Reviewed-by: Mark Ryan <markdryan@rivosinc.com >
Reviewed-by: Carlos Amedee <carlos@golang.org >
Reviewed-by: Pengcheng Wang <wangpengcheng.pp@bytedance.com >
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
2025-05-01 02:30:04 -07:00
Guoqi Chen
b8f7da6c5a
cpu: add support for detecting cpu features on loong64
...
Except for lasx, all other features have been implemented
in the Go mainline.
Change-Id: I61a09396ed23d17991b641a1265e952585cb5636
Reviewed-on: https://go-review.googlesource.com/c/sys/+/655355
Reviewed-by: David Chase <drchase@google.com >
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Junyang Shao <shaojunyang@google.com >
Reviewed-by: Meidan Li <limeidan@loongson.cn >
2025-03-11 18:36:47 -07:00
Grigorii Khvatskii
c75621413d
cpu: add support for AVX-VNNI and IFMA detection
...
Added detection for x86 AVX-VNNI (VEX-coded Vector Neural Network
Instructions) and AVX-IFMA (VEX-coded Integer Fused Multiply Add),
including both the base VNNI set and the Int8 extention.
Fixes golang/go#71142
Change-Id: I9e8d18b2e8bf81d5d4313a4a47fdf731fb3d44dd
GitHub-Last-Rev: 32ea443fc2
GitHub-Pull-Request: golang/sys#242
Reviewed-on: https://go-review.googlesource.com/c/sys/+/641155
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Michael Pratt <mpratt@google.com >
Auto-Submit: Ian Lance Taylor <iant@google.com >
Reviewed-by: Ian Lance Taylor <iant@google.com >
2025-01-10 12:06:19 -08:00
Mark Ryan
3283fc3f61
cpu: add support for detecting RISC-V extensions
...
Add a RISCV64 variable to cpu that indicates both the presence
of RISC-V extensions and performance information about the underlying
RISC-V cores. The variable is only populated with non false values on
Linux. The detection code first attempts to use the riscv_hwprobe
syscall introduced in Linux 6.4, falling back to HWCAP if riscv_hwprobe
is not supported. The patch can detect the C, V, Zba, Zbb and Zbs
extensions. V, Zba, Zbb and Zbs can only be detected on a 6.5 kernel
or later (without backports).
Updates golang/go#61416
Change-Id: I40f92724ee3d337c06bdc559ff0b18a8f6bfda9f
Reviewed-on: https://go-review.googlesource.com/c/sys/+/605815
Reviewed-by: Cherry Mui <cherryyz@google.com >
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Reviewed-by: Joel Sing <joel@sing.id.au >
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com >
2024-08-23 10:43:34 +00:00
Hernan Martinez
7bb0bf703b
cpu: add Int8 matrix multiplication instructions CPU feature flag for ARM64
...
References:
5bbd9b2498/arch/arm64/include/uapi/asm/hwcap.h (L75C9-L75C31)
https://developer.arm.com/documentation/ddi0601/2024-03/AArch64-Registers/ID-AA64ISAR1-EL1--AArch64-Instruction-Set-Attribute-Register-1
Change-Id: Ic4e1cf2c23097c7e8695453b6d0b335756d474bc
Reviewed-on: https://go-review.googlesource.com/c/sys/+/595678
Reviewed-by: Ian Lance Taylor <iant@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Auto-Submit: Ian Lance Taylor <iant@golang.org >
Reviewed-by: Cherry Mui <cherryyz@google.com >
2024-07-17 17:57:00 +00:00
Roland Shoemaker
47fe916942
cpu: add support for DIT detection
...
Change-Id: I9f0991da9684ebd297e40a754e34130c418c34d0
Reviewed-on: https://go-review.googlesource.com/c/sys/+/597377
Reviewed-by: Ian Lance Taylor <iant@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
2024-07-11 16:45:38 +00:00
Michal Hruby
7758090324
cpu: add support for sve2 detection
...
Fixes golang/go#66952
Change-Id: Idaf2ce3b09baf33cf29079677a83a51ea9c4b255
GitHub-Last-Rev: eac00886d1
GitHub-Pull-Request: golang/sys#193
Reviewed-on: https://go-review.googlesource.com/c/sys/+/580655
Reviewed-by: Ian Lance Taylor <iant@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Auto-Submit: Ian Lance Taylor <iant@google.com >
Reviewed-by: David Chase <drchase@google.com >
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com >
2024-05-03 16:45:19 +00:00
cui fliter
70233675ae
cpu: remove repetitive word
...
Change-Id: I6dbed409b549ab2cfc862094f19373816b7c0859
Reviewed-on: https://go-review.googlesource.com/c/sys/+/519076
Reviewed-by: Ian Lance Taylor <iant@google.com >
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
Run-TryBot: Ian Lance Taylor <iant@google.com >
TryBot-Result: Gopher Robot <gobot@golang.org >
Auto-Submit: Ian Lance Taylor <iant@google.com >
2023-08-16 01:58:07 +00:00
Anton Kuklin
eabbd5c036
cpu: add support for amx detection
...
Added detection for x86 AMX,
including AMX-Tile, AMX-INT8 and AMX-BF16
instruction sets.
Change-Id: Ib3d663430b64d46b46b22bdd05d40f1992e37ee0
GitHub-Last-Rev: 7986ed6d4f
GitHub-Pull-Request: golang/sys#170
Reviewed-on: https://go-review.googlesource.com/c/sys/+/516815
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com >
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com >
TryBot-Result: Gopher Robot <gobot@golang.org >
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com >
Reviewed-by: Michael Knyszek <mknyszek@google.com >
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
2023-08-14 16:42:18 +00:00
Russ Cox
b5fbb4746d
all: gofmt
...
Gofmt to update doc comments to the new formatting.
For golang/go#51082 .
Change-Id: I9a1c4b671c06820a1c383ee515f7884965fefa54
Reviewed-on: https://go-review.googlesource.com/c/sys/+/399602
Reviewed-by: Ian Lance Taylor <iant@google.com >
Auto-Submit: Russ Cox <rsc@golang.org >
TryBot-Result: Gopher Robot <gobot@golang.org >
Run-TryBot: Russ Cox <rsc@golang.org >
2022-04-29 23:34:32 +00:00
zhangyunhao
63515b42dc
cpu: add support for detecting cmpxchg16b
...
Change-Id: I892de938e85205c0506aa82e31297b7a99e48e44
Reviewed-on: https://go-review.googlesource.com/c/sys/+/329450
Trust: Martin Möhrmann <martin@golang.org >
Trust: Tobias Klauser <tobias.klauser@gmail.com >
Run-TryBot: Martin Möhrmann <martin@golang.org >
TryBot-Result: Go Bot <gobot@golang.org >
Reviewed-by: Martin Möhrmann <martin@golang.org >
2021-08-23 07:06:55 +00:00
Tobias Klauser
b0526f3d87
cpu: set PPC64.IsPOWER8 for Power9 on aix
...
This is in line with the behavior on linux.
Fixes golang/go#46040
Change-Id: I01ba1896d879425d12096ae67250d7e60beb7a99
Reviewed-on: https://go-review.googlesource.com/c/sys/+/318549
Trust: Tobias Klauser <tobias.klauser@gmail.com >
Trust: Bryan C. Mills <bcmills@google.com >
Trust: Martin Möhrmann <moehrmann@google.com >
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com >
TryBot-Result: Go Bot <gobot@golang.org >
Reviewed-by: Bryan C. Mills <bcmills@google.com >
Reviewed-by: Martin Möhrmann <moehrmann@google.com >
2021-05-11 11:38:59 +00:00
Anton Kuklin
006507a758
cpu: add support for detecting AVX-512
...
The existing implementation hasn't AVX-512 detection support.
This patch extends cpu package with such a functionality.
Fixes golang/go#41288
Change-Id: Iaddd57c5ff6d73360b77886458b9210b6c446859
Reviewed-on: https://go-review.googlesource.com/c/sys/+/257937
Trust: Tobias Klauser <tobias.klauser@gmail.com >
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com >
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com >
TryBot-Result: Go Bot <gobot@golang.org >
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com >
2020-09-28 20:51:50 +00:00
Polina Osadcha
0cf7623e9d
cpu: add GODEBUG options to disable use of instruction set extensions
...
The GODEBUG environment variable can be used to disable usage of
specific processor features of Go programs that use the sys/cpu package.
This is useful for testing and benchmarking different code paths that
are guarded by sys/cpu variable checks.
Use of processor features can not be enabled through GODEBUG.
To disable usage of AVX and SSE41 cpu features on GOARCH amd64 use:
GODEBUG=cpu.avx=off,cpu.sse41=off
The special "all" option can be used to disable all options:
GODEBUG=all=off
This aligns the support of GODEBUG for sys/cpu with existing support
for GODEBUG in the Go standard library package internal/cpu.
Fixes golang/go#33963
Change-Id: I618b71af397bf06c57a49b2a300d032a16d05664
Reviewed-on: https://go-review.googlesource.com/c/sys/+/245237
Run-TryBot: Martin Möhrmann <moehrmann@google.com >
TryBot-Result: Gobot Gobot <gobot@golang.org >
Reviewed-by: Martin Möhrmann <moehrmann@google.com >
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com >
2020-08-05 06:55:43 +00:00
Tobias Klauser
062a44052d
cpu: add mips64x feature detection
...
Follow CL 200579
Change-Id: Ibedd6569bda3d7836ccb77a7746ed0e5df13c633
Reviewed-on: https://go-review.googlesource.com/c/sys/+/221698
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com >
TryBot-Result: Gobot Gobot <gobot@golang.org >
Reviewed-by: Ian Lance Taylor <iant@golang.org >
2020-03-02 08:32:56 +00:00
John Papandriopoulos
c990c680b6
cpu: support ARM feature detection on Linux
...
Updates golang/go#33508
Change-Id: I9ea01090f5b4ac95c1a14881c305461bd4a7b5dd
Reviewed-on: https://go-review.googlesource.com/c/sys/+/190525
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com >
TryBot-Result: Gobot Gobot <gobot@golang.org >
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com >
Reviewed-by: Martin Möhrmann <moehrmann@google.com >
2019-09-27 07:32:44 +00:00
Michael Munday
6c9a33b5f7
cpu: add CPU features for s390x
...
Add basic support for IBM Z (s390x) CPU feature (known as
'facilities') detection.
Note that some of these features are mandatory when using the Go
compiler (for example, ldisp and eimm) but aren't mandatory when
using gccgo.
Cryptographic function detection is not yet implemented for
gccgo.
Change-Id: Ic6494d0df0bc1c1ad1713c9ff11ae23fba03d215
Reviewed-on: https://go-review.googlesource.com/c/163003
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com >
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com >
TryBot-Result: Gobot Gobot <gobot@golang.org >
2019-02-28 11:51:10 +00:00
Tobias Klauser
92a0ff1e1e
cpu: don't panic on error reading /proc/self/auxv
...
On Android /proc/self/auxv is not readable, leading to a panic in init.
Instead of panic'ing in this case, introduce the Initialized global bool
to report whether the CPU features were initialized i.e. /proc/self/auxv
was successfullly read.
Fixes golang/go#30413
Change-Id: Ib520f202990614a76bceb0bf9d19a88eadd13e10
Reviewed-on: https://go-review.googlesource.com/c/164057
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org >
Reviewed-by: Ian Lance Taylor <iant@golang.org >
2019-02-28 07:16:10 +00:00
Tobias Klauser
2970a3744d
cpu: detect RDRAND and RDSEED instructions on x86
...
Change-Id: I2d0094d64ba12f888758aeebdb43aed353ddeeb9
Reviewed-on: https://go-review.googlesource.com/c/160577
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com >
Reviewed-by: Ian Lance Taylor <iant@golang.org >
2019-02-01 07:34:06 +00:00
Carlos Eduardo Seo
20be8e55dc
cpu: add linux/ppc64x
...
Port from Go internal/cpu.
Fixes golang/go#25185
Change-Id: Id3cac18da6ffec9d10df755c4032ce3068ab634d
Reviewed-on: https://go-review.googlesource.com/c/152938
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org >
2019-01-07 17:34:14 +00:00
Meng Zhuo
70b957f3b6
cpu: add linux/arm64
...
Port from Go internal/cpu
Updates golang/go#25185
Change-Id: I8390980e38b61f6c428fafa0665a03952e7b00bb
Reviewed-on: https://go-review.googlesource.com/c/150718
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com >
TryBot-Result: Gobot Gobot <gobot@golang.org >
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org >
Reviewed-by: Martin Möhrmann <moehrmann@google.com >
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com >
2018-12-06 07:42:57 +00:00
Tobias Klauser
538ab54ba9
cpu: introduce and export type CacheLinePad
...
Add a CacheLinePad struct type that has a size of cacheLineSize.
This can be used for padding structs in order to avoid false sharing.
Fixes golang/go#25203
Change-Id: I6b6daf91ea0e9c50428ffa053035429c3921b461
Reviewed-on: https://go-review.googlesource.com/111775
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com >
TryBot-Result: Gobot Gobot <gobot@golang.org >
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org >
2018-06-06 11:15:58 +00:00
Andreas Auernhammer
4adea008a5
cpu: new package
...
This CL introduces a new cpu package for CPU/platform feature detection.
The cpu package is basically a copy of `internal/cpu` of the standard library.
Revision: bf86aec25972f3a100c3aa58a6abcbcc35bdea49
This CL does not export ARM64 and PPC64 feature detection since at the moment
ARM64/PPC64 requires standard library support.
Updates golang/go#24843
Change-Id: I11bc1ca60b116e902c941b5887c00870dbb1f899
Reviewed-on: https://go-review.googlesource.com/107015
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org >
2018-04-30 17:35:09 +00:00