Skip to main content

CpuFeatures

Struct CpuFeatures 

Source
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: CpuTier

Best tier cera has kernels for on this host (see module docs).

§avx2: bool

AVX2 (256-bit integer and float SIMD).

§fma: bool

Fused multiply-add.

§avx512f: bool

AVX-512 foundation.

§avx512bw: bool

AVX-512 byte and word instructions.

§avx512vl: bool

AVX-512 vector-length extensions.

§avx512vnni: bool

AVX-512 VNNI (dpbusd, the int8 dot product).

§neon: bool

NEON. Mandatory on aarch64; probed anyway for honest reporting.

§dotprod: bool

FEAT_DotProd (sdot/udot), ARMv8.2.

§i8mm: bool

FEAT_I8MM (smmla), ARMv8.6.

§fp16: bool

FEAT_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

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> CpuFeatures

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for CpuFeatures

Source§

impl Debug for CpuFeatures

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for CpuFeatures

Source§

impl PartialEq for CpuFeatures

Source§

fn eq(&self, other: &CpuFeatures) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for CpuFeatures

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more