pub struct PlatformProfile {
pub logical_cores: usize,
pub physical_cores: usize,
pub cache_line_bytes: usize,
pub l1_cache_bytes: usize,
pub l2_cache_bytes: usize,
pub has_avx2: bool,
pub has_avx512: bool,
pub has_neon: bool,
}Expand description
Platform characteristics detected at init time.
Captures hardware topology (core counts, cache hierarchy) and SIMD capability flags for the current CPU. Used to derive optimal parallelism thresholds and tiling parameters.
Fields§
§logical_cores: usizeNumber of logical (hardware thread) cores.
physical_cores: usizeNumber of physical cores (estimated; logical/2 on x86 HT, = logical on ARM).
cache_line_bytes: usizeCache line size in bytes (typically 64 on modern CPUs).
l1_cache_bytes: usizeEstimated L1 data cache size per core in bytes.
l2_cache_bytes: usizeEstimated L2 cache size per core in bytes.
has_avx2: boolWhether AVX2 (256-bit SIMD) is available (x86-64 only).
has_avx512: boolWhether AVX-512 (512-bit SIMD) is available (x86-64 only).
has_neon: boolWhether NEON (128-bit SIMD) is available (AArch64 only).
Implementations§
Source§impl PlatformProfile
impl PlatformProfile
Sourcepub fn detect() -> Self
pub fn detect() -> Self
Detect current platform capabilities.
Uses std::thread::available_parallelism() for core counts and
compile-time/runtime feature detection for SIMD flags. Cache sizes
are estimated from typical values for the detected architecture.
Sourcepub fn global() -> &'static PlatformProfile
pub fn global() -> &'static PlatformProfile
Get the global cached platform profile (detected once, reused).
Sourcepub fn compute_thresholds(&self) -> TunedThresholds
pub fn compute_thresholds(&self) -> TunedThresholds
Compute optimal thresholds for this platform.
The logic scales parallel thresholds inversely with core count (more cores => lower threshold to engage parallelism) and sizes tiled GEMM blocks to fit in L1 cache.
Sourcepub fn global_thresholds() -> &'static TunedThresholds
pub fn global_thresholds() -> &'static TunedThresholds
Get the global cached thresholds (computed once from the global profile).
Sourcepub fn with_cores(logical: usize, physical: usize) -> Self
pub fn with_cores(logical: usize, physical: usize) -> Self
Construct a profile with explicit values (useful for testing).
Sourcepub fn with_cache(l1_bytes: usize, l2_bytes: usize) -> Self
pub fn with_cache(l1_bytes: usize, l2_bytes: usize) -> Self
Construct a profile with custom cache sizes (useful for testing).
Trait Implementations§
Source§impl Clone for PlatformProfile
impl Clone for PlatformProfile
Source§fn clone(&self) -> PlatformProfile
fn clone(&self) -> PlatformProfile
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for PlatformProfile
impl RefUnwindSafe for PlatformProfile
impl Send for PlatformProfile
impl Sync for PlatformProfile
impl Unpin for PlatformProfile
impl UnsafeUnpin for PlatformProfile
impl UnwindSafe for PlatformProfile
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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