Skip to main content

grouped_mat_mul_shared

Function grouped_mat_mul_shared 

Source
pub fn grouped_mat_mul_shared<T: MatrixScalar + TensorScalar>(
    lhs: &[T],
    rhs: &[T],
    output: &mut [T],
    jobs: &[GroupedGemmJob],
    options: GroupedGemmOptions,
) -> Result<(), GroupedGemmError>
Expand description

Execute grouped column-major GEMMs over shared caller-owned buffers.

Each job computes output[out_offset..] = lhs[lhs_offset..] * rhs[rhs_offset..] for its declared matrix dimensions. Input spans may be reused by multiple jobs without copying their payload. The output buffer is mutated only after all descriptor, span, alias, and working-budget checks pass. The default process-global context supplies the configured provider; use grouped_mat_mul_shared_with_backend when the caller owns the backend explicitly.

§Errors

Returns GroupedGemmError for checked arithmetic, buffer bounds, incompatible shared shapes, overlapping outputs, working-budget, view, or configured-provider failures. Invalid requests are rejected before backend execution and leave output unchanged.

§Examples

use tensor4all_tensorbackend::{
    grouped_mat_mul_shared, GroupedGemmJob, GroupedGemmOptions,
};

let jobs = [GroupedGemmJob::new(0, 0, 0, 1, 1, 1)];
let mut output = [0.0_f64];
grouped_mat_mul_shared(
    &[3.0], &[4.0], &mut output, &jobs, GroupedGemmOptions::default(),
)?;
assert_eq!(output, [12.0]);