Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion csrc/sm90/prefill/sparse/fwd.cu
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ sparse_attn_fwd_kernel(__grid_constant__ const SparsePrefillParams params, __gri
int offs = (block_idx+buf_idx)*B_TOPK + local_row*NUM_GROUPS + group_idx;
int t = __ldg(gIndices + offs);
token_indices[buf_idx][local_row] = t*(int64_t)params.stride_kv_s_kv; // We mult it with params.stride_kv_s_kv here since it's faster
is_token_valid[buf_idx][local_row] = t >= 0 && t < params.s_kv;
is_token_valid[buf_idx][local_row] = t >= 0;
}
}
};
Expand Down
2 changes: 1 addition & 1 deletion tests/test_flash_mla_prefill.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def generate_testcase(t: TestParam) -> Testcase:
cur_indices = torch.randperm(t.s_kv)[:t.topk]
cur_indices[near_mask] = torch.randint(max(0, t.s_kv - 20000), t.s_kv - 1, (near_mask.sum().item(),))
if len(cur_indices) < t.topk:
cur_indices = torch.cat([cur_indices, torch.full((t.topk - len(cur_indices),), 2147480000)])
cur_indices = torch.cat([cur_indices, torch.full((t.topk - len(cur_indices),), -1)])
cur_indices = cur_indices[torch.randperm(t.topk)]
indices[b, s, h] = cur_indices
indices = indices.to(q.device)
Expand Down