Platform-independent SIMD in Go(go.dev)
402 points by yurivish 18 days ago | 146 comments
tl;dr: Go 1.27 introduces an experimental `simd` package that provides a portable, platform- and vector-size-agnostic SIMD API, complementing the architecture-specific `archsimd` packages added in 1.26/1.27. It exposes the intersection of operations across AVX/AVX2/AVX512, NEON, and wasm SIMD, filling gaps with efficient emulation, and allows escape hatches to architecture-specific code via `ToArch()`/`FromArch()`. Future releases plan to add SVE support, reduction and shuffle operations, and finer-grained feature variants for hardware like Raspberry Pi that lacks specific instructions.
HN Discussion:
  • ↑Benchmarks confirm portable SIMD delivers major speedups with small overhead vs architecture-specific SIMD
  • ↑Praise for supporting non-fixed vector architectures like SVE and RVV in the design
  • ↑Enthusiasm for Go adding SIMD as a low-hanging performance win comparable to other languages
  • ~Autovectorization is often good enough, so this doesn't fully close the gap with C/C++
  • •Confusion or question about how the compiler efficiently specializes the type switch