Apply new moe align block size kernel (#14134)
This commit is contained in:
@@ -54,7 +54,10 @@ def moe_align_block_size(
|
|||||||
- The padding ensures that the total number of tokens is now divisible
|
- The padding ensures that the total number of tokens is now divisible
|
||||||
by block_size for proper block matrix operations.
|
by block_size for proper block matrix operations.
|
||||||
"""
|
"""
|
||||||
max_num_tokens_padded = topk_ids.numel() + (num_experts + 1) * (block_size - 1)
|
if topk_ids.numel() < num_experts + 1:
|
||||||
|
max_num_tokens_padded = topk_ids.numel() * block_size
|
||||||
|
else:
|
||||||
|
max_num_tokens_padded = topk_ids.numel() + (num_experts + 1) * (block_size - 1)
|
||||||
sorted_ids = torch.empty(
|
sorted_ids = torch.empty(
|
||||||
(max_num_tokens_padded,), dtype=torch.int32, device=topk_ids.device
|
(max_num_tokens_padded,), dtype=torch.int32, device=topk_ids.device
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user