[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:
@@ -163,7 +163,13 @@ class BlockTables:
|
||||
# Therefore, this method must return the persistent tensor
|
||||
# with the same memory address as that used during the model's forward pass,
|
||||
# rather than allocating a new tensor.
|
||||
return tuple(block_table[:num_reqs] for block_table in self.input_block_tables)
|
||||
#
|
||||
# Zero the rows so dummy runs write mamba state to the reserved null
|
||||
# block rather than through the previous real step's (stale) block
|
||||
# ids, which may point at blocks since freed and reallocated.
|
||||
return tuple(
|
||||
block_table[:num_reqs].zero_() for block_table in self.input_block_tables
|
||||
)
|
||||
|
||||
def compute_slot_mappings(
|
||||
self,
|
||||
|
||||
@@ -1290,6 +1290,10 @@ class GPUModelRunner(LoRAModelRunnerMixin):
|
||||
slot_mappings,
|
||||
self.attn_groups,
|
||||
self.kv_cache_config,
|
||||
# FULL replay reads capture-time metadata buffers. Re-stage them
|
||||
# from the zeroed dummy block tables instead of retaining state
|
||||
# indices from the previous real batch.
|
||||
for_capture=dummy_run and batch_desc.cg_mode == CUDAGraphMode.FULL,
|
||||
)
|
||||
|
||||
input_ids = input_batch.input_ids
|
||||
|
||||
Reference in New Issue
Block a user