[NPU][Bugfix] Fix OOB gather in decode KV allocation when free pool is tight (#35727)
This commit is contained in:
@@ -126,6 +126,7 @@ class NPUPagedTokenToKVPoolAllocator(PagedTokenToKVPoolAllocator):
|
||||
if num_new_pages == 0:
|
||||
out_indices = last_loc + 1
|
||||
else:
|
||||
start_new_pages = start_new_pages.clamp(max=num_new_pages - 1)
|
||||
out_indices = (last_loc + 1) * (1 - need_new_pages) + self.free_pages[
|
||||
start_new_pages
|
||||
] * self.page_size * need_new_pages
|
||||
|
||||
Reference in New Issue
Block a user