Radar · Go · #001 · Week 39 · Sep 21 – 27, 2026
Platform-independent SIMD in Go (Go blog)
Nice to knowstdlib
- What changed
- The Go blog introduced the experimental
simdpackage in Go 1.27: one portable API for vector operations, with types such assimd.Float32s, that uses AVX, AVX2 and AVX-512 on amd64, NEON on arm64 and wasm's SIMD instructions, and emulates the rest. It sits beside the architecture-specificarchsimdpackage, which covered amd64 in Go 1.26 and added arm64 and wasm in Go 1.27. - Production impact
- Both packages are experiments that build only with
GOEXPERIMENT=simd, and this first release has gaps: there is no sum across a vector untilReduceSumarrives in the next release. - Try it
- On Go 1.27, build the post's inner-product example with
GOEXPERIMENT=simd go run .and compare it with a plain loop. - Source
- go.dev/blog/simd-experiment
Understand it, then run it
SIMD means "single instruction, multiple data": the processor adds or multiplies several numbers at once, say eight pairs of float64 values in one instruction, instead of one pair at a time. It can speed up anything that does the same arithmetic over lots of data.
Until now, using it from Go meant writing assembly. The experimental simd package lets you write it in plain Go, once, and have it run on every platform: with real SIMD instructions where the processor has them, and emulated where it does not.
Run it now
package main
import "fmt"
// The Go blog's example for the experimental simd package is an inner
// product. This is the plain loop it vectorizes: one multiply and one add per
// element. With GOEXPERIMENT=simd on Go 1.27, simd.Float32s loads several
// elements at once and MulAdd handles all of them in one step; this sandbox
// builds without that experiment, so it runs the scalar version.
func innerProduct(x, y []float32) float32 {
var sum float32
for i := range x {
sum += x[i] * y[i]
}
return sum
}
func main() {
x := []float32{1, 2, 3, 4, 5, 6, 7, 8}
y := []float32{8, 7, 6, 5, 4, 3, 2, 1}
fmt.Println("inner product:", innerProduct(x, y))
}
What it printed when we ran it on Go 1.27.1
inner product: 120
Run sends this program (for Solidity, the contract and its tests) to our own sandbox, where it is compiled and run once, with no network, and what it printed or the test report comes back here. Nothing is kept. Runs are counted per visitor for the day so everyone gets a turn; the details are on the legal page.
Written by gpt-oss-120b from the linked source · claims checked against the sources · human-reviewed