gqa_pack_shape_ok

Function gqa_pack_shape_ok 

Source
pub fn gqa_pack_shape_ok(
    num_q_heads: u32,
    num_kv_heads: u32,
    head_dim: u32,
) -> bool
Expand description

2026-09-25: Whether this launch’s shape is one the packed kernels can serve. Each condition is a precondition of the kernel:

  • num_kv_heads > 0: it is the grid’s x extent.
  • num_q_heads == num_kv_heads * DECODE_GQA_PACK_WIDTH: the kernel takes its query heads from kv_head * PD_GQA, so any other ratio reads and writes the wrong heads. The test multiplies because division truncates: 25 q heads over 4 kv heads divide to 6.
  • head_dim == DECODE_GQA_PACK_HEAD_DIM.

When this is false the caller keeps the unpacked kernel.