[Perf] Optimize fused_topk_bias for DSv4, 1.5~2x kernel performance improvement (#47463)

Signed-off-by: yewentao256 <zhyanwentao@126.com>
This commit is contained in:
Wentao Ye
2026-07-15 23:40:55 +00:00
committed by GitHub
parent 015b0320de
commit 2dab187f75
3 changed files with 78 additions and 69 deletions
+2 -2
View File
@@ -153,9 +153,9 @@ def test_fused_topk_softplus_sqrt_hash(
# experts.
hash_indices_table = torch.stack(
[torch.randperm(num_experts)[:topk] for _ in range(vocab_size)]
).to(device="cuda", dtype=torch.int32)
).to(device="cuda", dtype=torch.long)
input_ids = torch.randint(
0, vocab_size, (num_tokens,), dtype=torch.int32, device="cuda"
0, vocab_size, (num_tokens,), dtype=torch.long, device="cuda"
)
topk_weights_ref, topk_ids_ref = _torch_topk_softplus_sqrt(