Hand-written NASM dense float kernels with runtime ISA dispatch (optional calibration). C API + thin C++ wrapper.
Cross-platform x86_64: Windows (Win64 ABI), Linux/macOS (System V).
- Detect CPU/OS features (CPUID + XGETBV).
avx512iclonly on GenuineIntel + FMA + VNNI + VBMI2. - Default AUTO = highest supported ISA (
icl > avx512 > avx2 > scalar). Instant, no heap spike. - Optional
vecasm_calibrate()builds a{op,tier}timing table and switches toVECASM_DISPATCH_CALIBRATED(~0.5s / up to ~192 MiB). Never runs by itself. - Hot path:
vecasm_resolve_*/vecasm_resolve_densereturn direct function pointers (no per-call atomics).
vecasm_set_dispatch(VECASM_DISPATCH_ISA); /* default, good for games */
vecasm_dense_fns fn;
vecasm_resolve_dense(&fn, n);
for (;;)
acc += fn.dot(a, b, n);
/* optional offline tune */
vecasm_calibrate();| Kernel | Meaning |
|---|---|
vecasm_dot_f32 / sum / axpy / norm2 |
dense (dispatched each call) |
vecasm_resolve_dot/sum/axpy / resolve_dense |
bind kernel once |
vecasm_dot3_f32 / cross3 / normalize3 |
vec3 |
vecasm_set_dispatch / calibrate |
ISA vs calibrated |
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build build
./build/vecasm_test_dot
./build/vecasm_bench_dotvecasm Attribution License (LICENSE + NOTICE).
Credit: LucPrusPPi (https://github.com/LucPrusPPi/vecasm). Do not hide origin.