Skip to main content

TilingPolicy

Struct TilingPolicy 

Source
pub struct TilingPolicy<const TILE_M: usize, const TILE_N: usize>;
Expand description

Zero-sized strategy marker for tiled execution policy.

Encode tile shape in the type system as a ZST so tiling parameters are resolved at compile time with no runtime storage.

§Examples

Dot product via the tiled_dot free function (preferred API):

use hermes_simd_core::tiling::tiled_dot;
use hermes_simd_core::view::SimdView;
use hermes_simd_core::align::Unaligned;
use hermes_simd_intrinsics::Scalar;

let a = [1.0_f32, 2.0, 3.0, 4.0];
let b = [1.0_f32, 1.0, 1.0, 1.0];
let va = SimdView::<f32, Scalar, Unaligned>::new(&a).unwrap();
let vb = SimdView::<f32, Scalar, Unaligned>::new(&b).unwrap();
// TILE_M = 4 unrolls into 4 independent FMA accumulators.
let result = tiled_dot::<f32, Scalar, Unaligned, 4>(&va, &vb).unwrap();
assert!((result - 10.0_f32).abs() < 1e-6);

Implementations§

Source§

impl<const TILE_M: usize, const TILE_N: usize> TilingPolicy<TILE_M, TILE_N>

Source

pub const AVX2_STANDARD: TilingPolicy<4, 4> = TilingPolicy

Standard tile for AVX2 (4 accumulators x 8 f32 lanes = 256 bits).

Source

pub const AVX512_OPTIMAL: TilingPolicy<8, 4> = TilingPolicy

Optimal tile for AVX-512 (8 accumulators x 16 f32 lanes = 1024 bits).

Source

pub const SCALAR_DEGENERATE: TilingPolicy<1, 1> = TilingPolicy

Scalar degenerate tile: TILE_M = 1, TILE_N = 1 — no tiling overhead.

Named SCALAR_DEGENERATE (SCREAMING_SNAKE_CASE) to satisfy Rust naming lints.

Source

pub const fn validate(&self)

Verify that the tile shape is valid at compile time.

Trait Implementations§

Source§

impl<const TILE_M: usize, const TILE_N: usize> Clone for TilingPolicy<TILE_M, TILE_N>

Source§

fn clone(&self) -> TilingPolicy<TILE_M, TILE_N>

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<const TILE_M: usize, const TILE_N: usize> Copy for TilingPolicy<TILE_M, TILE_N>

Source§

impl<const TILE_M: usize, const TILE_N: usize> Debug for TilingPolicy<TILE_M, TILE_N>

Source§

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

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

impl<const TILE_M: usize, const TILE_N: usize> Eq for TilingPolicy<TILE_M, TILE_N>

Source§

impl<const TILE_M: usize, const TILE_N: usize> PartialEq for TilingPolicy<TILE_M, TILE_N>

Source§

fn eq(&self, other: &TilingPolicy<TILE_M, TILE_N>) -> bool

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

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

Inequality operator !=. Read more
Source§

impl<const TILE_M: usize, const TILE_N: usize> StructuralPartialEq for TilingPolicy<TILE_M, TILE_N>

Source§

impl<T, Arch, Align, const TILE_M: usize, const TILE_N: usize> TilingStrategy<T, Arch, Align> for TilingPolicy<TILE_M, TILE_N>
where Arch: SimdArch + SimdKernel<T>, Align: Alignment, T: Scalar,

Source§

const TILE_M: usize = TILE_M

The number of rows in the register block.
Source§

const TILE_N: usize = TILE_N

The number of columns (vectors of size LANE_COUNT) in the register block.
Source§

fn gemm( a: &SimdView<'_, T, Arch, Align>, b: &SimdView<'_, T, Arch, Align>, c: &mut [T], m: usize, n: usize, k: usize, ) -> Result<(), SimdError>

Perform tiled matrix multiplication c += a * b using this strategy.
Source§

fn gemv( a: &SimdView<'_, T, Arch, Align>, x: &SimdView<'_, T, Arch, Align>, y: &mut [T], nrows: usize, ncols: usize, ) -> Result<(), SimdError>

Perform tiled matrix-vector multiplication y += A * x using this strategy.
Source§

fn gemv_transpose( a: &SimdView<'_, T, Arch, Align>, x: &SimdView<'_, T, Arch, Align>, y: &mut [T], nrows: usize, ncols: usize, ) -> Result<(), SimdError>

Perform tiled transposed matrix-vector multiplication y += Aᵀ * x (A row-major nrows × ncols, x length nrows, y length ncols).
Source§

fn gemv_strided( a: &SimdView<'_, T, Arch, Align>, x: &SimdView<'_, T, Arch, Align>, y: &mut [T], nrows: usize, ncols: usize, lda: usize, ) -> Result<(), SimdError>

Perform tiled matrix-vector multiplication y += A * x over a row-major sub-matrix: nrows × ncols with row stride lda ≥ ncols (lda = ncols is the packed Self::gemv).
Source§

fn gemv_transpose_strided( a: &SimdView<'_, T, Arch, Align>, x: &SimdView<'_, T, Arch, Align>, y: &mut [T], nrows: usize, ncols: usize, lda: usize, ) -> Result<(), SimdError>

Perform tiled transposed matrix-vector multiplication y += Aᵀ * x over a row-major sub-matrix: nrows × ncols with row stride lda ≥ ncols (lda = ncols is the packed Self::gemv_transpose).
Source§

fn dot( a: &SimdView<'_, T, Arch, Align>, b: &SimdView<'_, T, Arch, Align>, ) -> Result<T, SimdError>

Perform tiled dot product computation using this strategy.

Auto Trait Implementations§

§

impl<const TILE_M: usize, const TILE_N: usize> Freeze for TilingPolicy<TILE_M, TILE_N>

§

impl<const TILE_M: usize, const TILE_N: usize> RefUnwindSafe for TilingPolicy<TILE_M, TILE_N>

§

impl<const TILE_M: usize, const TILE_N: usize> Send for TilingPolicy<TILE_M, TILE_N>

§

impl<const TILE_M: usize, const TILE_N: usize> Sync for TilingPolicy<TILE_M, TILE_N>

§

impl<const TILE_M: usize, const TILE_N: usize> Unpin for TilingPolicy<TILE_M, TILE_N>

§

impl<const TILE_M: usize, const TILE_N: usize> UnsafeUnpin for TilingPolicy<TILE_M, TILE_N>

§

impl<const TILE_M: usize, const TILE_N: usize> UnwindSafe for TilingPolicy<TILE_M, TILE_N>

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> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
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> CastTo for T
where T: Copy,

Source§

fn cast_to<U>(self) -> U
where U: CastFrom<Self>,

Cast self to type U.
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<F, W, T, D> Deserialize<With<T, W>, D> for F
where W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

Source§

fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
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> Pointee for T

Source§

type Metadata = ()

The type for metadata in pointers and references to Self.
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 = 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.