Skip to content

fix: fix module_mha_batch_prefill#808

Merged
LLLLKKKK merged 1 commit intomainfrom
fix/mha_batch_prefill
Mar 26, 2026
Merged

fix: fix module_mha_batch_prefill#808
LLLLKKKK merged 1 commit intomainfrom
fix/mha_batch_prefill

Conversation

@liaocz
Copy link
Copy Markdown
Collaborator

@liaocz liaocz commented Mar 20, 2026

No description provided.

@liaocz liaocz requested a review from LLLLKKKK as a code owner March 20, 2026 06:57
@LLLLKKKK
Copy link
Copy Markdown
Collaborator

PR #808: fix: fix module_mha_batch_prefill

Summary

This PR adds the missing module_mha_batch_prefill.so to the Bazel build system. The Python code at rtp_llm/models_py/modules/factory/attention/rocm_impl/aiter.py already calls aiter.mha_batch_prefill_func(), but the .so was never being built or copied — which would cause a runtime failure on ROCm when that code path is hit.

3 files changed (+7 / -0): 3rdparty/aiter/BUILD, open_source/deps/git.bzl, rtp_llm/libs/BUILD.


Review Checklist

Category Status Notes
Correctness All 3 files updated consistently — outs, cp commands, and build script generation all follow the exact pattern of existing modules (e.g. module_mha_fwd).
Compatibility ROCm-only change. CUDA builds unaffected. BUILD.aiter uses glob(["aiter/jit/*.so"]) so pre-built path picks it up automatically.
Performance No runtime impact. Slight build time increase from one additional JIT module.
Code Quality Follows existing patterns exactly. Insertion positions are logically grouped next to module_mha_fwd.
Testing 🟡 No tests added — acceptable for a build-system-only fix. Functional validation requires ROCm hardware.

Notes

  • No cc_library target added for module_mha_batch_prefill (unlike module_mha_fwd). This is fine since the module is currently only used from Python, not C++. If C++ usage is needed later, a cc_library will need to be added to 3rdparty/aiter/BUILD.
  • No corresponding C++ header file referenced — consistent with Python-only JIT usage.

Verdict

LGTM. Clean, minimal fix that correctly bridges the gap between the Python caller and the build system.


Automated review by CI bot

@LLLLKKKK
Copy link
Copy Markdown
Collaborator

🤖 AI Code Review — PR #808 fix: fix module_mha_batch_prefill


Summary: Adds the missing module_mha_batch_prefill.so to the Bazel build system. The Python code (aiter.py:281) already calls aiter.mha_batch_prefill_func(), but the .so was never built or copied, causing a runtime failure on ROCm.

Files changed: 3 (+7 / -0)


Review

Area Status Notes
Correctness All three build files updated consistently — 3rdparty/aiter/BUILD, open_source/deps/git.bzl, rtp_llm/libs/BUILD. Follows the exact pattern of existing modules (e.g., module_mha_fwd).
Compatibility Changes scoped to ROCm-specific targets (aiter_src_copy, aiter_copy). CUDA builds unaffected. Pre-built @aiter package uses glob(["aiter/jit/*.so"]) so no additional change needed.
Performance No runtime impact. Marginal build-time increase from one additional JIT-compiled module.
Code Quality Consistent with existing patterns. Logically grouped next to module_mha_fwd in all files.
Testing ⚠️ No tests added. Acceptable for a build-only fix — functional validation requires ROCm hardware.

Notes

  • No cc_library target is added for this module (unlike module_mha_fwd), which is fine since mha_batch_prefill is currently only consumed from Python via the aiter JIT system. A cc_library would be needed if C++ usage is added later.

Verdict

LGTM. Clean, minimal fix that closes the gap between the Python code using mha_batch_prefill_func and the build system that was not producing the required .so.

@liaocz liaocz force-pushed the fix/mha_batch_prefill branch from fe7a632 to c127f6b Compare March 22, 2026 07:34
@LLLLKKKK
Copy link
Copy Markdown
Collaborator

PR #808 — fix: fix module_mha_batch_prefill

🤖 AI Code Review

概述

module_mha_batch_prefill.so(aiter 的 batch prefill MHA kernel)加入 Bazel 构建系统的打包流程。此前该 .so 在构建产物中缺失,导致 ROCm 平台 Python 端调用 aiter.mha_batch_prefill_func() 时找不到对应模块。改动模式完全遵循已有的 module_mha_fwd 等模块的打包方式。

优点

  • 改动干净、范围小,3 个文件 +7 行,完全对齐已有模块的打包模式
  • 内源侧 internal_source/deps/git.bzl 已有对应改动,本次补齐开源侧遗漏,保持一致性

建议改进

P2 - 建议

  1. cc_library 目标缺失? module_mha_fwd3rdparty/aiter/BUILDBUILD.aiter 中都有 cc_library 目标,且被 rocm_impl/BUILDrocm/BUILD 引用。module_mha_batch_prefill 没有对应的 cc_library。目前 mha_batch_prefill_func 仅在 Python 端通过 aiter 包调用,不需要 C++ 链接依赖,所以当前不加是合理的。但如果未来有 C++ 侧调用需求,需要补充。

  2. 测试覆盖 作为构建修复,建议确认 CI 中 ROCm batch prefill 路径有 smoke test 覆盖。

总结

干净的构建修复,无正确性或兼容性风险。LGTM。

@liaocz liaocz force-pushed the fix/mha_batch_prefill branch from c127f6b to 20dbd4b Compare March 25, 2026 08:52
@LLLLKKKK
Copy link
Copy Markdown
Collaborator

🤖 AI Code Review — PR #808 v2 (fix: fix module_mha_batch_prefill)

v2 是 rebase onto main,PR 自身代码无变更。原始修复保持不变。

LGTM — rebase only。

Review by Claude | Commit: 20dbd4b

@LLLLKKKK LLLLKKKK merged commit 64069d6 into main Mar 26, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants