aboutsummaryrefslogtreecommitdiff
path: root/src/internal/cpu/cpu.go
diff options
context:
space:
mode:
authorTangYang <yang.tang@intel.com>2024-07-02 04:02:12 +0000
committerGopher Robot <gobot@golang.org>2024-07-22 21:22:16 +0000
commit601ea46a5308876e4460a1662718a9cd2c6ac2e3 (patch)
treed24705929910ee2f6cc4891e9dd2f0eb85d0fefc /src/internal/cpu/cpu.go
parent20e18c95504b047c5ba82d252318de625fabfa70 (diff)
downloadgo-601ea46a5308876e4460a1662718a9cd2c6ac2e3.tar.xz
runtime: add ERMS-based memmove support for modern CPU platforms
The current memmove implementation uses REP MOVSB to copy data larger than 2KB when the useAVXmemmove global variable is false and the CPU supports the ERMS feature. This feature is currently only enabled on CPUs in the Sandy Bridge (Client) , Sandy Bridge (Server), Ivy Bridge (Client), and Ivy Bridge (Server) microarchitectures. For modern Intel CPU microarchitectures that support the ERMS feature, such as Ice Lake (Server), Sapphire Rapids , REP MOVSB achieves better performance than the AVX-based copy currently implemented in memmove. Benchstat result: goos: linux goarch: amd64 pkg: runtime cpu: Intel(R) Xeon(R) Gold 6348 CPU @ 2.60GHz │ ./old.txt │ ./new.txt │ │ sec/op │ sec/op vs base │ Memmove/2048-2 25.24n ± 0% 24.27n ± 0% -3.84% (p=0.000 n=10) Memmove/4096-2 44.87n ± 0% 33.16n ± 1% -26.11% (p=0.000 n=10) geomean 33.65n 28.37n -15.71% │ ./old.txt │ ./new.txt │ │ B/s │ B/s vs base │ Memmove/2048-2 75.56Gi ± 0% 78.59Gi ± 0% +4.02% (p=0.000 n=10) Memmove/4096-2 85.01Gi ± 0% 115.05Gi ± 1% +35.34% (p=0.000 n=10) geomean 80.14Gi 95.09Gi +18.65% Fixes #66958 Change-Id: I1fafd1b51a16752f83ac15047cf3b29422a79d5d GitHub-Last-Rev: 89cf5af32b1b41e1499282058656a8a5c7aed359 GitHub-Pull-Request: golang/go#66959 Reviewed-on: https://go-review.googlesource.com/c/go/+/580735 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src/internal/cpu/cpu.go')
-rw-r--r--src/internal/cpu/cpu.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/internal/cpu/cpu.go b/src/internal/cpu/cpu.go
index 9be280c6ba..4ef43e3efc 100644
--- a/src/internal/cpu/cpu.go
+++ b/src/internal/cpu/cpu.go
@@ -37,6 +37,7 @@ var X86 struct {
HasBMI1 bool
HasBMI2 bool
HasERMS bool
+ HasFSRM bool
HasFMA bool
HasOSXSAVE bool
HasPCLMULQDQ bool