Skip to content
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
7 changes: 5 additions & 2 deletions include/flashinfer/attention/pod.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,11 @@ cudaError_t PODWithKVCacheTensorDispatched(PrefillParams prefill_params,
int num_sm = 0;
FLASHINFER_CUDA_CALL(
cudaDeviceGetAttribute(&num_sm, cudaDevAttrMultiProcessorCount, dev_id));
FLASHINFER_CUDA_CALL(cudaOccupancyMaxActiveBlocksPerMultiprocessor(
&num_blocks_per_sm, kernel, num_threads_p, smem_size_p));
// FLASHINFER_CUDA_CALL(cudaOccupancyMaxActiveBlocksPerMultiprocessor(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's interesting to me, and likely a bug of cudaOccupancyMaxActiveBlocksPerMultiprocessor.
Let's merge this first, thanks for the contribution!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cudaOccupancyMaxActiveBlocksPerMultiprocessor is buggy on both A100 40G and H100 for me

// &num_blocks_per_sm, kernel, num_threads_p, smem_size_p));
// Above function returns 0 for some reason, so we use a workaround
num_blocks_per_sm = std::max(
1, std::min((int)(max_smem_per_sm / smem_size_p), (int)(256 / num_threads_p)));
uint32_t max_num_kv_chunks =
(num_blocks_per_sm * num_sm) /
(num_kv_heads * ceil_div(qo_len * group_size, KTraits_P::CTA_TILE_Q));
Expand Down