[AMD] Tune Qwen3.5 TP4 GDN recurrent launch on gfx950 (#39987)
This commit is contained in:
@@ -11,6 +11,7 @@ import sys
|
||||
import pytest
|
||||
import torch
|
||||
|
||||
from sglang.srt.utils import is_gfx95_supported
|
||||
from sglang.test.ci.ci_register import register_amd_ci, register_cuda_ci
|
||||
|
||||
try:
|
||||
@@ -19,6 +20,7 @@ try:
|
||||
fused_recurrent_gated_delta_rule_update,
|
||||
)
|
||||
from sglang.kernels.ops.attention.fla.fused_sigmoid_gating_recurrent import (
|
||||
_select_recurrent_launch_config,
|
||||
fused_sigmoid_gating_delta_rule_update,
|
||||
)
|
||||
|
||||
@@ -180,6 +182,57 @@ def test_fused_gdn_mtp_precision(N: int, T: int):
|
||||
torch.testing.assert_close(out_ref, out_fused, rtol=1e-2, atol=1e-2)
|
||||
|
||||
|
||||
@pytest.mark.skipif(not KERNELS_AVAILABLE, reason="Kernel not available")
|
||||
@pytest.mark.parametrize("N", [1, 3, 16])
|
||||
def test_qwen35_tp4_fused_gdn_mtp_precision(N: int):
|
||||
"""Exercise the gfx950 TP4 launch shape against the reference path."""
|
||||
T, H, HV, K, V = 4, 4, 16, 128, 128
|
||||
A_log, dt_bias, a, b, q, k, v, state, indices, cu_seqlens = _make_tensors(
|
||||
N, T, H, HV, K, V
|
||||
)
|
||||
|
||||
out_ref = run_reference(
|
||||
A_log,
|
||||
dt_bias,
|
||||
q,
|
||||
k,
|
||||
v,
|
||||
a,
|
||||
b,
|
||||
state.clone(),
|
||||
indices,
|
||||
cu_seqlens,
|
||||
disable_state_update=True,
|
||||
)
|
||||
out_fused = run_fused_mtp(
|
||||
A_log,
|
||||
dt_bias,
|
||||
q,
|
||||
k,
|
||||
v,
|
||||
a,
|
||||
b,
|
||||
state.clone(),
|
||||
indices,
|
||||
cu_seqlens,
|
||||
disable_state_update=True,
|
||||
)
|
||||
|
||||
torch.testing.assert_close(out_ref, out_fused, rtol=1e-2, atol=1e-2)
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
not (torch.version.hip and is_gfx95_supported()), reason="requires AMD gfx95"
|
||||
)
|
||||
def test_qwen35_tp4_launch_config_is_narrow():
|
||||
assert _select_recurrent_launch_config(1, 4, 16, 128, 128, False) == (8, 4)
|
||||
assert _select_recurrent_launch_config(3, 4, 16, 128, 128, False) == (16, 2)
|
||||
assert _select_recurrent_launch_config(32, 4, 16, 128, 128, False) == (16, 2)
|
||||
assert _select_recurrent_launch_config(33, 4, 16, 128, 128, False) == (32, 1)
|
||||
assert _select_recurrent_launch_config(3, 8, 32, 128, 128, False) == (32, 1)
|
||||
assert _select_recurrent_launch_config(3, 4, 16, 128, 128, True) == (32, 1)
|
||||
|
||||
|
||||
@pytest.mark.skipif(not KERNELS_AVAILABLE, reason="Kernels not available")
|
||||
@pytest.mark.parametrize("N", [1, 16, 128])
|
||||
def test_mtp_single_step_decode(N: int):
|
||||
|
||||
Reference in New Issue
Block a user