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>
impl<const TILE_M: usize, const TILE_N: usize> TilingPolicy<TILE_M, TILE_N>
Sourcepub const AVX2_STANDARD: TilingPolicy<4, 4> = TilingPolicy
pub const AVX2_STANDARD: TilingPolicy<4, 4> = TilingPolicy
Standard tile for AVX2 (4 accumulators x 8 f32 lanes = 256 bits).
Sourcepub const AVX512_OPTIMAL: TilingPolicy<8, 4> = TilingPolicy
pub const AVX512_OPTIMAL: TilingPolicy<8, 4> = TilingPolicy
Optimal tile for AVX-512 (8 accumulators x 16 f32 lanes = 1024 bits).
Sourcepub const SCALAR_DEGENERATE: TilingPolicy<1, 1> = TilingPolicy
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.
Trait Implementations§
Source§impl<const TILE_M: usize, const TILE_N: usize> Clone for TilingPolicy<TILE_M, TILE_N>
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>
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)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<const TILE_M: usize, const TILE_N: usize> Copy for TilingPolicy<TILE_M, TILE_N>
impl<const TILE_M: usize, const TILE_N: usize> Eq for TilingPolicy<TILE_M, TILE_N>
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>
impl<T, Arch, Align, const TILE_M: usize, const TILE_N: usize> TilingStrategy<T, Arch, Align> for TilingPolicy<TILE_M, TILE_N>
Source§const TILE_N: usize = TILE_N
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>
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>
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>
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>
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>
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).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> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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