Module simd::cpu
which SIMD instruction sets the CPU runs.
std's hot kernels (sgemm, vmath, the FFT butterflies, dsp_dot_f64) are built in several versions and use the best one this returns, in order:
x86-64 AVX-512 (F+BW+DQ+VL) > AVX2 + FMA > AVX > SSE4.1 > SSE2
AArch64 SVE > Neon
Cortex-M Helium (MVE) > DSP extension -- compile time only: pick
the target (arm-81m for Helium, arm-7em / arm-8m for DSP)
WebAssembly SIMD128 when built with it
On x86-64 and AArch64 Linux the level is detected once at run time (cpuid + xgetbv / getauxval), so one binary uses AVX-512 where it exists and still runs on an SSE2-only CPU. Whatever the build already guarantees (e.g. --target-cpu=native defines AVX2) is the floor. SAFEC_SIMD=sse2|sse4.1|avx|avx2|avx512|neon|sve caps the level, to test or compare the slower paths.
Functions
| simd_level | The best level available (detected once, then cached). |
| simd_level_name | "AVX-512", "AVX2", ..., "scalar". |
Macros
| SIMD_SCALAR | |
| SIMD_SSE2 | |
| SIMD_SSE41 | |
| SIMD_AVX | |
| SIMD_AVX2 | AVX2 + FMA |
| SIMD_AVX512 | AVX-512 F, BW, DQ and VL |
| SIMD_NEON | |
| SIMD_SVE | |
| SIMD_DSP | Cortex-M DSP extension |
| SIMD_HELIUM | Cortex-M MVE |
| SIMD_WASM128 |