Skip to content

Commit 1c08e34

Browse files
committed
missed problem with math
1 parent a8d59cc commit 1c08e34

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

shortfin/python/shortfin_apps/llm/components/kvcache/base_attention_cache.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ def acquire_pages_for_tokens(
5353
5454
No token at idx < n_cached_token should be written to. TODO: consider enforcing this.
5555
"""
56-
pages_needed = math.ceil(len(tokens) + extra_token_slots / self.tokens_per_page)
56+
token_count = len(tokens)
57+
pages_needed = math.ceil(token_count / self.tokens_per_page)
5758
pages = self.page_pool.acquire_free_pages(pages_needed)
5859

5960
n_cached_tokens = 0

0 commit comments

Comments
 (0)