Implementing a Marlin-esque w4a16 (INT4 weight, FP16 activations) matmul kernel for Blackwell (sm_120). Same waters, smaller fish.
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
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.