[fix] Add support for flashinfer MOE A2A to Qwen3 BF16 model path (#26255)
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user