std1.0.0-beta-7 SafeC docs

std :: ml::gpu_rocm

Function std::rocm_half_gemv

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

int rocm_half_gemv(
    struct RocmHalfBuf w,
    struct RocmBuf x,
    struct RocmBuf y,
    unsigned long n,
    unsigned long k,
)

Matrix-vector product for decoding one token at a time: y = w x with w an [n][k] fp16/bf16 matrix (row-major, e.g. a linear layer's weight) and x, y fp32 (x is not rounded to 16 bits). Memory-bound: 0.8-1.07 TB/s of weights on an MI100, 1.04-1.8x faster than a one-row rocm_half_gemm_f32 (most on short outputs, e.g. 1536 x 2048: 7.8 vs 13.7 us). Fastest when k is a multiple of 8.