pub struct HwModel {
pub neon_flops: f64,
pub blas_flops: f64,
pub blas_overhead_ns: f64,
pub par_for_overhead_ns: f64,
pub l1_bytes: usize,
pub l2_bytes: usize,
pub mem_bw: f64,
pub num_threads: usize,
}Expand description
Hardware model — derived from RuntimeConfig + platform detection.
Fields§
§neon_flops: f64NEON throughput: FLOP/s for element-wise (FMA chains)
blas_flops: f64BLAS throughput: FLOP/s for sgemm (AMX or optimized NEON)
blas_overhead_ns: f64BLAS call overhead in nanoseconds (function call + AMX sync)
par_for_overhead_ns: f64par_for dispatch overhead in nanoseconds
l1_bytes: usizeL1 data cache size in bytes
l2_bytes: usizeL2 cache size in bytes
mem_bw: f64Memory bandwidth (L2 → registers) in bytes/ns
num_threads: usizeNumber of worker threads
Implementations§
Source§impl HwModel
impl HwModel
Sourcepub fn from_config(cfg: &RuntimeConfig) -> Self
pub fn from_config(cfg: &RuntimeConfig) -> Self
Build from runtime config and platform defaults.
Sourcepub fn prefer_neon_sgemm(&self, m: usize, k: usize, n: usize) -> bool
pub fn prefer_neon_sgemm(&self, m: usize, k: usize, n: usize) -> bool
Should we use NEON sgemm instead of BLAS for this matrix multiply? Returns true when BLAS overhead dominates the compute.
Sourcepub fn prefer_parallel(
&self,
total_elements: usize,
cost_per_element_ns: f64,
) -> bool
pub fn prefer_parallel( &self, total_elements: usize, cost_per_element_ns: f64, ) -> bool
Should we use par_for for this element-wise operation? Returns true when parallelism benefit exceeds dispatch overhead.
Auto Trait Implementations§
impl Freeze for HwModel
impl RefUnwindSafe for HwModel
impl Send for HwModel
impl Sync for HwModel
impl Unpin for HwModel
impl UnsafeUnpin for HwModel
impl UnwindSafe for HwModel
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
Mutably borrows from an owned value. Read more
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>
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 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>
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