simd

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package simd provides vectorized kernels for hot columnar loops, each with a portable pure-Go fallback selected at build time by architecture and, on amd64, at runtime by CPU feature. The assembly is generated by avo (internal/cmd/gensimd) and committed (*_amd64.s); the pure-Go path is the reference the assembly is fuzzed against, so results are bit-identical on every platform.

Index

Constants

View Source
const EqualFixed16Width = 16

EqualFixed16Width is the fixed row width EqualFixed16 requires: both blob's rows and needle must be exactly this many bytes. It is a hardcoded property of the kernel (the AVX2 path compares a 16-byte needle broadcast into a 32-byte vector), not a parameter — a caller comparing against len(needle) or some other column's width instead of this constant is asserting the wrong thing, since neither actually guarantees the kernel's real precondition.

Variables

This section is empty.

Functions

func EqualFixed16 added in v0.32.0

func EqualFixed16(blob, needle, dst []byte)

EqualFixed16 sets dst[i] = 1 where the i-th 16-byte row of blob equals needle, else 0. len(blob) must be len(dst)*16 and len(needle) must be 16. On a CPU with AVX2 and enough rows to amortize dispatch it uses the vector kernel, else the portable reference; both agree bit-for-bit.

func MinMaxFloat64 added in v0.10.0

func MinMaxFloat64(s []float64) (mn, mx float64)

MinMaxFloat64 returns the minimum and maximum of s, ignoring NaN. An empty or all-NaN slice returns (+Inf, -Inf) — i.e. min > max — the sentinel a caller reads as "no real values". On a CPU with AVX2 and a slice long enough to amortize the dispatch it uses the vector kernel, else the portable reference; both return identical results.

func MinMaxInt64

func MinMaxInt64(s []int64) (mn, mx int64)

MinMaxInt64 returns the minimum and maximum of s (and 0, 0 for an empty slice). On a CPU with AVX2 and a slice long enough to amortize the dispatch it uses the vector kernel, else the portable reference; both return identical results.

Types

This section is empty.

Jump to

Keyboard shortcuts

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