mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
This CL adds a new generator to internal/runtime/gc/scan that generates expander kernels in Go SIMD. This CL also includes a Go SIMD scan kernel and a Go SIMD filter kernel. This CL also includes the plumbing, it will use the Go SIMD kernels if goexperiment.simd is on. Benchmark results: ... ScanSpanPacked/cache=tiny/pages=1/sizeclass=26/pct=80-88 354.8n ± 1% 272.4n ± 0% -23.22% (p=0.002 n=6) ScanSpanPacked/cache=tiny/pages=1/sizeclass=26/pct=90-88 375.7n ± 0% 287.1n ± 0% -23.58% (p=0.002 n=6) ScanSpanPacked/cache=tiny/pages=1/sizeclass=26/pct=100-88 450.0n ± 1% 327.4n ± 0% -27.24% (p=0.002 n=6) geomean 246.5n 199.4n -19.10% Throughput +25%. Change-Id: Ib85e01b7de18181db9e7b6026863209a993aa85f Reviewed-on: https://go-review.googlesource.com/c/go/+/719520 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
26 lines
809 B
Go
26 lines
809 B
Go
// Copyright 2025 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
//go:build amd64
|
|
|
|
package scan
|
|
|
|
import (
|
|
"internal/runtime/gc"
|
|
)
|
|
|
|
// ExpandAVX512 expands each bit in packed into f consecutive bits in unpacked,
|
|
// where f is the word size of objects in sizeClass.
|
|
//
|
|
// This is a testing entrypoint to the expanders used by scanSpanPacked*.
|
|
//
|
|
//go:noescape
|
|
func ExpandAVX512Asm(sizeClass int, packed *gc.ObjMask, unpacked *gc.PtrMask)
|
|
|
|
// gcExpandersAVX512 is the PCs of expander functions. These cannot be called directly
|
|
// as they don't follow the Go ABI, but you can use this to check if a given
|
|
// expander PC is 0.
|
|
//
|
|
// It is defined in assembly.
|
|
var gcExpandersAVX512Asm [len(gc.SizeClassToSize)]uintptr
|