[unified-memory] Drop the vacated 'dense' qualifier and the restating comments (#37170)

This commit is contained in:
Cheng Wan
2026-08-31 00:54:13 -07:00
committed by GitHub
parent 8bb776dc48
commit f61bb7b40a
18 changed files with 101 additions and 101 deletions
@@ -21,8 +21,8 @@ the result into `out`:
for c < ceil(seq_lens[b] / ps) -- the row's LIVE prefix
`v2p` is the pool's virtual->physical page table and `multiplier` scales a
physical page into the id space the per-layer views use (1 when they are not
dense). Since only the page number is rewritten, a token-level consumer can
physical page into the id space the per-layer views use (1 when one page maps
to one row-block). Since only the page number is rewritten, a token-level consumer can
rebuild flat ids as `entry * ps + offset`.
PREFIX-ONLY per row: columns past the live prefix are never written, so a
@@ -396,7 +396,7 @@ class TRTLLMMLABackend(FlashInferMLAAttnBackend):
self.decode_cuda_graph_kv_indices = torch.full(
(max_bs, max_blocks_per_seq), -1, dtype=torch.int32, device=self.device
)
# Unified pool: capture-stable buffer for the DENSE KV write loc, filled
# Unified pool: capture-stable buffer for the kernel-facing KV write loc, filled
# out-of-graph in init_forward_metadata_out_graph so the in-graph
# set_mla_kv_buffer captures no translate.
if self.kv_index_translator.is_translating:
@@ -635,7 +635,7 @@ class TRTLLMMLABackend(FlashInferMLAAttnBackend):
# Replay-prep receives the RAW (unpadded) out_cache_loc
# (build_replay_fb_view), but the captured write kernel consumes the
# full captured tier of this buffer. Zero the tail so pad rows write
# to the dense sink (row 0) instead of stale dense locs left by
# to the sink (row 0) instead of stale kernel-facing locs left by
# earlier larger replays — a stale tail scatters pad-row garbage into
# live KV pages. Mirrors the runner's PaddingPolicy.ZERO on its own
# out_cache_loc slot.
+3 -3
View File
@@ -1697,8 +1697,8 @@ class KVCache(abc.ABC):
self.size = size
self.page_size = page_size
# Row-blocks one page holds in this pool's kernel-facing id space; >1
# only where the per-layer views are dense (the unified pool), and then
# a write loc must have been translated into that space first.
# only for the unified pool's per-layer views, and then a write loc must
# have been translated into that space first.
self.kernel_page_blocks = 1
self.dtype = dtype
self.device = device
@@ -2790,7 +2790,7 @@ class MHATokenToKVPool(KVCache):
num_rows = int(loc_2d.numel())
if cache_k.shape[0] != num_rows or cache_v.shape[0] != num_rows:
raise ValueError(
"dense KV rows must match loc_2d size: "
"KV rows must match loc_2d size: "
f"{tuple(cache_k.shape)=} {tuple(cache_v.shape)=} {tuple(loc_2d.shape)=}."
)
@@ -1192,7 +1192,7 @@ def init_unified_mamba_pools(
pre_alloc_size=decode_pre_alloc_size,
)
if use_mla_backend:
# start_layer stays 0: HybridLinearKVPool patches layer ids to the dense
# start_layer stays 0: HybridLinearKVPool patches layer ids to the contiguous
# 0..N-1 index via _transfer_id_context before every MLA pool call.
unified_full_kv_pool = UnifiedMLATokenToKVPool(
unified_buffer=shared_pool,