cpu.c file
Functions
- void vm_dispatch_init32(void)
-
auto vm_backend_best32(void) -> const vm_
backend* - void vm_dispatch_init64(void)
-
auto vm_backend_best64(void) -> const vm_
backend* -
static auto vm_force_isa(void) -> vm_
cpu_ features_ t - static auto vm_cpu_probe_neon(void) -> int
- Probes AArch64 Advanced SIMD (NEON).
- static auto vm_cpu_probe_sve(void) -> int
- Probes SVE via Linux AT_HWCAP.
- static auto vm_cpu_probe_sve2(void) -> int
- Probes SVE2 via Linux AT_HWCAP2.
-
auto vm_cpu_compiled_features(void) -> vm_
cpu_ features_ t - ISA bits compiled into this binary.
-
auto vm_cpu_runtime_features(void) -> vm_
cpu_ features_ t - ISA bits detected on this CPU (cached).
-
auto vm_cpu_selected_features(void) -> vm_
cpu_ features_ t - Highest-priority ISA that is both compiled and present.
-
auto vm_cpu_name(const vm_
cpu_ features_ t features) -> const char* - Short name of the highest bit set in
features. - auto vm_cpu_note(void) -> const char*
- Optional one-line note set by a registered module.
- void vm_cpu_set_note(const char* note)
- Attach a module note for banners.
- auto vm_compiled_float_bits(void) -> unsigned
- Float widths compiled into this library (
32,64, or32|64). - void vm_cpu_init(void)
- Probe once and bind dispatched
_ptrnames.
Variables
-
static vm_
cpu_ features_ t runtime_cache - static const char* module_note
- static atomic_int runtime_cached
- static atomic_flag runtime_lock
Defines
- #define VM_CPU_BACKEND_BEST
Function documentation
static int vm_cpu_probe_neon(void)
Probes AArch64 Advanced SIMD (NEON).
| Returns | Non-zero if NEON / ASIMD is usable. |
|---|
ASIMD is mandatory on AArch64, so non-Linux targets (Apple, BSD, Windows) report it as present. Linux still consults AT_HWCAP.
static int vm_cpu_probe_sve2(void)
Probes SVE2 via Linux AT_HWCAP2.
| Returns | Non-zero if SVE2 is usable. |
|---|
vm_ cpu_ features_ t vm_cpu_compiled_features(void)
ISA bits compiled into this binary.
| Returns | Feature mask of enabled backends. |
|---|
ISA bits compiled into this library (VECMAT_ENABLE_*).
vm_ cpu_ features_ t vm_cpu_runtime_features(void)
ISA bits detected on this CPU (cached).
| Returns | Feature mask of usable backends. |
|---|
ISA bits detected on this CPU (runtime probe).
vm_ cpu_ features_ t vm_cpu_selected_features(void)
Highest-priority ISA that is both compiled and present.
| Returns | Single selected feature bit (or scalar). |
|---|
ISA the picker bound: registered backend, else best compiled-and-runtime.
const char* vm_cpu_name(const vm_ cpu_ features_ t features)
Short name of the highest bit set in features.
| Parameters | |
|---|---|
| features | Feature mask. |
| Returns | Stable string such as avx2 or scalar. |
Short name for a feature mask (avx2, neon, scalar, etc.).
const char* vm_cpu_note(void)
Optional one-line note set by a registered module.
NULL until a module calls vm_. The pointer is not copied.
void vm_cpu_init(void)
Probe once and bind dispatched _ptr names.
Thread-safe and idempotent (C11 atomics, double-checked locking). Call before reading vm_ if you care about the first-use race; kernels themselves call this on first use.