std1.0.0-beta-7 SafeC docs

std :: ml::gpu_mps

Function std::mps_gemm

#include <std/ml/gpu_mps.h> source ยท definition

int mps_gemm(
    struct MpsBuf a,
    int ta,
    struct MpsBuf b,
    int tb,
    struct MpsBuf c,
    unsigned long m,
    unsigned long n,
    unsigned long k,
)

c[m,n] = op(a)[m,k] . op(b)[k,n] on fp32 buffers, row-major, written into the caller's buffer 'c' -- gpu_rocm.h's rocm_gemm. 'ta' / 'tb' = 1 means that operand is stored transposed (a as k x m, b as n x k); at most one of them may be (the three cases are mps_matmul_f32's, mps_matmul_abt_f32's and mps_matmul_atb_f32's kernels, with the same shape-based choice of tier). Like the device-buffer attention ops below: encoded onto the open batch (c valid after mps_batch_end()) or, outside one, run and waited for. 1 = done/encoded, 0 = bad shape, a buffer too small, or no Metal device.