Microkernel

Trait Microkernel 

Source
pub trait Microkernel<T: TropicalSemiring> {
    const MR: usize;
    const NR: usize;

    // Required method
    unsafe fn execute(
        &self,
        mr: usize,
        nr: usize,
        k: usize,
        a: *const T::Scalar,
        b: *const T::Scalar,
        c: *mut T,
        ldc: usize,
    );
}
Expand description

Trait for GEMM microkernels.

A microkernel computes a small block of C += A * B using register blocking. The dimensions mr x nr define the “register tile” that fits in CPU registers.

Required Associated Constants§

Source

const MR: usize

Rows of the microkernel (typically 4-8 for f32).

Source

const NR: usize

Columns of the microkernel (typically 4-8 for f32).

Required Methods§

Source

unsafe fn execute( &self, mr: usize, nr: usize, k: usize, a: *const T::Scalar, b: *const T::Scalar, c: *mut T, ldc: usize, )

Execute the microkernel.

Computes C[0..mr, 0..nr] = A[0..mr, 0..k] ⊗ B[0..k, 0..nr] where the result is combined with existing C values using tropical addition.

§Safety
  • a must point to at least mr * k elements (packed column-major)
  • b must point to at least k * nr elements (packed row-major)
  • c must point to at least mr * ldc elements
  • mr <= Self::MR and nr <= Self::NR

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§