You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cuda : a quantize launch between attention and output projection #107
One token of Gemma 4 31B launches quantize_q8_1 241 times on an RX 7900 XT (rocprofv3 kernel trace, llama-bench), 4 times per layer. One of the four sites is the attention result that the output projection reads: the mat-vec kernel wants its input as q8_1 blocks, so a quantize kernel runs between the attention and the projection.
The rms_norm and the gated unary kernels already write the q8_1 copy of their result into the cache that the mat-vec looks up. The combine kernel of the attention (flash_attn_combine_results) can do the same: it has one block per head and token with one thread per value, so each warp holds exactly one q8_1 block when the head size is a multiple of 32.
An empty launch costs 2.9 us on this card (ROCm 10.1), the quantize kernel itself 2.0 us.
Activity