Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: resolve cu121 compile wired issue #446

Merged
merged 1 commit into from
Aug 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions include/flashinfer/attention/prefill.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -1338,6 +1338,7 @@ __launch_bounds__(num_warps_x* num_warps_z* warp_size) void BatchPrefillWithRagg
constexpr uint32_t num_rows_per_cta = num_frags_x * num_warps_x * 16;
const uint32_t qo_len = q_indptr[request_idx + 1] - q_indptr[request_idx],
kv_len = kv_indptr[request_idx + 1] - kv_indptr[request_idx];
const uint32_t kv_len_safe = kv_len > 0 ? kv_len : 1;
const uint32_t window_left = (maybe_window_left >= 0) ? maybe_window_left : kv_len;
const uint32_t max_chunk_size = partition_kv ? kv_chunk_size : kv_len;
const uint32_t chunk_start = partition_kv ? kv_tile_idx * max_chunk_size : 0;
Expand Down Expand Up @@ -1558,7 +1559,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(max(kv_len, 1), kv_chunk_size);
const uint32_t num_kv_chunks = (kv_len_safe + kv_chunk_size - 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 @@ -1632,6 +1633,7 @@ __launch_bounds__(num_warps_x* num_warps_z* warp_size) void BatchPrefillWithPage
1) * paged_kv.page_size +
paged_kv.last_page_len[request_idx]
: 0;
const uint32_t kv_len_safe = kv_len > 0 ? kv_len : 1;
const uint32_t window_left = (maybe_window_left >= 0) ? maybe_window_left : kv_len;
const uint32_t max_chunk_size = partition_kv ? kv_chunk_size : kv_len;
const uint32_t chunk_start = partition_kv ? kv_tile_idx * max_chunk_size : 0;
Expand Down Expand Up @@ -1872,7 +1874,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(max(kv_len, 1), kv_chunk_size);
const uint32_t num_kv_chunks = (kv_len_safe + kv_chunk_size - 1) / kv_chunk_size;

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