Prhub

#27822 [AMD] ci: add label-gated extra-a tier (kv_canary + mock_model unit tests)

原始 PR 作者 michaelzhang-ai 合并时间 2026-06-13 06:12 文件变更 25 提交数 6 评论 1 代码增减 +263 / -21

执行摘要

为 AMD CI 新增 label-gated extra-a 测试层

CUDA extra-a opt-in tier由PR #26648引入,但AMD端未有对应注册,导致这些单元测试在AMD平台上缺乏CI覆盖。本PR弥补这一差距,为AMD提供等效的测试套件,确保AMD平台的质量保障。

值得关注的设计决策:采用与CUDA模式一致的标签门控策略,运行时检查标签以支持rerun时正确识别;采用single-job而非分区以节省AMD GPU资源;利用workflow_call将extra-a链入定时调度。这些模式可供后续AMD测试层扩展参考。

讨论亮点

该PR由HaiShaw直接批准,无额外comment讨论。PR body中详细说明了设计决策(如运行时标签检查、单job模式)和实施验证结果。

实现拆解

  1. 新增工作流文件.github/workflows/pr-test-amd-extra.yml,作为AMD的extra-a标签门控CI工作流,镜像CUDA的pr-test-extra.yml
  2. 修改.github/workflows/pr-test-amd.ymlpr-test-amd-rocm720.yml,通过workflow_call将extra-a工作流链入定时调度。
  3. 修改test/run_suite.py,注册AMD的extra-a测试套件extra-a-test-1-gpu-small-amd
  4. 修改21个测试文件(kv_canary和mock_model),在各文件的模块级加入register_amd_ci()调用,并更新导入。
  5. 经过验证,所有21个测试在mi325上通过,总执行时间约233秒,分区后约60-70秒/leg。
文件 模块 状态 重要度
.github/workflows/pr-test-amd-extra.yml CI 编排 added 5.98
.github/workflows/pr-test-amd.yml CI 编排 modified 4.58
test/run_suite.py 测试套件 modified 4.03
test/registered/mock_model/test_self_unit_canary_mock_wiring.py 单元测试 modified 4.13

关键源码片段

test/registered/mock_model/test_self_unit_canary_mock_wiring.py test-coverage

作为测试文件添加 AMD CI 注册的示例,展示 register_amd_ci 的使用。

from __future__ import annotationsimport dataclasses
import unittestimport torchfrom sglang.srt.kv_canary.expected_inputs import ExpectedInputs
from sglang.srt.kv_canary.token_oracle.oracle import HashOracle
from sglang.srt.kv_canary.token_oracle.sampler import install_oracle_sampler
from sglang.srt.model_executor.forward_batch_info import (
    ForwardMode,
    _stable_hash_str_to_i64,
)
from sglang.test.ci.ci_register import register_amd_ci, register_cuda_ci
from sglang.test.mock_model.utils import mock_model_server_args, mock_model_server_env
from sglang.test.test_utils import CustomTestCase# 模块级别注册 CI 触发:CUDA 在主测试阶段 extra-a,AMD 在对应套件
register_cuda_ci(est_time=60, stage="extra-a", runner_config="1-gpu-small")
register_amd_ci(est_time=60, suite="extra-a-test-1-gpu-small-amd")# 测试辅助类(保持不变)
@dataclasses.dataclass
class _StubForwardBatch:
    input_ids: torch.Tensor
    # ... 其他字段

评论区精华

没有提炼出高价值讨论线程

当前评论区没有形成足够清晰的争议点或结论,后续有更多讨论时会体现在这里。

风险与影响

主要风险在于AMD硬件上KV-canary JIT kernel未移植,导致e2e测试无法运行(已在PR中明确排除)。当前注册的单元测试通过mock模型避免了对JIT kernel的依赖,风险较低。另外,若AMD CI环境变化导致测试不稳定,可能会引起不必要的失败通知,但标签门控限制了影响范围。

对用户无直接影响。对系统:增加了21个测试在AMD CI的覆盖,提高AMD平台的质量保证。对CI基础设施:增加了新的工作流文件和定时任务,但通过标签门控和continue_on_error确保不影响基础CI门禁。

AMD 硬件兼容 测试覆盖有限

关联 Issue

未识别关联 Issue

当前没有检测到明确关联的 Issue 链接,后续同步到相关引用后会出现在这里。

完整报告

参与讨论