vllm.v1.worker.replayssm_utils
¶
Worker-owned FlashInfer ReplaySSM state and request lifecycle.
Classes:
-
ReplaySSMModelContext–Shared replay plans with independent physical slots for each cache group.
Functions:
-
get_replayssm_block_copy_tensors–Include shared trackers in scheduler block copies alongside packed pages.
-
initialize_replayssm_ring_trackers–Allocate and bind one tracker pair per ReplaySSM cache group, and the
-
mamba_state_copy_boundary–Return the aligned Mamba state-copy decision and destination.
ReplaySSMModelContext
dataclass
¶
Shared replay plans with independent physical slots for each cache group.
Methods:
-
postprocess–Commit all groups before publishing their canonical prefix states.
-
reset_new_slots–Migrate live cursors and reset fresh physical slots in all groups.
_materialize(num_reqs)
¶
Publish all canonical prefix snapshots in one kernel launch.
postprocess(*, idx_mapping, query_metadata, query_metadata_is_cumulative, num_computed_tokens, num_computed_is_post_step, num_accepted_tokens, is_prefilling, live_cols, num_reqs)
¶
Commit all groups before publishing their canonical prefix states.
reset_new_slots(*, idx_mapping, src_cols, dst_cols, num_reqs)
¶
Migrate live cursors and reset fresh physical slots in all groups.
_bind_replayssm_rand_seeds(forward_context, names)
¶
Give each layer one slot of a shared Philox seed buffer.
The first executed layer refreshes the whole buffer with one launch per step instead of every layer drawing its own seed.
_compact_replayssm_requests_kernel(plan_flush_count, active_request_indices, num_reqs, MAX_NUM_REQS, BLOCK_SIZE)
¶
Build the shared FlashInfer active-request list.
_postprocess_replayssm_kernel(idx_mapping, query_metadata, num_computed_tokens, num_accepted_tokens, is_prefilling, live_cols, block_table_ptrs, tracker_start_ptrs, tracker_committed_ptrs, src_slots_ptrs, dst_slots_ptrs, plan_ring_start, plan_flush_count, block_table_strides, num_layers, MAX_NUM_REQS, MAMBA_BLOCK_SIZE, LOGICAL_WINDOW, RING_BUFFER_LEN, PAD_SLOT_ID, QUERY_METADATA_IS_CUMULATIVE, NUM_COMPUTED_IS_POST_STEP, HAS_IDX_MAPPING, MATERIALIZE_PREFIXES, LIVE_COL_IS_ZERO)
¶
Commit a completed step and prepare an optional prefix snapshot.
_reinterpret_u64_as_i64(value)
¶
Preserve a uint64 pointer bit pattern in a torch.int64 tensor.
_reset_new_replayssm_slots_kernel(idx_mapping, src_cols, dst_cols, block_table_ptrs, tracker_start_ptrs, tracker_committed_ptrs, block_table_strides, PAD_SLOT_ID, HAS_IDX_MAPPING)
¶
Copy live cursors or reset a fresh destination in this cache group.
Source and destination are logical block-table columns. Their slot lookups distinguish a missing group-local source from a continuation.
get_replayssm_block_copy_tensors(forward_context)
¶
Include shared trackers in scheduler block copies alongside packed pages.
initialize_replayssm_ring_trackers(kv_cache_config, forward_context)
¶
Allocate and bind one tracker pair per ReplaySSM cache group, and the stochastic-rounding seed slots of the FlashInfer ReplaySSM layers.
mamba_state_copy_boundary(num_tokens_running_state, new_num_computed, block_size)
¶
Return the aligned Mamba state-copy decision and destination.