cpu.h file
Compiled / runtime / selected ISA bits and vm_cpu_* probes.
Enums
- enum (anonymous) { VM_CPU_SCALAR = 1u << 0, VM_CPU_AVX2 = 1u << 1, VM_CPU_SVE = 1u << 2, VM_CPU_AVX512F = 1u << 3, VM_CPU_SVE2 = 1u << 4, VM_CPU_AVX = 1u << 5, VM_CPU_NEON = 1u << 6, VM_CPU_BACKEND = 1u << 7 }
Typedefs
- using vm_cpu_features_t = uint32_t
- Bit mask of compiled or detected CPU ISA features.
Functions
-
auto vm_cpu_compiled_features(void) -> vm_
cpu_ features_ t - ISA bits compiled into this library (
VECMAT_ENABLE_*). -
auto vm_cpu_runtime_features(void) -> vm_
cpu_ features_ t - ISA bits detected on this CPU (runtime probe).
-
auto vm_cpu_selected_features(void) -> vm_
cpu_ features_ t - ISA the picker bound: registered backend, else best compiled-and-runtime.
-
auto vm_cpu_name(vm_
cpu_ features_ t features) -> const char* - Short name for a feature mask (
avx2,neon,scalar, etc.). - void vm_cpu_init(void)
- Probe once and bind dispatched
_ptrnames. - 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). - static auto vm_abi_mismatch(void) -> int
- Non-zero when this TU's
VECMAT_is missing from the linked lib.FLOAT_ BITS
Enum documentation
enum (anonymous)
| Enumerators | |
|---|---|
| VM_CPU_SCALAR |
|
| VM_CPU_AVX2 |
|
| VM_CPU_SVE |
|
| VM_CPU_AVX512F |
|
| VM_CPU_SVE2 |
|
| VM_CPU_AVX |
|
| VM_CPU_NEON |
|
| VM_CPU_BACKEND |
Registered external backend with no ISA bit of its own. |
Function documentation
vm_ cpu_ features_ t vm_cpu_compiled_features(void)
ISA bits compiled into this library (VECMAT_ENABLE_*).
| 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 (runtime probe).
| Returns | Feature mask of usable backends. |
|---|
ISA bits detected on this CPU (runtime probe).
vm_ cpu_ features_ t vm_cpu_selected_features(void)
ISA the picker bound: registered backend, else best compiled-and-runtime.
| Returns | Single selected feature bit (or scalar). |
|---|
VECMAT_FORCE_ISA=scalar|avx|avx2|avx512f|neon|sve|sve2 overrides the compiled/runtime pick when that ISA is compiled in. A registered backend still wins. The override is read once, on the first probe.
ISA the picker bound: registered backend, else best compiled-and-runtime.
const char* vm_cpu_name(vm_ cpu_ features_ t features)
Short name for a feature mask (avx2, neon, scalar, etc.).
| Parameters | |
|---|---|
| features | Feature mask. |
| Returns | Stable string such as avx2 or scalar. |
Short name for a feature mask (avx2, neon, scalar, etc.).
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.
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.