Prhub

#44687 [CI/Build] Skip test_use_trtllm_attention on non-CUDA platforms

原始 PR 作者 DanBlanaru 合并时间 2026-06-11 06:18 文件变更 1 提交数 4 评论 5 代码增减 +7 / -0

执行摘要

TRT-LLM 测试在非 CUDA 平台跳过

避免在非 CUDA 平台(如 ROCm、CPU)上运行 TRT-LLM 相关测试,因为 TRT-LLM 仅支持 CUDA。该变更由 @AndreasKaratzas 在 #43232 中提出作为额外清理。

该 PR 是简单的测试维护,无精读必要。可关注其统一的跳过模式,未来类似测试可参考。

讨论亮点

无实质性讨论。审核者 @AndreasKaratzas 和 @yewentao256 均批准,仅提及需要从 main 合并。

实现拆解

  1. 导入调整:在 tests/kernels/attention/test_use_trtllm_attention.py 顶部增加 from vllm.platforms import current_platform
  2. 模块级跳过:在导入之后、测试函数之前插入 if not current_platform.is_cuda(): pytest.skip("TRTLLM attention is only supported on CUDA platforms.", allow_module_level=True)
  3. 模式统一:与同级文件 test_trtllm_kvfp8_dequant.py 已有的跳过逻辑保持一致。
文件 模块 状态 重要度
tests/kernels/attention/test_use_trtllm_attention.py 测试文件 modified 3.7

关键源码片段

tests/kernels/attention/test_use_trtllm_attention.py test-coverage

唯一变更文件,添加了模块级 CUDA 平台跳过。

# tests/kernels/attention/test_use_trtllm_attention.py
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM projectfrom unittest.mock import patchimport pytest
import torchfrom vllm.platforms import current_platform
from vllm.utils.flashinfer import (
    can_use_trtllm_attention,
    supports_trtllm_attention,
    use_trtllm_attention,
)# 模块级跳过:非 CUDA 平台直接跳过整个文件
if not current_platform.is_cuda():
    pytest.skip(
        "TRTLLM attention is only supported on CUDA platforms.",
        allow_module_level=True,
    )MODEL_CONFIGS = {
    "Llama-3-70B": dict(num_qo_heads=64, num_kv_heads=8),
    # ... 其余配置
}

评论区精华

平台跳过方法 设计

审核者要求合并 main 以修复合并冲突。

结论:已合并 main,PR 被批准。 · 已解决

风险与影响

无显著风险。变更仅限于测试文件,仅影响非 CUDA 平台上的测试执行。正确性风险低。

影响范围小。仅对 tests/kernels/attention/test_use_trtllm_attention.py 文件生效,非 CUDA 平台(如 ROCm、CPU)运行测试套件时将跳过该文件,避免不必要的失败。

低风险,仅测试文件变更

关联 Issue

未识别关联 Issue

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

完整报告

参与讨论