Skip to main content

CpuLevel

Enum CpuLevel 

Source
#[non_exhaustive]
pub enum CpuLevel { Scalar, X86V2, X86V3, X86V4, Neon, NeonDotprod, NeonI8mm, Native, }
Expand description

CPU feature level for SIMD dispatch control.

Controls which instruction sets the decoder is allowed to use at runtime. Higher levels include all instructions from lower levels. Setting a level that isn’t available on the current hardware is safe — it falls back to the highest available level below it.

Use CpuLevel::platform_levels() to discover which levels are testable on the current hardware.

§Example

use rav1d_safe::src::managed::{Decoder, Settings, CpuLevel};

// Force scalar-only decode (no SIMD)
let mut decoder = Decoder::with_settings(Settings {
    cpu_level: CpuLevel::Scalar,
    ..Default::default()
}).unwrap();

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Scalar

No SIMD — pure scalar Rust. Works on all platforms. Slowest.

§

X86V2

x86-64-v2: SSE2 + SSSE3 + SSE4.1. Baseline for most x86-64 CPUs since ~2008.

§

X86V3

x86-64-v3: V2 + AVX2 + FMA. Haswell (2013) and newer. This is the primary SIMD path for rav1d-safe.

§

X86V4

x86-64-v4: V3 + AVX-512 (Ice Lake subset). Ice Lake (2019) and newer. Only used for a few functions in rav1d.

§

Neon

ARM NEON baseline (mandatory on AArch64).

§

NeonDotprod

ARM NEON + dot product instructions (ARMv8.2+).

§

NeonI8mm

ARM NEON + i8mm instructions (ARMv8.6+).

§

Native

Use all features detected at runtime. Default.

Implementations§

Source§

impl CpuLevel

Source

pub const fn to_mask(self) -> u32

Convert to the raw bitmask for rav1d_set_cpu_flags_mask.

On a platform where the level doesn’t apply (e.g. X86V3 on ARM), returns 0 (scalar).

Source

pub fn platform_levels() -> &'static [CpuLevel]

List all CPU levels relevant to the current platform, from most restrictive (Scalar) to least restrictive (Native).

Only includes levels that differ in behavior on this platform. For example, on x86_64 this returns [Scalar, X86V2, X86V3, X86V4, Native].

Source

pub const fn name(self) -> &'static str

Short human-readable name for this level.

Trait Implementations§

Source§

impl Clone for CpuLevel

Source§

fn clone(&self) -> CpuLevel

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for CpuLevel

Source§

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

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

impl Default for CpuLevel

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for CpuLevel

Source§

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

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

impl Hash for CpuLevel

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for CpuLevel

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for CpuLevel

Source§

impl Eq for CpuLevel

Source§

impl StructuralPartialEq for CpuLevel

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, 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> To for T
where T: ?Sized,

Source§

fn to<T>(self) -> T
where Self: Into<T>,

Converts to T by calling Into<T>::into.
Source§

fn try_to<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Tries to convert to T by calling TryInto<T>::try_into.
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.