88
99The inference path fuses the grouped experts (``fused_grouped_experts``) AND flips
1010the DeepEP dispatcher to the cudagraph-able EXPAND layout (``deepep_inference``).
11- Because ``grouped_experts `` and ``token_dispatcher`` are sibling config nodes under
11+ Because ``inner_experts `` and ``token_dispatcher`` are sibling config nodes under
1212``moe.routed_experts`` (neither an ancestor of the other), both overrides can be
1313applied together without the ancestor/descendant conflict that a single combined
1414node would cause.
3636
3737# fused_swiglu registers both the dense-FFN and the routed-experts (fused_grouped_experts)
3838# overrides; the test MoE config has no dense FeedForward node, so importing it only
39- # claims the grouped_experts node here.
39+ # claims the inner_experts node here.
4040_FUSED_SWIGLU = "torchtitan.overrides.fused_swiglu"
4141_DEEPEP_INFERENCE = "torchtitan.overrides.deepep_inference"
4242
@@ -67,7 +67,7 @@ def _moe_config(comm_backend: str):
6767class TestInferenceMoEOverrides (unittest .TestCase ):
6868 def test_grouped_experts_and_dispatcher_are_siblings (self ):
6969 cfg = _moe_config ("deepep" )
70- self .assertIsInstance (cfg .routed_experts .grouped_experts , GroupedExperts .Config )
70+ self .assertIsInstance (cfg .routed_experts .inner_experts , GroupedExperts .Config )
7171 self .assertIsInstance (
7272 cfg .routed_experts .token_dispatcher , DeepEPTokenDispatcher .Config
7373 )
@@ -76,15 +76,15 @@ def test_deepep_both_overrides_apply_without_conflict(self):
7676 cfg = _moe_config ("deepep" )
7777
7878 # Both overrides on the same actor: the experts-fusion claims
79- # grouped_experts , the dispatcher flip claims the sibling dispatcher.
79+ # inner_experts , the dispatcher flip claims the sibling dispatcher.
8080 replacements = apply_overrides (
8181 OverrideConfig (imports = [_FUSED_SWIGLU , _DEEPEP_INFERENCE ]),
8282 cfg ,
8383 )
8484
8585 self .assertEqual (len (replacements ), 2 )
8686 self .assertIsInstance (
87- cfg .routed_experts .grouped_experts , FusedGroupedExperts .Config
87+ cfg .routed_experts .inner_experts , FusedGroupedExperts .Config
8888 )
8989 self .assertIsInstance (
9090 cfg .routed_experts .token_dispatcher , DeepEPTokenDispatcher .Config
@@ -103,31 +103,31 @@ def test_non_deepep_dispatcher_flip_is_noop(self):
103103
104104 self .assertEqual (len (replacements ), 1 )
105105 self .assertIsInstance (
106- cfg .routed_experts .grouped_experts , FusedGroupedExperts .Config
106+ cfg .routed_experts .inner_experts , FusedGroupedExperts .Config
107107 )
108108
109109 def test_composition_is_order_independent (self ):
110- # Because grouped_experts and dispatcher are disjoint sibling nodes, applying
110+ # Because inner_experts and dispatcher are disjoint sibling nodes, applying
111111 # the experts-fusion and the dispatcher-flip in either order must yield the
112112 # same result (unlike an ancestor/descendant pair, where an ancestor
113113 # replacement would detach the descendant's claimed subtree).
114114 def summarize (ge ):
115115 return (
116- type (ge .grouped_experts ).__qualname__ ,
116+ type (ge .inner_experts ).__qualname__ ,
117117 type (ge .token_dispatcher ).__qualname__ ,
118118 ge .token_dispatcher .cudagraphable ,
119119 )
120120
121121 a = _moe_config ("deepep" ).routed_experts
122- a .grouped_experts = fused_grouped_experts (a .grouped_experts )
122+ a .inner_experts = fused_grouped_experts (a .inner_experts )
123123 a .token_dispatcher = deepep_inference (a .token_dispatcher )
124124
125125 b = _moe_config ("deepep" ).routed_experts
126126 b .token_dispatcher = deepep_inference (b .token_dispatcher )
127- b .grouped_experts = fused_grouped_experts (b .grouped_experts )
127+ b .inner_experts = fused_grouped_experts (b .inner_experts )
128128
129129 self .assertEqual (summarize (a ), summarize (b ))
130- self .assertIsInstance (a .grouped_experts , FusedGroupedExperts .Config )
130+ self .assertIsInstance (a .inner_experts , FusedGroupedExperts .Config )
131131 self .assertTrue (a .token_dispatcher .cudagraphable )
132132
133133 def test_trainer_uses_only_experts_fusion (self ):
@@ -138,7 +138,7 @@ def test_trainer_uses_only_experts_fusion(self):
138138 apply_overrides (OverrideConfig (imports = [_FUSED_SWIGLU ]), cfg )
139139
140140 self .assertIsInstance (
141- cfg .routed_experts .grouped_experts , FusedGroupedExperts .Config
141+ cfg .routed_experts .inner_experts , FusedGroupedExperts .Config
142142 )
143143 self .assertFalse (cfg .routed_experts .token_dispatcher .cudagraphable )
144144
0 commit comments