Skip to content

Repository files navigation

guppy

Implementing a Marlin-esque w4a16 (INT4 weight, FP16 activations) matmul kernel for Blackwell (sm_120). Same waters, smaller fish.

Kernels

One CUDA thread computes one output element output[m][n]. Each thread independently loops over the k dimension and MACs.

Threads in a block cooperatively load weights, activations, and scales into shared memory before computing. Threads still own one output element each, but now read shared memory instead of redundantly hitting global memory per MAC.

Each thread now computes a $TM \times TN$ subtile of output instead of a single element. Increases FMA per read. Fully unrolled accumulator array keeps everything in registers rather than local memory.

Same tiling as 3a, but the scalar unpack path is replaced with lop3 (unpacking two weights per instruction) and the MAC loop with hfma2 on packed half2 register (two FMAs per instruction). Stores partials in fp16 which are then written to a fp32 accumulator to reduce aggregate rounding error.

Resources

About

Implementing a Marlin-esque W4A16 kernel for Blackwell (sm_120).

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages