pub struct Gemm<'a> {
pub x: &'a [f32],
pub m: usize,
pub k: usize,
pub w: &'a [f32],
pub n: usize,
pub b: Option<&'a [f32]>,
pub ep: Epilogue,
}Expand description
One GEMM with its epilogue, y = ep(x wᵀ + b), split into tiles that any thread may run.
Every output element is computed the same way whatever the split, so the split is free to
follow the thread count.
Fields§
§x: &'a [f32][m, k].
m: usizeRows of x and y.
k: usizeThe reduction length.
w: &'a [f32][n, k] as pack lays it out.
n: usizeColumns of y.
b: Option<&'a [f32]>[n].
ep: EpilogueWhat happens to each result.
Implementations§
Source§impl Gemm<'_>
impl Gemm<'_>
Sourcepub fn run(
&self,
y: &mut [f32],
threads: usize,
spawn: impl FnOnce(usize, &(dyn Fn(usize, &mut [f32]) + Sync)),
)
pub fn run( &self, y: &mut [f32], threads: usize, spawn: impl FnOnce(usize, &(dyn Fn(usize, &mut [f32]) + Sync)), )
Runs the GEMM into y, handing spawn a task count and the task body to run for each.
A task gets scratch_len floats of scratch of its own.
§Panics
If a length does not match the shape.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Gemm<'a>
impl<'a> RefUnwindSafe for Gemm<'a>
impl<'a> Send for Gemm<'a>
impl<'a> Sync for Gemm<'a>
impl<'a> Unpin for Gemm<'a>
impl<'a> UnsafeUnpin for Gemm<'a>
impl<'a> UnwindSafe for Gemm<'a>
Blanket Implementations§
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