[CI Failure]: (MI355) Core Operation Kernels Shard 1: kernels/test_concat_mla_q.py::test_concat_mla_q_fp8_nope_and_rope

该 CI 失败只出现在 ROCm(MI355)的 Core Operation Kernels Shard 1 上,跑 kernels/test_concat_mla_q.py::test_concat_mla_q_fp8_nope_and_rope 相关用例时报 IndexError: tuple

快速结论:该 CI 失败只出现在 ROCm(MI355)的 Core Operation Kernels Shard 1 上,跑 kernels/test_concat_mla_q.py::test_concat_mla_q_fp8_nope_and_rope 相关用例时报 IndexError: tuple index out of range。优先排查 _DecodeConcatQuantFP8 的 HIP 回退路径是否把参数顺序错位地传入了 4 参数的包装方法。

适用环境:Issue 已确认的场景为 vLLM 在 ROCm / MI355 上运行 CI,Python 3.12(traceback 路径为 /usr/local/lib/python3.12/dist-packages);相同测试在 NVIDIA H200 MIG 35GB 上通过,MI355 shard 2、shard 3 为绿色。GPU 架构、ROCm 版本、PyTorch 版本未在 Issue 中给出。

最快修复方案:暂无确认的一步修复方案。Issue 中给出的最小修改是将 QuantFP8.forward_hip 的 CUDA 回退改为以未绑定方式调用基类实现:return QuantFP8.forward_cuda(self, x, scale, scale_ub);该改法来自 Issue 分析,提交方未说明已合并验证,可优先尝试。

注意事项:该方案绕过子类覆盖、直接调用基类实现,前提是 QuantFP8.forward_cuda 的签名与传入参数一致;若其他子类也依赖同样的回退路径,需要一并核对。Issue 报告者没有 MI355 硬件,仅在 CI 复现,本地修复后建议在 ROCm CI 上验证。Issue 最终以该测试组转绿关闭,未见具体修复提交记录。

问题场景

vLLM 的 ROCm CI 任务 (MI355) Core Operation Kernels Shard 1 运行 kernels/test_concat_mla_q.py 时失败。失败的三个参数化用例均属于 test_concat_mla_q_fp8_nope_and_rope:[True-0-False]、[True-0-True]、[True-64-False]。同一测试文件在 NVIDIA H200 MIG 35GB 的 shard 上通过,MI355 的 shard 2、shard 3 也通过,只有 shard 1 分配到了该测试文件。该失败是确定性失败,多次重试(含构建内重试)仍失败。

报错原文

FAILED kernels/test_concat_mla_q.py::test_concat_mla_q_fp8_nope_and_rope[True-0-False] - IndexError: tuple index out of range
FAILED kernels/test_concat_mla_q.py::test_concat_mla_q_fp8_nope_and_rope[True-0-True]  - IndexError: tuple index out of range
FAILED kernels/test_concat_mla_q.py::test_concat_mla_q_fp8_nope_and_rope[True-64-False] - IndexError: tuple index out of range
3 failed, 1164 passed, 168 skipped, 24 warnings in 1072.49s (0:17:52)
vllm/model_executor/layers/quantization/input_quant_fp8.py:159: in forward_hip
    return self.forward_cuda(x, scale, scale_ub)

self = _DecodeConcatQuantFP8()
decode_ql_nope = tensor([[  24.8750,  276.0000, ...]], device='cuda:0', dtype=torch.bfloat16)
decode_q_pe = tensor(0.3000, device='cuda:0'), scale = None, scale_ub = None

    def forward(
        self,
        decode_ql_nope: torch.Tensor,
        decode_q_pe: torch.Tensor,
        scale: torch.Tensor,
        scale_ub: torch.Tensor | None = None,
    ) -> torch.Tensor:
>       if decode_q_pe.shape[-1] == 0 and decode_ql_nope.is_contiguous():
E       IndexError: tuple index out of range

