Repository navigation
[MoonEP] BF16 PoC integration for Kimi-K3 #33249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
bb5c7f8
d131f24
5765a50
7fc1832
87f3e47
88e185d
ffdf6f9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -149,6 +149,7 @@ def create_moe_dispatcher(moe_runner_config: MoeRunnerConfig) -> BaseDispatcher: | |
| return StandardDispatcher(moe_runner_config) | ||
| elif ( | ||
| a2a_backend.is_deepep() | ||
| or a2a_backend.is_moonep() | ||
| or a2a_backend.is_mooncake() | ||
| or a2a_backend.is_mori() | ||
| or a2a_backend.is_nixl() | ||
|
|
@@ -396,9 +397,24 @@ def __init__( | |
| f"quant_method={type(self.quant_method).__name__})." | ||
| ) | ||
|
|
||
| moonep_global_weight_storage = get_moe_a2a_backend().is_moonep() | ||
| if moonep_global_weight_storage: | ||
| if quant_config is not None: | ||
| raise NotImplementedError( | ||
| "MoonEP PoC supports unquantized BF16 MoE weights only." | ||
| ) | ||
| if num_fused_shared_experts != 0: | ||
| raise NotImplementedError( | ||
| "MoonEP PoC does not support fused shared experts yet." | ||
| ) | ||
|
|
||
| self.quant_method.create_weights( | ||
| layer=self, | ||
| num_experts=self.num_local_experts, | ||
| num_experts=( | ||
| self.num_experts | ||
| if moonep_global_weight_storage | ||
| else self.num_local_experts | ||
| ), | ||
| hidden_size=hidden_size, | ||
| intermediate_size_per_partition=self.intermediate_size_per_partition, | ||
| params_dtype=params_dtype, | ||
|
|
@@ -410,6 +426,13 @@ def __init__( | |
| with_bias=with_bias, | ||
| moe_intermediate_size=intermediate_size, | ||
| ) | ||
| if moonep_global_weight_storage: | ||
| self.w13_weight._sglang_require_global_experts = True | ||
| self.w2_weight._sglang_require_global_experts = True | ||
| if getattr(self, "w13_weight_bias", None) is not None: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we explicitly reject expert bias for the MoonEP PoC? We mark the bias tensors as requiring global experts when they exist, but I don't think bias support needs to be added in this PoC: a fail fast |
||
| self.w13_weight_bias._sglang_require_global_experts = True | ||
| if getattr(self, "w2_weight_bias", None) is not None: | ||
| self.w2_weight_bias._sglang_require_global_experts = True | ||
|
|
||
| self.quant_method.create_moe_runner(self, self.moe_runner_config) | ||
| self.dispatcher = create_moe_dispatcher(self.moe_runner_config) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One concern with routing MoonEP through
MaybeTboDeepEPDispatcher: when TBO is enabled, the wrapper creates twoMoonEPDispatcherinstances, but both appear to resolve through the same process wideMoonEPBuffercache.The buffer key is based on the static MoonEP dimensions +
id(group), without dispatcher/in-flight identity, so two otherwise identical inner dispatchers will reuse the same underlyingmoonep.Buffer. That seems unsafe for overlapping sub-batches, especially since MoonEP'sdispatch_a/bandcombine_a/bare intentionally not implemented yet.For this PoC, could we keep MoonEP on the single synchronous path and explicitly reject TBO/SBO at startup? Then overlap support can be added once there is an explicit ownership model for multiple in-flight MoonEP buffers/plans.