Hasty Briefsbeta

Bilingual

Platform-Independent SIMD in Go

10 hours ago
  • Go 1.26 and 1.27 introduce experimental SIMD APIs, starting with amd64 and expanding to arm64 and wasm.
  • A new portable simd package provides a platform-agnostic interface for SIMD operations, based on Highway for C++.
  • The simd package abstracts vector size, masking, and operation differences across architectures, with emulation for unsupported platforms.
  • Supported architectures include amd64 (AVX, AVX2, AVX512), arm64 (NEON), and wasm, with emulation for others.
  • Vector types are named like simd.Float32s, and operations include load/store, arithmetic, comparisons, conversions, and more.
  • GODEBUG settings (simd=0,128,256,512) allow testing with different SIMD levels or emulation.
  • Implementation uses AST rewriting in the compiler to create specialized copies for each vector length.
  • Future plans include adding SVE support, more operations (e.g., OnesCount, reduction), and feature variants.