perf(gdn): select ReplaySSM verify loop unrolling by shape (#36970)

This commit is contained in:
YAMY
2026-09-02 15:07:49 -07:00
committed by GitHub
parent 9c70d22721
commit fe45af1e6f
2 changed files with 52 additions and 2 deletions
@@ -17,7 +17,10 @@ import unittest
import torch
from sglang.kernels.ops.attention.cutedsl_gdn_mtp_ring import gated_delta_rule_mtp
from sglang.kernels.ops.attention.cutedsl_gdn_mtp_ring import (
_select_wide_vec_phase_b_unroll,
gated_delta_rule_mtp,
)
from sglang.kernels.ops.attention.fla.fused_gdn_gating import fused_gdn_gating
from sglang.kernels.ops.attention.fla.gdn_replayssm_spec_fold import (
commit_gdn_replayssm_fold_all_layers,
@@ -86,6 +89,15 @@ def _verify(gating, inputs, state, slots, rings=None, disable_state_update=True)
class TestGdnCuteDSLRingVerify(CustomTestCase):
def test_phase_b_unroll_selector(self):
select = _select_wide_vec_phase_b_unroll
for seq_len in range(3, 9):
with self.subTest(seq_len=seq_len, cache_ring=True):
self.assertEqual(select(seq_len, cache_ring=True), 2)
for seq_len, cache_ring in ((2, True), (9, True), (6, False)):
with self.subTest(seq_len=seq_len, cache_ring=cache_ring):
self.assertEqual(select(seq_len, cache_ring=cache_ring), 1)
def _run(self, B):
gating, inputs, state0, slots, rings = _case(B)