← OpenFluke

Chapter 6

simd — Plan 9 kernels

github.com/openfluke/welvet/simd


Why it exists

CPU peak needs hand-written AVX2/NEON without a silent Go fallback that pretends SIMD ran.

What it is

amd64/arm64 .s kernels: DotTile, DotI8/U8, DotQ4_0, Saxpy, BitNet helpers, packed f16/bf16/fp8/fp4 dots. SimdEnabled() false → BackendSIMD hard-errors.

Go example

examples/06-simd/main.go

Run:cd welvet/examples/06-simd && source ../env.sh && go run .
package main

import (
	"fmt"

	"github.com/openfluke/welvet/simd"
)

func main() {
	if !simd.SimdEnabled() {
		fmt.Println("SIMD not available on this arch — BackendSIMD must hard-error")
		return
	}
	acc := simd.DotTile([]float32{1, 2, 3, 4}, []float32{1, 1, 1, 1}, 0, 4, 0)
	fmt.Println(acc)
}

Output

exit 0 · last run via go run .

10