执行摘要
- 一句话:为AMD CI新增label-gated extra-a测试层
- 推荐动作:值得关注的设计决策:采用与CUDA模式一致的标签门控策略,运行时检查标签以支持rerun时正确识别;采用single-job而非分区以节省AMD GPU资源;利用
workflow_call将extra-a链入定时调度。这些模式可供后续AMD测试层扩展参考。
功能与动机
CUDA extra-a opt-in tier由PR #26648引入,但AMD端未有对应注册,导致这些单元测试在AMD平台上缺乏CI覆盖。本PR弥补这一差距,为AMD提供等效的测试套件,确保AMD平台的质量保障。
实现拆解
- 新增工作流文件
.github/workflows/pr-test-amd-extra.yml,作为AMD的extra-a标签门控CI工作流,镜像CUDA的pr-test-extra.yml。
- 修改
.github/workflows/pr-test-amd.yml和pr-test-amd-rocm720.yml,通过workflow_call将extra-a工作流链入定时调度。
- 修改
test/run_suite.py,注册AMD的extra-a测试套件extra-a-test-1-gpu-small-amd。
- 修改21个测试文件(kv_canary和mock_model),在各文件的模块级加入
register_amd_ci()调用,并更新导入。
- 经过验证,所有21个测试在mi325上通过,总执行时间约233秒,分区后约60-70秒/leg。
关键文件:
.github/workflows/pr-test-amd-extra.yml(模块 CI编排;类别 infra;类型 infrastructure): 新增的AMD extra-a CI工作流核心,实现标签门控和套件调度。
.github/workflows/pr-test-amd.yml(模块 CI编排;类别 infra;类型 infrastructure): 将extra-a工作流链入默认AMD定时调度,保证main分支覆盖。
test/run_suite.py(模块 测试套件;类别 test;类型 test-coverage): 注册AMD extra-a测试套件标识,使测试框架能够识别并调度该套件。
test/registered/mock_model/test_self_unit_canary_mock_wiring.py(模块 单元测试;类别 test;类型 test-coverage): 作为测试文件添加AMD CI注册的示例,展示register_amd_ci的使用。
关键符号:未识别
关键源码片段
test/registered/mock_model/test_self_unit_canary_mock_wiring.py
作为测试文件添加AMD CI注册的示例,展示register_amd_ci的使用。
from __future__ import annotations
import dataclasses
import unittest
import torch
from 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
# ... 其他字段
评论区精华
该PR由HaiShaw直接批准,无额外comment讨论。PR body中详细说明了设计决策(如运行时标签检查、单job模式)和实施验证结果。
风险与影响
- 风险:主要风险在于AMD硬件上KV-canary JIT kernel未移植,导致e2e测试无法运行(已在PR中明确排除)。当前注册的单元测试通过mock模型避免了对JIT kernel的依赖,风险较低。另外,若AMD CI环境变化导致测试不稳定,可能会引起不必要的失败通知,但标签门控限制了影响范围。
- 影响:对用户无直接影响。对系统:增加了21个测试在AMD CI的覆盖,提高AMD平台的质量保证。对CI基础设施:增加了新的工作流文件和定时任务,但通过标签门控和
continue_on_error确保不影响基础CI门禁。
- 风险标记:AMD硬件兼容, 测试覆盖有限
关联脉络
- PR #26648 [CI] Split PP tests into base and extra suites: 引入了extra-a tier的概念,本PR为其添加AMD镜像
参与讨论