Skip to content

[None][feat] Add kimi_k2/glm_5 grouped routing and fused router to bench_moe#16830

Open
guqiqi wants to merge 1 commit into
NVIDIA:mainfrom
guqiqi:20260712-dev-bench-moe
Open

[None][feat] Add kimi_k2/glm_5 grouped routing and fused router to bench_moe#16830
guqiqi wants to merge 1 commit into
NVIDIA:mainfrom
guqiqi:20260712-dev-bench-moe

Conversation

@guqiqi

@guqiqi guqiqi commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Dev Engineer Review

  • Updates tests/microbenchmarks/bench_moe/mapping.py to construct DeepSeekV3MoeRoutingMethod with is_fused=True, enabling the fused DeepSeek-V3 routing path for this benchmark configuration.
  • Fixes grouped-routing configuration for Kimi-K2 and adds GLM-5: tests/microbenchmarks/bench_moe/specs.py updates kimi_k2 to n_group=1/topk_group=1 and adds a new glm_5 ModelSpec with routing_method="DEEPSEEK_V3", n_group=1/topk_group=1, and quant_algo=None.
  • Prevents sweep failures by pruning unsupported MegaMoE-DeepGemm + TEP combinations early: tests/microbenchmarks/bench_moe/search.py rejects MEGAMOE_DEEPGEMM when enable_dp is false (TEP) and world_size > 1, recording the candidate as skipped instead of hard-failing during backend initialization.
  • Scope is limited to bench_moe microbenchmark code/specs; no unrelated config/test-list changes were made.

QA Engineer Review

  • Updated test/benchmark code under tests/microbenchmarks/bench_moe/:
    • mapping.py: _create_routing_method (DeepSeek-V3 routing construction now uses is_fused=True).
    • search.py: is_candidate_valid (adds early prune for MEGAMOE_DEEPGEMM + TEP when enable_dp is false and world_size > 1).
    • specs.py: BUILT_IN_MODELS registry (adds glm_5, updates kimi_k2 routing grouping to n_group=1/topk_group=1).
  • No corresponding entries were found in tests/integration/test_lists/ (e.g., test-db/, qa/, waives.txt) for bench_moe/microbenchmarks/bench_moe.
  • Verdict: needs follow-up.

Description

This PR adds bench_moe support for two additional MoE models and fixes a routing
configuration issue for Kimi-K2:

  • specs.py: set kimi_k2 n_group=1/topk_group=1. Real Kimi-K2 uses a single
    expert group; the previous multi-group value tripped the TRT-LLM routing kernel
    assertion topk_group <= 4 and failed the build. Also adds a glm_5 model spec
    (256 experts, top-8, DeepSeek-V3-style single-group routing).
  • mapping.py: use the fused DeepSeek-V3 routing path (is_fused=True) for these specs.
  • search.py: mark the MEGAMOE_DEEPGEMM + TEP combination as skipped rather than a
    hard build failure. That kernel assumes a partitioned MoE input, whereas TEP replicates
    the tensor TP-wide, so the combination is not valid and should be pruned from the sweep.

The change is scoped entirely to the bench_moe benchmarking utility and does not touch
runtime/serving code paths.

Test Coverage

Validated by running the bench_moe sweep locally for kimi_k2 and glm_5:
the previously-failing Kimi-K2 routing build now succeeds, glm_5 is enumerated and
benchmarked, and MEGAMOE_DEEPGEMM+TEP entries are reported as skipped instead of aborting
the sweep.

PR Checklist

  • Please check this after reviewing the above items as appropriate for this PR.

GitHub Bot Help

To see a list of available CI bot commands, please comment /bot help.

@guqiqi
guqiqi requested a review from a team as a code owner July 24, 2026 06:20
@guqiqi
guqiqi requested review from leslie-fang25 and rosong11 July 24, 2026 06:20
@guqiqi
guqiqi force-pushed the 20260712-dev-bench-moe branch from 876efbc to d738c12 Compare July 24, 2026 06:24
@guqiqi guqiqi changed the title [bench_moe] kimi_k2/glm_5 grouped routing + fused router + prune MegaMoE-DeepGemm TEP [None][feat] Add kimi_k2/glm_5 grouped routing and fused router to bench_moe Jul 24, 2026
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 14941af4-4ac8-4750-9b0b-9700686b74a1

📥 Commits

Reviewing files that changed from the base of the PR and between 201960c and f73f203.

📒 Files selected for processing (3)
  • tests/microbenchmarks/bench_moe/mapping.py
  • tests/microbenchmarks/bench_moe/search.py
  • tests/microbenchmarks/bench_moe/specs.py
🚧 Files skipped from review as they are similar to previous changes (3)
  • tests/microbenchmarks/bench_moe/mapping.py
  • tests/microbenchmarks/bench_moe/search.py
  • tests/microbenchmarks/bench_moe/specs.py

Walkthrough

The MoE microbenchmark adds a glm_5 model specification, updates kimi_k2 routing groups, enables fused DeepSeek V3 routing, and rejects unsupported multi-rank MEGAMOE_DEEPGEMM candidates.

Changes

MoE benchmark updates

Layer / File(s) Summary
Model and routing setup
tests/microbenchmarks/bench_moe/specs.py, tests/microbenchmarks/bench_moe/mapping.py
Adds the glm_5 model spec, sets kimi_k2 routing groups to 1, and enables fused DeepSeek V3 routing.
Backend candidate validation
tests/microbenchmarks/bench_moe/search.py
Rejects MEGAMOE_DEEPGEMM candidates when attention data parallelism is disabled and world_size > 1.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: leslie-fang25

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the PR's main changes and follows the required [None][feat] format.
Description check ✅ Passed The description includes the required Description, Test Coverage, and PR Checklist sections with relevant details.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@guqiqi
guqiqi force-pushed the 20260712-dev-bench-moe branch from d738c12 to 201960c Compare July 24, 2026 06:26
…nch_moe

- specs.py: set kimi_k2 n_group=1/topk_group=1 (real Kimi-K2 uses a single
  expert group; avoids the TRTLLM routing kernel topk_group<=4 failure); add
  glm_5 model spec (256 experts, top-8, DeepSeek-V3-style single-group routing).
- mapping.py: use fused DeepSeek-V3 routing (is_fused=True).
- search.py: prune MEGAMOE_DEEPGEMM + TEP as skipped instead of a hard build
  failure (kernel assumes partitioned MoE input; TEP replicates TP-wide).

Signed-off-by: kikig <29116997+guqiqi@users.noreply.github.com>
@guqiqi
guqiqi force-pushed the 20260712-dev-bench-moe branch from 201960c to f73f203 Compare July 24, 2026 06:35
@guqiqi

guqiqi commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61523 [ run ] triggered by Bot. Commit: f73f203 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61523 [ run ] completed with state SUCCESS. Commit: f73f203
/LLM/main/L0_MergeRequest_PR pipeline #49739 completed with status: 'SUCCESS'

CI Report

Link to invocation

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