[Bugfix] Fix packed GDN decode launch for large batch-head grids (#52030)

Signed-off-by: mgoin <mgoin64@gmail.com>
This commit is contained in:
Michael Goin
2026-08-13 07:19:08 -07:00
committed by GitHub
parent 170592a931
commit 2d24355eb8
2 changed files with 33 additions and 3 deletions
@@ -100,3 +100,26 @@ def test_fused_recurrent_packed_decode_matches_reference(
valid = ssm_state_indices > 0
torch.testing.assert_close(out_packed[valid], out_ref[valid], rtol=rtol, atol=atol)
torch.testing.assert_close(state_packed, state_ref, rtol=rtol, atol=atol)
@pytest.mark.skipif(not torch.cuda.is_available(), reason="Need CUDA device")
def test_packed_decode_supports_large_batch_head_grid():
B, H, HV, K, V = 1024, 8, 64, 1, 1
device = torch.device("cuda")
gates = torch.empty((B, HV), device=device)
params = torch.empty((HV,), device=device)
out = torch.empty((B, 1, HV, V), device=device)
fused_recurrent_gated_delta_rule_packed_decode(
mixed_qkv=torch.empty((B, 2 * H * K + HV * V), device=device),
a=gates,
b=gates,
A_log=params,
dt_bias=params,
scale=1.0,
initial_state=torch.empty((1, HV, V, K), device=device),
out=out,
ssm_state_indices=torch.zeros((B,), device=device, dtype=torch.int32),
)
assert torch.count_nonzero(out).item() == 0