Radar · Go · #002 · Week 40 · Sep 28 – Oct 4, 2026
Arch‑specific SIMD vector APIs (experimental)
Worth knowingstdlib
- What changed
- Go 1.27 introduces experimental arch‑specific SIMD vector APIs.
- Production impact
- The source does not say.
- Try it
- Build a program that imports the new SIMD package and runs on a supported architecture.
- Source
- go.dev/blog/archsimd
Understand it, then run it
Run it now
package main
import "fmt"
// This program demonstrates how you would add two float32 slices
// without the experimental archsimd package, which is not available
// in Go 1.27.1. It uses a plain loop as a fallback.
func addFloat32(a, b []float32) []float32 {
if len(a) != len(b) {
panic("slice length mismatch")
}
out := make([]float32, len(a))
for i := range a {
out[i] = a[i] + b[i]
}
return out
}
func main() {
x := []float32{1.0, 2.0, 3.0, 4.0}
y := []float32{5.0, 6.0, 7.0, 8.0}
z := addFloat32(x, y)
fmt.Println("result:", z) // prints [6 8 10 12]
}
What it printed when we ran it on Go 1.27.1
result: [6 8 10 12]
After the change ships
go · the proposal's code; it does not compile until the change ships
// Does not compile until the experimental archsimd API ships.
package main
import (
"fmt"
"simd/archsimd"
)
func main() {
// Enable the SIMD experiment when building:
// GOEXPERIMENT=simd go run .
x := []float32{1, 2, 3, 4}
y := []float32{5, 6, 7, 8}
// Load full vectors (4 × float32 fits Float32x4)
a := archsimd.LoadFloat32x4(x)
b := archsimd.LoadFloat32x4(y)
// Perform element‑wise addition; the method name is the same on all architectures.
c := a.Add(b)
// Store the result back to a slice.
out := make([]float32, 4)
c.Store(out)
fmt.Println("result:", out) // expected: [6 8 10 12]
}
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