[fix] Add support for flashinfer MOE A2A to Qwen3 BF16 model path (#26255)

This commit is contained in:
Daniel Stokes
2026-07-01 01:59:54 -07:00
committed by GitHub
parent 677a11bfa9
commit 8ee200972e
3 changed files with 112 additions and 0 deletions
@@ -753,6 +753,14 @@ void topk_softmax(
const int num_tokens = static_cast<int>(gating_output.size(0));
const int topk = static_cast<int>(topk_weights.size(-1));
// No tokens on this DP rank, no need to do anything
if (num_tokens == 0) {
return;
}
TORCH_CHECK(num_experts > 0, "num_experts must be greater than 0");
TORCH_CHECK(topk > 0, "topk must be greater than 0");
const bool is_pow_2 = (num_experts != 0) && ((num_experts & (num_experts - 1)) == 0);
const bool needs_workspace = !is_pow_2 || num_experts > 512;
const int64_t workspace_size = needs_workspace ? num_tokens * num_experts : 0;
@@ -822,4 +830,7 @@ void topk_softmax(
} else {
TORCH_CHECK(false, "Unsupported gating_output dtype: ", dtype);
}
auto launch_error = cudaGetLastError();
TORCH_CHECK(launch_error == cudaSuccess, "topk_softmax launch error: ", cudaGetErrorString(launch_error));
}