[BugFix] Stop dummy runs from writing mamba state through stale block-table rows (#49757)

Signed-off-by: Nick Hill <nickhill123@gmail.com>
Signed-off-by: Jeff Ma <jeffjma@umich.edu>
Co-authored-by: Jeff Ma <jeffjma@umich.edu>
This commit is contained in:
Nick Hill
2026-07-29 01:09:41 +00:00
committed by GitHub
co-authored by Jeff Ma
parent 56f31af62a
commit 6fbbcf2151
5 changed files with 86 additions and 2 deletions
+5
View File
@@ -144,6 +144,11 @@ class BlockTable:
block_table_np = self.block_table.np
block_table_np[tgt, :num_blocks] = block_table_np[src, :num_blocks]
self.num_blocks_per_row[tgt] = num_blocks
# Clear the vacated source row: dummy-run batches dereference stale
# rows as mamba state slots and write state in place there, possibly
# after the blocks have been freed and reallocated.
block_table_np[src, :num_blocks] = 0
self.num_blocks_per_row[src] = 0
def swap_row(self, src: int, tgt: int) -> None:
src_tgt, tgt_src = [src, tgt], [tgt, src]