Skip to content

Commit

Permalink
Avoid seqlen_k=0 for kvcache
Browse files Browse the repository at this point in the history
  • Loading branch information
poyenc committed Aug 19, 2024
1 parent 3fb77a0 commit 21c4df8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion example/ck_tile/01_fmha/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,10 @@ decode_seqlen(mode_enum mode,
if(use_kvcache)
{
std::vector<ck_tile::index_t> seqlen_ks(batch);
randints(seqlen_ks.begin(), seqlen_ks.end(), seqlen_k_min, seqlen_k_max, seed);
// generate random numbers in range [1, seqlen_k_max] if given seqlen_k_min = 0
ck_tile::index_t real_seqlen_k_min =
std::min(std::max(1, seqlen_k_min), seqlen_k_max);
randints(seqlen_ks.begin(), seqlen_ks.end(), real_seqlen_k_min, seqlen_k_max, seed);
return seqlen_ks;
}
else
Expand Down

0 comments on commit 21c4df8

Please sign in to comment.