Repository navigation
[TRTLLM-17824][fix] Decline EPLB in modeling_v2 targets that do not implement it - #22277
Closed
ruocheng-nv wants to merge 3 commits into
Closed
ruocheng-nv wants to merge 3 commits into
ruocheng-nv wants to merge 3 commits into
Conversation
…mplement it The loader creates the MoE load balancer around whichever class it builds, but a modeling_v2 target takes part only by registering its MoE layers with it. No target does, so a deployment that sets modeling_v2 together with EPLB ran on fixed expert windows: static EPLB lost its replicas silently, and online EPLB gave the balancer no layer to update. - moe_load_balancer.py: moe_load_balancer_mode() reports the EPLB mode the engine runs (static, online or per_layer_dynamic) or None, and maybe_create_moe_load_balancer creates a balancer exactly when it returns a mode. - modeling_v2 resolver: after route returns a target, a deployment that runs EPLB in a mode the target does not list in EPLB_MODES is NoTarget, so auto keeps Modeling V1 and require says why. An unknown name in EPLB_MODES is an error. - README: document EPLB_MODES. Signed-off-by: Ruocheng Jia <ruochengj@nvidia.com>
This was referenced Nov 14, 2026
Collaborator
Author
|
/bot run |
Signed-off-by: Ruocheng Jia <ruochengj@nvidia.com> # Conflicts: # tensorrt_llm/_torch/_experimental/modeling_v2/README.md # tensorrt_llm/_torch/_experimental/modeling_v2/_router_index.py # tests/unittest/_torch/modeling_v2/test_modeling_v2_routing.py
…ith main Signed-off-by: Ruocheng Jia <ruochengj@nvidia.com>
Collaborator
Author
|
/bot run |
Collaborator
|
PR_Github #84984 [ run ] triggered by Bot. Commit: |
Collaborator
Author
|
Folded into #22282, whose branch already contains this commit; reviewing the resolver check there together with the first target that implements EPLB. |
Collaborator
|
PR_Github #84984 [ run ] completed with state
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
A deployment that sets
modeling_v2(autoorrequire) together withmoe_config.load_balancerbuilds a Modeling V2 target whenever itsrouteclaims the layout, but no target registers its MoE layers with the load balancer. The loader still creates the balancer (maybe_create_moe_load_balancer), so static EPLB runs on the target's fixed expert windows and the replicas thatnum_slots/initial_global_assignmentsask for are dropped without an error, and online EPLB finalizes a balancer with no layer, whereMoeLoadBalancer::generateUpdatePlanreadsfront()of an empty plan. This affects the DeepSeek-R1 and gpt-oss default targets at their EP layouts whenmodeling_v2is set explicitly, and the GLM-5.2 tep4 target, which is built by default.This PR makes EPLB support an explicit property of a target and checks it once, for every target:
moe_load_balancer.py:moe_load_balancer_mode(model_config, mapping)returns the EPLB mode the engine runs (staticfor standard EPLB withlayer_updates_per_iter == 0,online, orper_layer_dynamic), orNonewhen no balancer is created (no config, an architecture outsidemoe_model_arch_list, one EP rank, smart routing).maybe_create_moe_load_balancernow creates a balancer exactly when it returns a mode; its behavior is unchanged._router_index.modeling_v2_resolve: afterroutereturns a target, a deployment that runs EPLB in a mode the target class does not list inEPLB_MODESisNoTarget.autokeeps Modeling V1, which implements EPLB, andrequireraises with the reason.EPLB_MODESis empty unless a target sets it, so every current target declines EPLB until it implements it. A name inEPLB_MODESthat is not an EPLB mode raisesValueError, because a misspelled mode would decline every EPLB deployment without a word.modeling_v2/README.md: the rule is documented under Routing and in the steps for adding a target.Deployments without EPLB resolve as before, and so do EPLB deployments that leave
modeling_v2at its default for the DeepSeek-R1 and gpt-oss targets, which are@disable_v2_by_default.This is the first part of TRTLLM-17824. Follow-up PRs implement static and then online EPLB in the DeepSeek-R1 target and declare them in its
EPLB_MODES.Test Coverage
tests/unittest/_torch/moe/test_moe_load_balancer.py(CPU;unittest/_torch/moeis inl0_cpu):test_moe_load_balancer_modecovers static, online and per-layer dynamic EPLB, no config, one EP rank, and an architecture outsidemoe_model_arch_list.test_maybe_create_moe_load_balancer_follows_the_modechecks, with the runtime mocked, that the loader creates a balancer exactly for those modes.tests/unittest/_torch/modeling_v2/test_modeling_v2_routing.py(CPU,l0_cpu): a target withoutEPLB_MODESis declined for each mode (autoreturns the built-in model,requireraises naming the mode); a target that listsstaticis built for static EPLB only; deployments where the engine creates no balancer are unaffected; an unknown mode name is an error; DeepSeek-R1 and gpt-oss at dep4 and GLM-5.2 at tep4 with EPLB keep the built-in model.Local results in the CI image (
pytorch-26.09-py3-x86_64-ubuntu24.04-skip-tritondevel-202611030656-21516) with a recent CI wheel and this PR's two modules copied over it:l0_cpumodeling_v2 test files show the same failures with and without this PR's modules (the wheel predates some of those tests).PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
If PR introduces API changes, an appropriate PR label is added - either
api-compatibleorapi-breaking. Forapi-breaking, includeBREAKINGin the PR title.Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
Update tava architecture diagram if there is a significant design change in PR.
The reviewers assigned automatically/manually are appropriate for the PR.
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.