Proposals Unofficial Go proposal tracker

Add portable, vector-size agnostic simd package (experimental)

#78902 · simd · medium impact · Accepted ·

Go's existing SIMD support (simd/archsimd) is tied to a specific architecture and vector width, such as Float32x8 on amd64. This proposal adds a portable simd package under a GOEXPERIMENT. Its vector types have no fixed length: Int8s, Uint32s, Float64s, and so on, with masks Mask8s through Mask64s. At run time the package uses the largest vector size the CPU supports, such as AVX, AVX2, or AVX-512 on amd64, and reports it via VectorSize(). On architectures without SIMD support, it falls back to an emulation.

The initial API is the intersection of the amd64 and wasm SIMD APIs:

  • slice loads and stores;
  • arithmetic;
  • bitwise ops, shifts, min and max;
  • comparisons that return masks;
  • masking;
  • conversions.
func addScaled(dst, a, b []float32, k float32) {
    n := simd.LoadFloat32Slice(a).Len()
    // ... broadcast k into kv, loop in steps of n:
    x := simd.LoadFloat32Slice(a[i:])
    y := simd.LoadFloat32Slice(b[i:])
    x.MulAdd(kv, y).StoreSlice(dst[i:])
}

The compiler compiles SIMD-dependent code once per CPU variant and selects the right version at run time.

Proposal
#78902 by dr2chase
Status
Accepted on May 20, 2026
Impact
medium
Area
simd