15 Commits

Author SHA1 Message Date
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
Tobias Klauser
808efd93c3 cpu: enable TestARM64minimalFeatures on darwin/arm64
Go 1.16 renamed the iOS port from darwin/arm64 to ios/arm64 and
darwin/arm64 was repurposed for the macOS ARM64 port (see
https://golang.org/doc/go1.16#darwin).

Now that Go 1.16 is the oldest supported release, the ios tag can be
used exclusively to detect iOS. Thus, TestARM64minimalFeatures which
ought to run on darwin/arm64 can now be enabled on that platform.

For golang/go#45696

Change-Id: Ic510fbf27dc813832507446201501df58c9f6f31
Reviewed-on: https://go-review.googlesource.com/c/sys/+/353530
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-10-02 10:42:44 +00:00
Bill O'Farrell
708e7fb298 cpu: add support for zos/s390x
This adds feature detection that works on the s390x running zos.
There are some differences with Linux (no hwcap, facilities vector available in-memory).
These changes should not affect other platforms.

Fixes golang/go#41984.

Change-Id: Ieabbfafd07367a346a4d279dde0f00aa3fc4321b
Reviewed-on: https://go-review.googlesource.com/c/sys/+/262477
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
Trust: Martin Möhrmann <moehrmann@google.com>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
2020-10-28 09:49:53 +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
Cherry Zhang
d9f96fdee2 all: add GOOS=ios
Following CL 254740, this CL does it on x/sys.

Updates golang/go#38485.

Change-Id: I5eab09a9a87c87fc883b5701434415648fb28eb0
Reviewed-on: https://go-review.googlesource.com/c/sys/+/255557
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2020-09-23 18:26:05 +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
Tobias Klauser
85b82a3add cpu: support reading arm64 CPU feature registers
This allows to detect ARM64 CPU features on non-Linux systems. On Linux,
this is used in case /proc/self/auxv cannot be read.

Change-Id: I67d55e989f2beda0c05a97ca5e55781840a8e01c
Reviewed-on: https://go-review.googlesource.com/c/sys/+/209478
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-12-04 07:21:56 +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
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
7db1c3b1a9 cpu: use t.Fatal instead of t.Fatalf
The messages contain no format string, so there is no need to use
t.Fatalf.

Change-Id: I29098c04797f919784b732af84a63fbaed671558
Reviewed-on: https://go-review.googlesource.com/111776
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-05-07 13:57:25 +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