执行摘要
- 一句话:新增AMD CI extra-a 1-gpu-large测试层
- 推荐动作:该PR展示了良好的CI分层设计:将测试按硬件平台和资源需求分层,并通过标签控制触发。其跨平台测试注册方式(register_cuda_ci / register_amd_ci)值得其他后端参考。建议关注后续可能将更多通过验证的测试从CUDA extra-a移植到AMD。
功能与动机
PR body指出,目的是将CUDA extra-a测试层中在AMD mi325 GPU上验证通过的模型e2e测试纳入AMD CI,以提前发现回归。之前AMD extra-a只包含mock-model/kv_canary单元测试,缺乏真实模型测试覆盖。作者通过多轮discovery run筛选出可移植的子集。
实现拆解
- 在
.github/workflows/pr-test-amd-extra.yml中新增extra-a-test-1-gpu-large-amd作业,复用1-gpu-small的容器启动脚本,执行run_suite.py --hw amd --suite extra-a-test-1-gpu-large-amd。
- 在
test/run_suite.py的PER_COMMIT_SUITES[HWBackend.AMD]列表中注册新suite extra-a-test-1-gpu-large-amd,并更新注释说明其包含的测试子集。
- 为三个测试文件添加
register_amd_ci调用:test_fp8kv_triton.py、test_streaming_session_extra.py、test_spec_standalone_extra.py,将其注册到AMD CI的extra-a大套件中。
- 在
test_spec_standalone_extra.py中,对FA3和FlashInfer后端的测试类添加@unittest.skipIf(is_hip(), ...)跳过逻辑,因为ROCm的sgl_kernel未构建这些后端,仅保留Triton变体在AMD上运行。
- CI作业的fan-in聚合器
pr-test-amd-extra-finish自动覆盖新job,无额外配置。
关键文件:
.github/workflows/pr-test-amd-extra.yml(模块 CI工作流;类别 infra;类型 infrastructure): 核心CI配置,新增extra-a 1-gpu-large作业,定义了测试容器启动和执行流程。
test/registered/spec/test_spec_standalone_extra.py(模块 推测解码测试;类别 test;类型 test-coverage;符号 register_amd_ci, register_cuda_ci, TestStandaloneSpeculativeDecodingBase, TestStandaloneSpeculativeDecodingTriton): 测试文件,添加AMD CI注册并对ROCm不可用的后端类应用skipIf跳过逻辑,确保测试只在可用后端运行。
test/run_suite.py(模块 测试注册;类别 test;类型 test-coverage): 测试套件注册文件,将新suite 'extra-a-test-1-gpu-large-amd' 加入 AMD per-commit suites列表,并更新注释说明内容。
test/registered/quant/test_fp8kv_triton.py(模块 FP8KV测试;类别 test;类型 test-coverage;符号 register_amd_ci, register_cuda_ci, TestFP8KVCacheTritonBackend): 量化测试文件,添加一行register_amd_ci注册到AMD large套件。
test/registered/sessions/test_streaming_session_extra.py(模块 流式会话测试;类别 test;类型 test-coverage;符号 register_amd_ci, register_cuda_ci, TestStreamingSessionRetractMixedChunk, TestStreamingSessionRetractLargePage): 流式会话测试文件,添加一行register_amd_ci注册到AMD large套件。
关键符号:register_amd_ci, register_cuda_ci, TestFP8KVCacheTritonBackend, TestStreamingSessionRetractMixedChunk, TestStreamingSessionRetractLargePage, TestStandaloneSpeculativeDecodingBase, TestStandaloneSpeculativeDecodingTriton, TestStandaloneSpeculativeDecodingFlashinfer
关键源码片段
test/registered/spec/test_spec_standalone_extra.py
测试文件,添加AMD CI注册并对ROCm不可用的后端类应用skipIf跳过逻辑,确保测试只在可用后端运行。
import unittest
from sglang.srt.utils import is_hip
from sglang.test.ci.ci_register import register_amd_ci, register_cuda_ci
from sglang.test.server_fixtures.standalone_fixture import StandaloneServerBase
from sglang.test.test_utils import CustomTestCase
# 注册到 CUDA extra-a 套件(不变)
register_cuda_ci(est_time=406, stage="extra-a", runner_config="1-gpu-large")
# 注册到 AMD extra-a large 套件(新增)
register_amd_ci(est_time=103, suite="extra-a-test-1-gpu-large-amd")
# 定义跳过原因:fa3 / flashinfer 后端未在 ROCm sgl_kernel 中构建
_AMD_SKIP_BACKEND = (
"fa3 / flashinfer attention backends are CUDA-only "
"(not in the ROCm sgl_kernel build)"
)
@unittest.skipIf(is_hip(), _AMD_SKIP_BACKEND)
class TestStandaloneSpeculativeDecodingBase(StandaloneServerBase, CustomTestCase):
"""FA3 后端测试类,在 ROCm 上跳过"""
attention_backend = "fa3"
speculative_eagle_topk = 2
speculative_num_draft_tokens = 7
disable_overlap = True
class TestStandaloneSpeculativeDecodingTriton(StandaloneServerBase, CustomTestCase):
"""Triton 后端测试类,所有平台均运行(包括 ROCm)"""
attention_backend = "triton"
speculative_eagle_topk = 2
speculative_num_draft_tokens = 7
disable_overlap = True
enable_deterministic_inference = True
@unittest.skipIf(is_hip(), _AMD_SKIP_BACKEND)
class TestStandaloneSpeculativeDecodingFlashinfer(StandaloneServerBase, CustomTestCase):
"""FlashInfer 后端测试类,在 ROCm 上跳过"""
attention_backend = "flashinfer"
speculative_eagle_topk = 2
speculative_num_draft_tokens = 7
disable_overlap = True
if __name__ == "__main__":
unittest.main()
评论区精华
PR中无审查评论,但作者在PR body和后续评论中详细展示了通过continue_on_error发现模式对多个候选测试进行筛选的过程,最终仅保留3个测试。作者也列出了因ROCm gaps(如缺失flash_attn.cute、精度不达标等)而被排除的测试及其失败原因(如ngram tree-mask op缺失、lora精度失败、chunked_prefill超时等)。决策结论是只移植确认通过的子集,其余保持CUDA-only。
- AMD extra-a 测试子集选择 (other): 仅移植确认通过的三个测试,其余保持CUDA-only,并更新注册注释说明原因。
风险与影响
- 风险:风险较低,因为新增CI仅在标签
run-ci-extra触发时执行,不影响默认PR流程。主要风险有:
1) CI资源消耗增加,三个测试在mi325上总耗时约735秒;
2) spec_standalone测试中跳过了fa3和flashinfer后端,导致AMD平台上这部分覆盖缺失,若Triton后端的测试通过但其他后端有回归则无法捕获;
3) 测试依赖外部模型(如neuralmagic/Meta-Llama-3-8B-Instruct-FP8-KV、EAGLE3模型),若模型不可用可能导致CI失败。
- 影响:影响范围局限于AMD CI的extra-a层。对CUDA CI无影响。对AMD开发者意味着需要时可通过添加
run-ci-extra标签触发更多测试。对下游用户无直接影响。整体影响程度中等,因为增加了ROCm平台的真实模型测试覆盖,有助于提升AMD后端的稳定性。
- 风险标记:CI时间增加, 测试覆盖盲区 (fa3/flashinfer未测试)
关联脉络
- PR #28378 [AMD] Fix Always mask padded topk_ids on HIP to prevent garbage MoE routing (DeepSeek-R1-MXFP4 accuracy regression): 同为AMD平台的bugfix,提升了ROCm MoE精度,本PR增加的测试有助于验证此类修复不会引入回归。
参与讨论