Prhub

#27850 [AMD] Fix DSA device-to-host direct test on rocm720 (page_size%16 assert)

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

执行摘要

跳过 AMD 下 DSA 设备到主机 direct 测试

修复 CI 测试pr-test-amd-rocm720stage-b-1gpu-small失败,由于DSATokenToKVPool在 HIP-preshuffle 路径下断言page_size % 16 == 0,但测试中使用page_size=1。PR body 明确指出该问题由#25939引入,当时仅在 mi3xx 上验证通过(旧版 ROCm 无此断言),而 rocm720 新版本暴露了该问题。

值得快速合并。该 PR 简洁地修复了特定 AMD 平台上的 CI 失败,且作者已通过两次 CI 运行验证。不涉及生产逻辑,无需深入 review。

讨论亮点

无 review 评论,仅有一个 CI bot 确认该 PR 安全可合并,且指出 0 个失败与 PR 相关。

实现拆解

  1. 定位问题:在test/registered/unit/mem_cache/test_dsa_pool_host_unit.py中,test_device_to_host_indexer_direct方法调用_run_device_to_host_indexer_copy(io_backend="direct"),构建DSATokenToKVPool时因page_size=1(HIP 默认值)触发了 ROCm 7.2.0 的 assert。
  2. 添加 skip 装饰器:在test_device_to_host_indexer_direct方法上方添加@unittest.skipIf(is_hip(), ...),跳过条件和注释与已有的test_device_to_host_indexer_kernel的 skip 一致。
  3. 验证:通过两个 CI 运行(mi3xx 标准 AMD 和 rocm720)确认修复有效,所有 14 个 partition 通过。
文件 模块 状态 重要度
test/registered/unit/mem_cache/test_dsa_pool_host_unit.py 测试 modified 3.95

关键源码片段

test/registered/unit/mem_cache/test_dsa_pool_host_unit.py test-coverage

唯一修改文件,添加了条件 skip 装饰器以修复 AMD ROCm 7.2.0 上的 CI 失败。

# 在 test_device_to_host_indexer_direct 方法前添加 skipIf 装饰器
# 原 kernel 变体已有相同 skip,保持一致
​
    @unittest.skipIf(
        is_hip(),
        '`io_backend="kernel"` path in memory_pool_host.backup_from_device_all_layer '
        "raises ValueError on AMD (only the `direct` IO backend is wired for ROCm). "
        "The other 62 tests in this file pass on AMD.",
    )
    def test_device_to_host_indexer_kernel(self):
        self._run_device_to_host_indexer_copy(io_backend="kernel")
​
    # 新增:跳过 AMD 上使用 direct 后端的设备到主机拷贝测试
    # 原因:ROCm 7.2.0 中 DSATokenToKVPool 要求 page_size % 16 == 0
    # 但 HIP 默认 page_size=1 导致断言失败。
    @unittest.skipIf(
        is_hip(),
        "DSATokenToKVPool with page_size=1 (used on HIP) trips the ROCm 7.2.0 "
        "HIP-preshuffle assert `page_size % 16 == 0` during pool construction "
        "(seen on pr-test-amd-rocm720). The rest of this file passes on AMD.",
    )
    def test_device_to_host_indexer_direct(self):
        self._run_device_to_host_indexer_copy(io_backend="direct")

评论区精华

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

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

风险与影响

风险极低。变更仅在 AMD 平台跳过一项测试,不修改任何生产代码。direct IO 后端在 HIP 上是唯⼀可用的后端(kernel 后端已跳过),但 skip 后不会影响任何功能验证,因为该测试只验证设备到主机拷贝的正确性,而其他测试(TestDSAOffloadSignatures等 62 个)仍然运行。

影响范围局限于pr-test-amd-rocm720 CI 测试。跳过该测试后,rocm720 上不再因此断言失败,其余 AMD CI 无影响。对用户无影响,仅 CI 维护者受益。

仅测试变更 平台特定修复

关联 Issue

未识别关联 Issue

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

完整报告

参与讨论