simd

package module
v0.0.0-...-4d1dbfa Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2026 License: MIT Imports: 0 Imported by: 0

README

SIMD experiment (Go 1.26+)

This package requires Go 1.26 with GOEXPERIMENT=simd and amd64.

See benchmarks.

CPU compatibility (avoiding SIGILL)

If you see SIGILL: illegal instruction when running tests, the CPU or VM does not support the SIMD instructions used by that code.

Check support on Linux
# List SIMD-related flags
grep -E 'avx' /proc/cpuinfo

# Or with lscpu
lscpu | grep -i avx

Rough mapping:

Tests / code Required flag(s) Typical CPUs
AVX (128-bit) avx (baseline on amd64) All amd64
AVX2 (256-bit) avx2 Intel Haswell+, AMD Excavator+
AVX-512 (512-bit) avx512f Intel Skylake-X+, some Xeons; many AMD/consumer CPUs do not have it
What the tests do
  • AVX tests (128-bit) call requireAVX(t) and are skipped if the CPU does not support AVX.
  • AVX2 tests call requireAVX2(t) and are skipped if the CPU does not support AVX2 (no SIGILL).
  • AVX-512 tests (when enabled) should call requireAVX512(t) and skip when AVX-512 is not available.

So on a machine without AVX2, AVX2 tests will show as skipped instead of crashing.

Run only AVX tests

If your environment does not support AVX2/AVX-512, you can still run the AVX (128-bit) tests:

GOEXPERIMENT=simd go test -run AVX ./...

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL