[Bugfix][MoE] Write Humming results to the supplied output buffer (#50338)
Signed-off-by: Netanel Haber <58652339+netanel-haber@users.noreply.github.com> Co-authored-by: OpenAI Codex <noreply@openai.com>
This commit is contained in:
co-authored by
OpenAI Codex
parent
837eae6458
commit
61cacd272f
@@ -662,12 +662,9 @@ class HummingIndexedExperts(HummingExpertsBase):
|
||||
topk_weights=topk_weights,
|
||||
topk_ids=topk_ids,
|
||||
expert_map=expert_map,
|
||||
outputs=buffers["output"],
|
||||
outputs=output,
|
||||
)
|
||||
|
||||
# Note: output is already written to buffers["output"]
|
||||
# which aliases workspace13/output
|
||||
|
||||
|
||||
class HummingGroupedExperts(HummingExpertsBase):
|
||||
def finalize_weight_and_reduce_impl(self) -> mk.TopKWeightAndReduce:
|
||||
@@ -777,16 +774,13 @@ class HummingGroupedExperts(HummingExpertsBase):
|
||||
)
|
||||
|
||||
moe_unpermute(
|
||||
out=buffers["output"],
|
||||
out=output,
|
||||
permuted_hidden_states=buffers["down_output"].view(*topk_ids.shape, -1),
|
||||
topk_weights=topk_weights,
|
||||
inv_permuted_idx=inv_perm,
|
||||
expert_first_token_offset=expert_first_token_offset,
|
||||
)
|
||||
|
||||
# Note: output is already written to buffers["output"]
|
||||
# which aliases workspace13/output
|
||||
|
||||
|
||||
class BatchedHummingGroupedExperts(HummingExpertsBase):
|
||||
def finalize_weight_and_reduce_impl(self) -> mk.TopKWeightAndReduce:
|
||||
@@ -880,13 +874,10 @@ class BatchedHummingGroupedExperts(HummingExpertsBase):
|
||||
layer=self.layer,
|
||||
inputs=inputs,
|
||||
input_scale=input_scale,
|
||||
outputs=buffers["down_output"].view(-1, hidden_states.size(-1)),
|
||||
outputs=output.view(-1, hidden_states.size(-1)),
|
||||
valid_shape_m=valid_shape_m,
|
||||
expert_layout=expert_num_tokens,
|
||||
compute_config=self.compute_config_str,
|
||||
tuning_config=self.w2_tuning_config_str,
|
||||
sublayer_name="w2",
|
||||
)
|
||||
|
||||
# Note: output is already written to buffers["down_output"]
|
||||
# which aliases workspace13/output
|
||||
|
||||
Reference in New Issue
Block a user