# PR #38381 完整报告

- 仓库：`vllm-project/vllm`
- 标题：[ROCm][CI] Pin test_hybrid test to TRITON_ATTN on ROCm
- 合并时间：2026-03-31 04:26
- 原文链接：http://prhub.com.cn/vllm-project/vllm/pull/38381

---

# PR #38381 分析报告

## 执行摘要
此 PR 通过将 ROCm 平台上的 test_hybrid 测试固定使用 TRITON_ATTN 注意力后端，解决了因后端优先级重新排序导致的测试不稳定问题，仅影响 CI 测试环境，属于常规维护性修复。

## 功能与动机
在 PR #36702 重新排序注意力后端优先级后，ROCm 平台的 test_hybrid.py 测试出现 flakiness（如构建失败示例）。此变更旨在通过指定后端来减少批量差异效应，提高测试可靠性，避免 CI 环境中的随机失败。

## 实现拆解
- **文件**: `tests/models/language/generation/test_hybrid.py`
- **关键变更**:
 - 新增条件变量 : `ATTN_BACKEND = "TRITON_ATTN" if current_platform.is_rocm() else "auto"`
 - 应用到以下测试函数的 vllm_runner 调用中（添加 `attention_backend=ATTN_BACKEND` 参数）:
 - `test_models`
 - `test_chunked_prefill_with_parallel_sampling`
 - `test_full_cuda_graph`
 - `_get_vllm_runner_params`
 - `test_apc_common_prefix_same_batch`

## 评论区精华
review 中，gemini-code-assist[bot] 指出：
> "To fully address the flakiness on ROCm as described in the pull request, this ATTN_BACKEND should be applied to all relevant tests in this file."

作者 micah-wil 回应：
> "Good point, but since we haven't observed issues in those tests, I don't think we have any reason to change them."

讨论焦点是测试覆盖率，最终决策基于实际观察，未扩展修改范围。

## 风险与影响
- **风险**: 变更局限于测试代码，风险低；但未覆盖所有可能相关测试（如 `test_batching`），可能残留不稳定风险，不过作者评估可控。
- **影响**: 仅提升 ROCm CI 测试的稳定性，对用户或系统无直接影响。

## 关联脉络
此 PR 是对历史 PR #36702（注意力后端优先级重新排序）的直接修复，属于 ROCm 平台测试优化的一部分。从近期历史 PR 看，vLLM 仓库在 ROCm 和测试方面有持续改进（如 #37698、#37529），反映了对跨平台稳定性的重视。