pub struct CpuFeatures {
pub tier: CpuTier,
pub avx2: bool,
pub fma: bool,
pub avx512f: bool,
pub avx512bw: bool,
pub avx512vl: bool,
pub avx512vnni: bool,
pub neon: bool,
pub dotprod: bool,
pub i8mm: bool,
pub fp16: bool,
}Expand description
Resolved CPU capabilities for this host.
tier is the selection the dispatchers act on (capped at implemented
kernels); the individual bools are the raw detection results.
Fields§
§tier: CpuTierBest tier cera has kernels for on this host (see module docs).
avx2: boolAVX2 (256-bit integer and float SIMD).
fma: boolFused multiply-add.
avx512f: boolAVX-512 foundation.
avx512bw: boolAVX-512 byte and word instructions.
avx512vl: boolAVX-512 vector-length extensions.
avx512vnni: boolAVX-512 VNNI (dpbusd, the int8 dot product).
neon: boolNEON. Mandatory on aarch64; probed anyway for honest reporting.
dotprod: boolFEAT_DotProd (sdot/udot), ARMv8.2.
i8mm: boolFEAT_I8MM (smmla), ARMv8.6.
fp16: boolFEAT_FP16. Needed only to declare what simd::neon::f16_bits_to_f32
uses: core::arch’s vcvt_f32_f16 is gated neon,fp16 because its
operand type is float16x4_t, even though the FCVTL it lowers to is
baseline ARMv8.0-A and cannot trap on any AArch64 core. Detected so the
declaration is honest rather than relying on FEAT_I8MM (v8.6) implying
FEAT_FP16 (v8.2), the same reason the i8mm parity test gates on dotprod
instead of leaning on i8mm implying it.
Implementations§
Source§impl CpuFeatures
impl CpuFeatures
Sourcepub fn report(&self) -> String
pub fn report(&self) -> String
Human-readable one-line summary for CLI inspect / bug reports, e.g.
cpu: tier=avx2 [avx2 fma] or cpu: tier=neon+dotprod [neon dotprod fp16].
Shares active_flags with Self::descriptor, so it moves whenever that
list gains an entry.
Sourcepub fn descriptor(&self) -> String
pub fn descriptor(&self) -> String
Compact CPU-variant descriptor for telemetry: the active SIMD features
joined by commas, e.g. "neon,dotprod,i8mm,fp16" or "avx2,fma",
falling back to the tier label (e.g. "scalar") when no accelerated
features are present. Deterministic on a given host, so it can key a
benchmark submission’s CPU-variant field (the analog of llama.cpp’s ggml
CPU-backend descriptor).
Stable for a given set of detected features, not across cera
versions: adding a flag to active_flags changes the string for every
host that reports it. That happened once already, when fp16 was added,
which moved it on every aarch64 host from v8.2 on (so, in practice, all
of them except pre-FEAT_FP16 parts like Cortex-A53/A72). Treat the
descriptor as a grouping key within a release rather than a join key
across them.
Sourcepub fn ensure_supported(&self) -> Result<(), String>
pub fn ensure_supported(&self) -> Result<(), String>
Verify the host can safely run cera’s compiled kernels.
Every aarch64 GEMV/GEMM entry point in super::simd::neon now runtime-
dispatches between its dotprod kernel and a plain-NEON fallback, so
dotprod is an accelerator rather than a hard requirement and NEON
(mandatory on aarch64) is always sufficient. x86_64 always has a scalar
fallback. This is therefore a no-op today, kept as the hook for any
future hard ISA requirement.
Trait Implementations§
Source§impl Clone for CpuFeatures
impl Clone for CpuFeatures
Source§fn clone(&self) -> CpuFeatures
fn clone(&self) -> CpuFeatures
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for CpuFeatures
Source§impl Debug for CpuFeatures
impl Debug for CpuFeatures
impl Eq for CpuFeatures
Source§impl PartialEq for CpuFeatures
impl PartialEq for CpuFeatures
impl StructuralPartialEq for CpuFeatures
Auto Trait Implementations§
impl Freeze for CpuFeatures
impl RefUnwindSafe for CpuFeatures
impl Send for CpuFeatures
impl Sync for CpuFeatures
impl Unpin for CpuFeatures
impl UnsafeUnpin for CpuFeatures
impl UnwindSafe for CpuFeatures
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more