Commit 50e2de8d authored by zhanghj2's avatar zhanghj2
Browse files

处理lse为正无穷的情况

parent 5d8e93f6
...@@ -96,9 +96,12 @@ flash_fwd_mla_combine_kernel(const CombineParams params) { ...@@ -96,9 +96,12 @@ flash_fwd_mla_combine_kernel(const CombineParams params) {
} }
else else
{ {
float Attn_sink_exp2 = __builtin_amdgcn_exp2f(attn_sink * CUDART_L2E_F); if (!flash::is_positive_infinity(global_lse))
float lse_exp2 = __builtin_amdgcn_exp2f(global_lse * CUDART_L2E_F); {
o_scale = lse_exp2 / (lse_exp2 + Attn_sink_exp2); float Attn_sink_exp2 = __builtin_amdgcn_exp2f(attn_sink * CUDART_L2E_F);
float lse_exp2 = __builtin_amdgcn_exp2f(global_lse * CUDART_L2E_F);
o_scale = lse_exp2 / (lse_exp2 + Attn_sink_exp2);
}
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment