std :: ml::gpu_cuda
Function std::cuda_half_gemv
int cuda_half_gemv(
struct CudaHalfBuf w,
struct CudaBuf x,
struct CudaBuf 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: on an H200 1.3-2.2x faster than a one-row cuda_half_gemm_f32 on 1536-6144-wide projections (e.g. 1536 x 2048: 3.2 vs 7.0 us), 4.47 TB/s on a 262144 x 1536 LM head. Fastest when k is a multiple of 8 (16-byte loads; scalar otherwise).