/usr/local/lib/python3.12/dist-packages/vllm/model_executor/layers/attention/mla_attention.py:1556: IndexError

原因分析

Issue 给出的根因是 HIP 回退路径重新进入了子类覆盖方法。具体链路如下:

  • _DecodeConcatQuantFP8(vllm/model_executor/layers/attention/mla_attention.py:1540-1568)用同一个 factory 生成 forward_native、forward_cuda、forward_hip 三个方法,因此它们的签名都是 4 参数 (decode_ql_nope, decode_q_pe, scale, scale_ub)。
  • QuantFP8.forward_hip(vllm/model_executor/layers/quantization/input_quant_fp8.py:159)在末尾回退到 CUDA 实现,写法为 return self.forward_cuda(x, scale, scale_ub),即 3 参数调用。
  • 在 _DecodeConcatQuantFP8 实例上,self.forward_cuda 指向的是包装后的 4 参数方法,而不是 QuantFP8.forward_cuda。于是 3 参数回退调用再次进入包装方法并发生参数错位:decode_q_pe 绑定了逐 tensor 的 scale(0 维张量 tensor(0.3000)),随后 decode_q_pe.shape[-1] 对 0 维张量取索引,抛出 IndexError。

CUDA 路径不会发生这种重新分发,因此只有 ROCm lane 失败。在该 MI355 配置下,forward_hip 中的 AITER 提前返回分支未命中,于是走到了回退路径。

环境排查

  • 确认运行平台:问题仅在 ROCm / MI355 上出现,需排除 NVIDIA CUDA 环境误报。
  • 确认 Python 版本:traceback 显示 Python 3.12。
  • 确认 vLLM 中 _DecodeConcatQuantFP8 的三个 forward 方法是否仍由同一 factory 生成、签名是否为 4 参数。
  • 确认 QuantFP8.forward_hip 的回退语句是 self.forward_cuda(x, scale, scale_ub) 还是已改为未绑定基类调用。
  • 确认测试配置是否命中 AITER 提前返回分支;未命中时才会进入 CUDA 回退。
  • Issue 未提供 ROCm 版本、PyTorch 版本、AITER 版本和 GPU 数量,这些项在本地复现时需自行记录。

解决步骤

  1. 在 vllm/model_executor/layers/quantization/input_quant_fp8.py 中定位 QuantFP8.forward_hip 末尾的 CUDA 回退语句(约第 159 行)。
  2. 将回退改为未绑定调用基类实现,避免重新进入子类的 4 参数包装方法:return QuantFP8.forward_cuda(self, x, scale, scale_ub)。这是 Issue 中提出的最小修复,可优先尝试。
  3. 检查其他对 forward_hip 做同名回退的子类,确认它们不会因同样原因产生参数错位。
  4. 在 ROCm / MI355 环境(或对应 ROCm CI)上运行 kernels/test_concat_mla_q.py 中的 test_concat_mla_q_fp8_nope_and_rope 相关参数化用例。

验证方法

重新运行 kernels/test_concat_mla_q.py::test_concat_mla_q_fp8_nope_and_rope 的 [True-0-False]、[True-0-True]、[True-64-False] 三个用例,确认不再出现 IndexError: tuple index out of range,且 forward_hip 回退调用不再把 0 维 scale 绑定到 decode_q_pe。Issue 中记录的关闭依据是该测试组转绿。

参考来源

vllm-project/vllm #58134

GamsGo AI

AI 工具推荐

想把多个 AI 模型放在一个入口?

GamsGo AI 集成 ChatGPT、DeepSeek、Gemini、Claude、Midjourney、Veo 等常用模型,适合写作、绘图、视频和日常 AI 工作流。

了解 GamsGo AI

推广链接:通过此链接购买,我可能获得佣金,不影响你的价格。

这个方案解决了吗?

celebrityanime
celebrityanime
文章: 29505

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注