Repository navigation
feat(mori-ep): Add MoRI Expert Parallelism support for ROCm - #977
Conversation
AI Code Review - PR #977Status: BLOCKING Summary: P0/0 · P1/2 · P2/2 · P3/0 Blocking IssuesP1
Non-blocking SuggestionsP2
Checklist Violations (20 fail / 93 total)General Principles Checklist
RTP-LLM Checklist
Python Static-First Checklist
Strengths
|
AI Code Review - PR #977Status: BLOCKING Summary: P0/0 · P1/1 · P2/2 · P3/0 Blocking IssuesP1
Non-blocking SuggestionsP2
Checklist Violations (12 fail / 56 total)General Principles Checklist
Python Static-First Checklist
Strengths
|
AI Code Review - PR #977Status: LGTM Summary: P0/0 · P1/0 · P2/3 · P3/0 lgtm ready to ci Non-blocking SuggestionsP2
Checklist Violations (12 fail / 56 total)General Principles Checklist
RTP-LLM Checklist
Python Static-First Checklist
Strengths
|
1069362 to
3214d3a
Compare
AI Code Review - PR #977Status: BLOCKING Summary: P0/0 · P1/2 · P2/1 · P3/0 Blocking IssuesP1
Non-blocking SuggestionsP2
Checklist Violations (5 fail / 56 total)General Principles Checklist
Strengths
|
AI Code Review - PR #977Status: LGTM Summary: P0/0 · P1/0 · P2/3 · P3/0 lgtm ready to ci Non-blocking SuggestionsP2
Checklist Violations (9 fail / 67 total)General Principles Checklist
RTP-LLM Checklist
Python Static-First Checklist
Strengths
|
33f4344 to
1a842ad
Compare
AI Code Review - PR #977Status: BLOCKING Summary: P0/0 · P1/3 · P2/2 · P3/0 Blocking IssuesP1
Non-blocking SuggestionsP2
Checklist Violations (14 fail / 56 total)General Principles Checklist
RTP-LLM Checklist
Python Static-First Checklist
Strengths
|
1a842ad to
942d2a7
Compare
AI Code Review - PR #977Status: BLOCKING Summary: P0/0 · P1/3 · P2/2 · P3/0 Blocking IssuesP1
Non-blocking SuggestionsP2
Checklist Violations (18 fail / 56 total)General Principles Checklist
RTP-LLM Checklist
Python Static-First Checklist
Strengths
|
AI Code Review - PR #977Status: BLOCKING Summary: P0/0 · P1/1 · P2/2 · P3/0 Blocking IssuesP1
Non-blocking SuggestionsP2
Checklist Violations (14 fail / 67 total)General Principles Checklist
RTP-LLM Checklist
Python Static-First Checklist
Strengths
|
AI Code Review - PR #977Status: BLOCKING Summary: P0/0 · P1/1 · P2/3 · P3/0 Blocking IssuesP1
Non-blocking SuggestionsP2
Checklist Violations (17 fail / 83 total)General Principles Checklist
RTP-LLM Checklist
Python Static-First Checklist
Strengths
|
7ecc663 to
9cee69f
Compare
AI Code Review - PR #977Status: LGTM Summary: P0/0 · P1/0 · P2/3 · P3/0 lgtm ready to ci Non-blocking SuggestionsP2
Checklist Violations (5 fail / 56 total)General Principles Checklist
Strengths
|
025e986 to
eb41f58
Compare
|
internal source has been updated, please review the changes! |
5ec2e71 to
f7b9023
Compare
AI Code Review - PR #977Status: BLOCKING Summary: P0/0 · P1/1 · P2/3 · P3/0 Blocking IssuesP1
Non-blocking SuggestionsP2
Checklist Violations (23 fail / 88 total)General Principles Checklist
RTP-LLM Checklist
Python Static-First Checklist
Strengths
|
AI Code Review - PR #977Status: BLOCKING Summary: P0/0 · P1/1 · P2/2 · P3/0 Blocking IssuesP1
Non-blocking SuggestionsP2
Checklist Violations (4 fail / 56 total)General Principles Checklist
Strengths
|
AI Code Review - PR #977Status: BLOCKING Summary: P0/0 · P1/1 · P2/2 · P3/0 Blocking IssuesP1
Non-blocking SuggestionsP2
Checklist Violations (10 fail / 60 total)General Principles Checklist
RTP-LLM Checklist
Python Static-First Checklist
Strengths
|
AI Code Review - PR #977Status: BLOCKING Summary: P0/0 · P1/1 · P2/3 · P3/0 Blocking IssuesP1
Non-blocking SuggestionsP2
Checklist Violations (12 fail / 76 total)General Principles Checklist
RTP-LLM Checklist
Python Static-First Checklist
Strengths
|
0fba1a4 to
15d78e9
Compare
AI Code Review - PR #977Status: BLOCKING Summary: P0/0 · P1/1 · P2/3 · P3/0 Blocking IssuesP1
Non-blocking SuggestionsP2
Checklist Violations (11 fail / 97 total)General Principles Checklist
RTP-LLM Checklist
Strengths
|
AI Code Review - PR #977Status: BLOCKING Summary: P0/0 · P1/1 · P2/3 · P3/0 Blocking IssuesP1
Non-blocking SuggestionsP2
Checklist Violations (13 fail / 88 total)General Principles Checklist
RTP-LLM Checklist
Python Static-First Checklist
Strengths
|
AI Code Review - PR #977Status: BLOCKING Summary: P0/0 · P1/1 · P2/3 · P3/0 Blocking IssuesP1
Non-blocking SuggestionsP2
Checklist Violations (12 fail / 76 total)General Principles Checklist
RTP-LLM Checklist
Python Static-First Checklist
Strengths
|
467b898 to
47e1823
Compare
AI Code Review - PR #977Status: LGTM Summary: P0/0 · P1/0 · P2/3 · P3/0 lgtm ready to ci Non-blocking SuggestionsP2
Checklist Violations (11 fail / 76 total)General Principles Checklist
RTP-LLM Checklist
Python Static-First Checklist
Strengths
|
|
internal source has been updated, please review the changes! |
2 similar comments
|
internal source has been updated, please review the changes! |
|
internal source has been updated, please review the changes! |
47e1823 to
c589394
Compare
AI Code Review - PR #977Status: LGTM Summary: P0/0 · P1/0 · P2/3 · P3/0 lgtm ready to ci Non-blocking SuggestionsP2
Checklist Violations (11 fail / 76 total)General Principles Checklist
RTP-LLM Checklist
Python Static-First Checklist
Strengths
|
|
internal source has been updated, please review the changes! |
c589394 to
307caeb
Compare
AI Code Review - PR #977Status: LGTM Summary: P0/0 · P1/0 · P2/3 · P3/0 lgtm ready to ci Non-blocking SuggestionsP2
Checklist Violations (10 fail / 76 total)General Principles Checklist
RTP-LLM Checklist
Python Static-First Checklist
Strengths
|
|
internal source has been updated, please review the changes! |
307caeb to
ebb9a47
Compare
AI Code Review - PR #977Status: LGTM Summary: P0/0 · P1/0 · P2/3 · P3/0 lgtm ready to ci Non-blocking SuggestionsP2
Checklist Violations (5 fail / 72 total)General Principles Checklist
RTP-LLM Checklist
Strengths
|
|
internal source has been updated, please review the changes! |
AI Code Review - PR #977Status: LGTM Summary: P0/0 · P1/0 · P2/3 · P3/0 lgtm ready to ci Non-blocking SuggestionsP2
Checklist Violations (5 fail / 56 total)General Principles Checklist
Strengths
|
Add MoRI-based expert parallelism (EP) as an alternative to DeepEP for ROCm GPUs, enabling efficient intranode and internode dispatch/combine for MoE models. Core components: - MoriEPWrapper: singleton wrapper around mori EpDispatchCombineOp - MoriEpIntranodeRouter: EP router with dispatch/combine flow, chunked dispatch for large token counts, and global-to-local ID remapping for fused expert kernels - MoriEpFp4Strategy: strategy pairing MoRI router with FP4 executor - RocmEpNormalStrategy: MoRI router as first-class option alongside DeepEP, with mutual exclusion validation Config flow: - --use_mori_ep CLI flag (env: USE_MORI_EP) → deep_ep_config → auto_configure_deepep() → moe_config.use_mori_ep - C++ MoeConfig.use_mori_ep field with pybind binding - MoEConfigAdapter exposes use_mori_ep and use_deepep_moe Bazel: moriep_wrapper py_library target with modules dependency.
- FakeBalanceExpert ROCm C++ op for expert load balancing testing - MoriEpIntranodeRouter unit tests - BlockPoolConfigHelper adjustment for MoE cache allocation
- Remove TP-only unified allreduce optimization that caused numerical differences vs main branch (12 smoke test failures) - Remove dead skip_allreduce code from FusedMoe.forward() and the entire router finalize() chain (base class, all implementations, associated test) - Fix golden JSON files with Unicode curly quotes (rebuild with json.dump) - Update stale golden values from CI actual output - Refactor moriep_intranode_router_test to use production MoriEpIntranodeRouter instead of duplicated inline helpers - Fix use_all_gather early return swallowing explicit USE_MORI_EP config
BatchGenerateCall (used by /batch_infer) bypasses PrefillRpcServer, so PD separation is not applied. Add explicit endpoint "/" to the PD golden so that prompt_batch queries go through the PD-aware GenerateStreamCall path, matching main's behavior.
The model generates Unicode right single quote (') in PD streaming
path, not ASCII apostrophe ('). Update golden to match actual output.
4fb691f to
597eabf
Compare
AI Code Review - PR #977Status: BLOCKING Summary: P0/0 · P1/1 · P2/1 · P3/0 Blocking IssuesP1
Non-blocking SuggestionsP2
Checklist Violations (10 fail / 109 total)General Principles Checklist
RTP-LLM Checklist
Strengths
|
MoriEP was passing parallelism_config.world_size to mori config, which would mismatch ep_rank when TP×EP/DP co-existence is introduced. Fix by using ep_size and adding explicit assertions that ep_size == world_size (the only currently supported configuration) in both init paths. Add corresponding validation test.
AI Code Review - PR #977Status: LGTM Summary: P0/0 · P1/0 · P2/3 · P3/0 lgtm ready to ci Non-blocking SuggestionsP2
Checklist Violations (14 fail / 56 total)General Principles Checklist
RTP-LLM Checklist
Python Static-First Checklist
Strengths
|
|
internal source has been updated, please review the changes! |
This PR introduces MoRI (Model-parallel Routing with Intranode) Expert Parallelism support for ROCm/MI300 platforms, enabling
efficient MoE model inference with EP (Expert Parallelism) on AMD GPUs.
Commit 1: feat: add MoriEP expert parallelism support for ROCm
Core MoRI EP infrastructure and integration:
dispatch/combine), with unit tests.
for unified allreduce optimization.
fused_moe and DenseMLP, then do a single allreduce after combining routed experts, shared expert, and gate scaling. Fixes garbled
output on Qwen3.5-397B-A17B with EP=8 TP=8.
Commit 2: feat: add fake balance expert and MoriEP tests
Testing and load-balancing utilities: