Skip to main content

KernelDispatch

Trait KernelDispatch 

Source
pub trait KernelDispatch: TropicalSemiring {
    // Required method
    unsafe fn dispatch_gemm(
        m: usize,
        n: usize,
        k: usize,
        a: *const Self::Scalar,
        lda: usize,
        trans_a: Transpose,
        b: *const Self::Scalar,
        ldb: usize,
        trans_b: Transpose,
        c: *mut Self,
        ldc: usize,
    );

    // Provided methods
    unsafe fn dispatch_gemm_with_argmax(
        m: usize,
        n: usize,
        k: usize,
        a: *const Self::Scalar,
        lda: usize,
        trans_a: Transpose,
        b: *const Self::Scalar,
        ldb: usize,
        trans_b: Transpose,
        result: &mut GemmWithArgmax<Self>,
    )
       where Self: TropicalWithArgmax<Index = u32> { ... }
    unsafe fn dispatch_gemm_with_workspace(
        m: usize,
        n: usize,
        k: usize,
        a: *const Self::Scalar,
        lda: usize,
        trans_a: Transpose,
        b: *const Self::Scalar,
        ldb: usize,
        trans_b: Transpose,
        c: *mut Self,
        ldc: usize,
        _workspace: &mut GemmWorkspace<Self::Scalar>,
    ) { ... }
    unsafe fn dispatch_gemm_with_argmax_with_workspace(
        m: usize,
        n: usize,
        k: usize,
        a: *const Self::Scalar,
        lda: usize,
        trans_a: Transpose,
        b: *const Self::Scalar,
        ldb: usize,
        trans_b: Transpose,
        result: &mut GemmWithArgmax<Self>,
        workspace: &mut GemmWorkspace<Self::Scalar>,
    )
       where Self: TropicalWithArgmax<Index = u32> { ... }
}
Expand description

Trait for types that support kernel dispatch.

Required Methods§

Source

unsafe fn dispatch_gemm( m: usize, n: usize, k: usize, a: *const Self::Scalar, lda: usize, trans_a: Transpose, b: *const Self::Scalar, ldb: usize, trans_b: Transpose, c: *mut Self, ldc: usize, )

Dispatch to the appropriate kernel based on CPU features.

Provided Methods§

Source

unsafe fn dispatch_gemm_with_argmax( m: usize, n: usize, k: usize, a: *const Self::Scalar, lda: usize, trans_a: Transpose, b: *const Self::Scalar, ldb: usize, trans_b: Transpose, result: &mut GemmWithArgmax<Self>, )
where Self: TropicalWithArgmax<Index = u32>,

Dispatch argmax, defaulting to the portable kernel for custom types.

§Safety

Inputs and result must be valid for the requested dimensions and strides.

Source

unsafe fn dispatch_gemm_with_workspace( m: usize, n: usize, k: usize, a: *const Self::Scalar, lda: usize, trans_a: Transpose, b: *const Self::Scalar, ldb: usize, trans_b: Transpose, c: *mut Self, ldc: usize, _workspace: &mut GemmWorkspace<Self::Scalar>, )

Dispatch using reusable packing storage. Custom implementations retain their existing dispatch unless they override this method to use workspace.

§Safety

Same requirements as dispatch_gemm.

Source

unsafe fn dispatch_gemm_with_argmax_with_workspace( m: usize, n: usize, k: usize, a: *const Self::Scalar, lda: usize, trans_a: Transpose, b: *const Self::Scalar, ldb: usize, trans_b: Transpose, result: &mut GemmWithArgmax<Self>, workspace: &mut GemmWorkspace<Self::Scalar>, )
where Self: TropicalWithArgmax<Index = u32>,

Dispatch argmax using reusable packing storage.

§Safety

Same requirements as dispatch_gemm_with_argmax.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§