Skip to content

Commit

Permalink
bugfix: fix prefill kernels' lse result for empty kv-cache (#440)
Browse files Browse the repository at this point in the history
Thank @hnyls2002 for spotting this bug.
  • Loading branch information
yzh119 authored Aug 13, 2024
1 parent c93f647 commit 6ac28f4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/flashinfer/attention/prefill.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -1558,7 +1558,7 @@ __launch_bounds__(num_warps_x* num_warps_z* warp_size) void BatchPrefillWithRagg
// normalize d
normalize_d<num_frags_x, num_frags_y>(o_frag, m, d);

const uint32_t num_kv_chunks = ceil_div(kv_len, kv_chunk_size);
const uint32_t num_kv_chunks = ceil_div(max(kv_len, 1), kv_chunk_size);

// write back
write_o_reg_gmem<num_warps_x, num_warps_z, num_frags_x, num_frags_y>(
Expand Down Expand Up @@ -1872,7 +1872,7 @@ __launch_bounds__(num_warps_x* num_warps_z* warp_size) void BatchPrefillWithPage
// normalize d
normalize_d<num_frags_x, num_frags_y>(o_frag, m, d);

const uint32_t num_kv_chunks = ceil_div(kv_len, kv_chunk_size);
const uint32_t num_kv_chunks = ceil_div(max(kv_len, 1), kv_chunk_size);

// write_back
write_o_reg_gmem<num_warps_x, num_warps_z, num_frags_x, num_frags_y>(
Expand Down

0 comments on commit 6ac28f4

Please # to comment.