Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
90136ba
[None][refactor] Move Mamba cache behavior into model managers (By Ag…
VALLIS-NERIA Sep 16, 2026
95a3259
[None][refactor] Merge main into model-owned Mamba cache managers (By…
VALLIS-NERIA Sep 16, 2026
f7b9d74
[None][test] Fix model-owned Mamba manager coverage (By Agent)
VALLIS-NERIA Sep 17, 2026
e8693e1
[None][fix] Handle globally combined K3 routed MoE output (By Agent)
VALLIS-NERIA Sep 17, 2026
d30c806
[None][refactor] Remove unrelated K3 MoE compatibility changes (By Ag…
VALLIS-NERIA Sep 17, 2026
ac515d3
[None][refactor] Delegate hybrid manager state through a shared contr…
VALLIS-NERIA Sep 17, 2026
b5d7747
[None][refactor] Address hybrid cache manager review (By Agent)
VALLIS-NERIA Sep 20, 2026
6a950f6
[None][merge] Merge main into hybrid cache manager refactor (By Agent)
VALLIS-NERIA Sep 20, 2026
ad8fe36
[None][refactor] Simplify Mamba layer cache payload hierarchy (By Agent)
VALLIS-NERIA Sep 21, 2026
3f4f808
[None][refactor] Decouple GDN and KDA caches from Mamba2 (By Agent)
VALLIS-NERIA Sep 21, 2026
eaf26e4
[None][refactor] Keep replay implementations in their model modules (…
VALLIS-NERIA Sep 21, 2026
de86e49
[None][refactor] Flatten model-owned cache states and payloads (By Ag…
VALLIS-NERIA Sep 21, 2026
c418620
[None][refactor] Remove redundant model state forwarding hooks (By Ag…
VALLIS-NERIA Sep 21, 2026
65be3cf
[None][merge] Preserve QSA MTP state when merging main (By Agent)
VALLIS-NERIA Sep 21, 2026
6ff2801
[None][merge] Merge main into hybrid cache manager refactor (By Agent)
VALLIS-NERIA Oct 6, 2026
d10a78f
[None][fix] Align cache manager regression fixtures after merge (By A…
VALLIS-NERIA Oct 6, 2026
640812f
[None][refactor] Simplify model cache manager and spec state names (B…
VALLIS-NERIA Oct 6, 2026
65e898b
[None][fix] Use Qwen4 PLE roles in extractor tests (By Agent)
VALLIS-NERIA Oct 6, 2026
23bb6fd
[None][chore] Merge latest main into cache manager refactor (By Agent)
VALLIS-NERIA Oct 12, 2026
6e9aecd
fix: reserve replay scratch and gate QSA cache allocation (By Agent)
VALLIS-NERIA Oct 14, 2026
c68b3c4
[None][chore] Merge main and port KDA suspend lifecycle (By Agent)
VALLIS-NERIA Oct 14, 2026
1cf2831
[None][fix] Correct hybrid replay accounting and lifecycle (By Agent)
VALLIS-NERIA Oct 15, 2026
ecfd7b7
[None][chore] Merge main and adapt Kimi V2 coverage (By Agent)
VALLIS-NERIA Oct 15, 2026
bc6edc2
[None][fix] Adapt Qwen4 modeling v2 to layer caches (By Agent)
VALLIS-NERIA Oct 15, 2026
debdbb0
[None][test] Close DSA cache managers during teardown (By Agent)
VALLIS-NERIA Oct 15, 2026
8663136
[None][test] Split B200 sampler invocations to avoid timeout (By Agent)
VALLIS-NERIA Oct 15, 2026
bb91945
[None][test] Preserve FP32 activation in fused MoE reference (By Agent)
VALLIS-NERIA Oct 16, 2026
adb3bec
[None][chore] Merge main and adapt model-owned KDA replay (By Agent)
VALLIS-NERIA Oct 19, 2026
8d7a1c7
[None][chore] Merge main host tier allocation changes (By Agent)
VALLIS-NERIA Oct 19, 2026
49f68f3
[None][chore] Merge main and validate reused state contents (By Agent)
VALLIS-NERIA Oct 20, 2026
ceba245
[None][chore] Merge main and preserve B300 test coverage (By Agent)
VALLIS-NERIA Oct 20, 2026
5f92fb2
[None][test] Fix KV event expectations and mixed-batch scheduling (By…
VALLIS-NERIA Oct 20, 2026
58ef516
[None][test] Assign global IDs to disaggregated worker requests (By A…
VALLIS-NERIA Oct 20, 2026
c5ceb28
[None][test] Close KV caches in model engine callback tests (By Agent)
VALLIS-NERIA Oct 20, 2026
5d024af
[None][test] Allow B300 attention suite to finish cold JIT coverage (…
VALLIS-NERIA Oct 20, 2026
150a9ed
[None][chore] Merge main and preserve hybrid cache retention (By Agent)
VALLIS-NERIA Oct 20, 2026
8521ac4
[None][chore] Merge main and align hybrid warmup API (By Agent)
VALLIS-NERIA Oct 21, 2026
3144250
[None][fix] Refresh serving schemas for rc2 (By Agent)
VALLIS-NERIA Oct 21, 2026
4155849
[None][chore] Merge main and preserve model cache routing (By Agent)
VALLIS-NERIA Oct 22, 2026
8ebcc29
[None][chore] Merge main and adapt model state transfer tests (By Agent)
VALLIS-NERIA Oct 22, 2026
626d50d
[None][chore] Merge main and align KV cache event assertions (By Agent)
VALLIS-NERIA Oct 23, 2026
8c395ea
[None][refactor] Merge main and keep KDA replay resume model-owned (B…
VALLIS-NERIA Oct 23, 2026
990486f
[None][refactor] Merge main and keep pooled KDA replay model-owned (B…
VALLIS-NERIA Oct 23, 2026
77a480f
[None][test] Adapt merged KDA replay and executor fixtures (By Agent)
VALLIS-NERIA Oct 23, 2026
0aeac7c
[None][refactor] Merge main and retain model-owned QSA replay (By Agent)
VALLIS-NERIA Oct 23, 2026
0a3491d
[None][test] Keep Qwen4 pool contract tests on CPU CI (By Agent)
VALLIS-NERIA Oct 23, 2026
94a1c66
[TRTLLM-17288][test] Restore executor forward-survival CI coverage (B…
VALLIS-NERIA Oct 23, 2026
23df828
[None][refactor] Merge main and preserve branch snapshot configuratio…
VALLIS-NERIA Oct 23, 2026
af0d3ab
[None][test] Bound CPU threads in DeepSeek shard tests (By Agent)
VALLIS-NERIA Oct 23, 2026
e9ed596
[None][test] Close KV transfer fixtures on their CUDA device (By Agent)
VALLIS-NERIA Oct 23, 2026
0713da3
[None][test] Align executor fixture with upstream (By Agent)
VALLIS-NERIA Oct 24, 2026
c7a3133
[None][refactor] Merge main and preserve model-owned KDA resume (By A…
VALLIS-NERIA Oct 24, 2026
1b48191
[None][fix] Reserve TMA fetch space for CSA2 staging pools (By Agent)
VALLIS-NERIA Oct 24, 2026
f60e015
[None][test] Include replay in GLM indexer cost baseline (By Agent)
VALLIS-NERIA Oct 24, 2026
daed5d1
[None][test] Complete mixed precision model config fixture (By Agent)
VALLIS-NERIA Oct 24, 2026
3fa2b01
[None][test] Initialize cleanup guards on sleep test shells (By Agent)
VALLIS-NERIA Oct 24, 2026
c2673a7
[None][test] Synchronize heartbeat with blocked discovery (By Agent)
VALLIS-NERIA Oct 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1870,18 +1870,19 @@ def _bind_step_buffers(self, cm, g: _PoolGeometry, mm, conv0, ssm0) -> dict:
)
_require(
cm,
("get_intermediate_conv_states", "get_intermediate_ssm_states"),
"binds its per-step state buffers",
("mamba_layer_cache", "get_replay_state_update_metadata"),
"binds its per-step state buffers and replay metadata",
)
# `get_intermediate_*` builds a fresh view per call, so bind them here.
int_conv = {i: cm.get_intermediate_conv_states(i) for i in self.gdn_layers}
# Bind the per-layer views once for subsequent forwards.
layer_caches = {i: cm.mamba_layer_cache(i) for i in self.gdn_layers}
int_conv = {i: cache.intermediate_conv_window for i, cache in layer_caches.items()}
int_idx = getattr(cm, "intermediate_state_indices", None)
g0 = self.gdn_layers[0]
check_step_buffers(g, int_conv[g0], conv0, int_idx)
int_ssm0 = cm.get_intermediate_ssm_states(g0)
if not getattr(cm, "use_replay_state_update", False):
int_ssm0 = layer_caches[g0].intermediate_ssm
if cm.get_replay_state_update_metadata() is None:
check_legacy_state(g, int_ssm0, ssm0)
int_ssm = {i: cm.get_intermediate_ssm_states(i) for i in self.gdn_layers}
int_ssm = {i: cache.intermediate_ssm for i, cache in layer_caches.items()}
return dict(int_idx=int_idx, int_conv=int_conv, int_ssm=int_ssm)
assert int_ssm0 is None, (
"the cache manager runs the cached-replay verify path and also allocated a "
Expand All @@ -1893,7 +1894,7 @@ def _bind_replay(self, cm, g: _PoolGeometry, mm, ssm0) -> _Replay:
"""The cached-replay history buffers and bookkeeping of one manager."""
meta = cm.get_replay_state_update_metadata()
assert meta is not None, (
"use_replay_state_update is True but the manager returns no replay metadata "
"the cached-replay binding requires replay metadata "
"(prev_num_accepted_tokens / cache_buf_idx / widths)"
)
history, width = meta.replay_history_size, meta.replay_step_width
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class FusedRecurrentGatedDeltaRuleCachedReplayUpdate(OpWrapper):
history);
* after every step, before the next: with work items,
`commit_gdn_cached_replay_history_layers` over every local GDN layer; then the
advance (`_advance_replay_state` in `pyexecutor/kv_cache/mamba_cache_manager.py`)
advance (`_advance_replay_state` in `modules/fla/cache_manager.py`)
with the accepted counts including the bonus token. Advancing as if every
draft were accepted is silent at the op and wrong from the next step on;
* the conv state is not this op's: under replay the conv still writes its
Expand Down
28 changes: 22 additions & 6 deletions tensorrt_llm/_torch/attention/backends/sparse/csa2/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from contextlib import contextmanager, nullcontext
from dataclasses import dataclass
from math import prod
from typing import TYPE_CHECKING

import numpy as np
Expand All @@ -22,6 +23,21 @@

_SWA_TILE = 128
_HEAD_DIM = 512
_TMA_MIN_BACKING_BYTES = 128 * 1024


def _allocate_staging_pool(
shape: tuple[int, ...], dtype: torch.dtype, device: torch.device
) -> torch.Tensor:
# Native sparse FMHA describes an unbounded row domain. Blackwell TMA
# out-of-bounds fetches require 128 KiB mapped after the pool address,
# including when the logical staging pool is smaller.
elements = prod(shape)
element_bytes = 2 if dtype == torch.bfloat16 else 1
storage = torch.empty(
max(elements, _TMA_MIN_BACKING_BYTES // element_bytes), dtype=dtype, device=device
)
return storage[:elements].view(shape)


@dataclass
Expand Down Expand Up @@ -231,15 +247,15 @@ def _allocate(
)
self._csa2_context_geometry = None
if shared_rows is None:
self.swa_pool = torch.empty(
capacity, _SWA_TILE, _HEAD_DIM, dtype=staging_dtype, device=device
self.swa_pool = _allocate_staging_pool(
(capacity, _SWA_TILE, _HEAD_DIM), staging_dtype, device
)
self.extra_pool = torch.empty(
capacity, max(extra_capacity, 1), _HEAD_DIM, dtype=staging_dtype, device=device
self.extra_pool = _allocate_staging_pool(
(capacity, max(extra_capacity, 1), _HEAD_DIM), staging_dtype, device
)
else:
self.shared_pool = torch.empty(
shared_rows, _HEAD_DIM, dtype=staging_dtype, device=device
self.shared_pool = _allocate_staging_pool(
(shared_rows, _HEAD_DIM), staging_dtype, device
)
self._csa2_shared_selected = torch.empty(shared_rows, dtype=torch.int32, device=device)
self.swa_pool = self.extra_pool = self.shared_pool
Expand Down
Loading
Loading