Skip to main content

Crate simd

Crate simd 

Source

Structs§

Avx2
Portable pair of 128-bit lanes, useful for AVX2-equivalent conformance tests.
Scalar
Portable 128-bit register backend, the first WebAssembly baseline.
Scalar256
Portable pair of 128-bit lanes, useful for AVX2-equivalent conformance tests.
Sse2
Portable 128-bit register backend, the first WebAssembly baseline.

Constants§

CPU_AVX2
Native AVX2 capability bit; never advertised by the scalar browser backend.

Traits§

Kernel
a computation written once for every instruction set
Simd
operations of one register type; integer lanes are named by their width (8 / 16 / 32), signed operations end in s, unsigned in u

Functions§

copy_stream
copy src into dst (the shorter length) with non-temporal stores where the target has them (x86-64: the 16-byte aligned part of dst): dst is neither read first nor pulled into the caches, which keep what the thread works on. Ends with the fence the stores need (sfence) before anything touches dst again; copy_stream_rows fences a block of rows once.
copy_stream_rows
copy_stream for rows rows of width bytes: row y of src starts at y * src_stride, of dst at y * dst_stride; one fence at the end. Panics when a row lies outside its slice.
dispatch
Run a kernel with NEON on ARM64, with SIMD128 when enabled by the WASM bundle, otherwise scalar registers.
dispatch_sse2
run k with SSE2 (the baseline; tests compare it with dispatch)
has_avx2
AVX2 kernels may be used (CPU and OS support, not disabled by --simd sse2)
stream_fence
the streaming stores of this thread become visible to others (sfence); copy_stream and copy_stream_rows run it themselves. Nothing to do on other targets: without such stores the release of whatever hands dst on is enough