pub struct SimdPolicy { /* private fields */ }Expand description
SIMD policy based on environment variables
Respects GLIBC_TUNABLES environment variable to disable specific CPU features. This is used by GNU utilities to allow users to disable hardware acceleration.
Implementations§
Source§impl SimdPolicy
impl SimdPolicy
Sourcepub fn detect() -> &'static Self
pub fn detect() -> &'static Self
Get the global SIMD policy (cached)
This checks both hardware capabilities and the GLIBC_TUNABLES environment variable. The result is cached for the lifetime of the process.
§Examples
use uucore::hardware::SimdPolicy;
let policy = SimdPolicy::detect();
if policy.allows_simd() {
println!("SIMD is enabled");
} else {
println!("SIMD disabled by: {:?}", policy.disabled_features());
}pub fn allows_simd(&self) -> bool
pub fn disabled_features(&self) -> Vec<HardwareFeature>
Trait Implementations§
Source§impl Clone for SimdPolicy
impl Clone for SimdPolicy
Source§fn clone(&self) -> SimdPolicy
fn clone(&self) -> SimdPolicy
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SimdPolicy
impl Debug for SimdPolicy
Source§impl HasHardwareFeatures for SimdPolicy
impl HasHardwareFeatures for SimdPolicy
fn has_feature(&self, feat: HardwareFeature) -> bool
fn iter_features(&self) -> impl Iterator<Item = HardwareFeature>
Source§fn has_avx512(&self) -> bool
fn has_avx512(&self) -> bool
Check if AVX-512 is available (x86/x86_64 only)
Source§fn has_pclmul(&self) -> bool
fn has_pclmul(&self) -> bool
Check if PCLMULQDQ is available (x86/x86_64 only)
Auto Trait Implementations§
impl Freeze for SimdPolicy
impl RefUnwindSafe for SimdPolicy
impl Send for SimdPolicy
impl Sync for SimdPolicy
impl Unpin for SimdPolicy
impl UnwindSafe for SimdPolicy
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)