Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
762c235
feat: add ReplaySSM support for linear attention
sufubao Sep 20, 2026
8b2c9fb
feat: finalize ReplaySSM state storage for GDN
sufubao Oct 6, 2026
4213a74
style: use the pinned Black formatting
sufubao Oct 6, 2026
2727aae
fix: skip hybrid checkpoints when prefix caching is disabled
sufubao Oct 6, 2026
b63c50b
refactor: simplify GDN SSM state handling
sufubao Oct 6, 2026
9f791ad
feat: support ReplaySSM state modes for KDA
sufubao Oct 6, 2026
28f2aca
fix: keep KDA tuning cache filenames within filesystem limits
sufubao Oct 6, 2026
59fae10
fix: handle empty GLM indexer rows during graph capture
sufubao Oct 6, 2026
a55770c
Simplify ReplaySSM updates and cache metadata access
sufubao Oct 7, 2026
3af33c2
Tune SSM layouts per batch and preserve verify configs
sufubao Oct 7, 2026
3fa7c6a
perf(replayssm): optimize GDN MTP decoding and sampling
sufubao Oct 14, 2026
e882a1f
Merge PR #1585 into current checkout
sufubao Oct 14, 2026
b580198
style: format ReplaySSM kernels
sufubao Oct 14, 2026
62258cd
chore: exclude ReplaySSM docs from PR
sufubao Oct 14, 2026
7c25a7e
fix: pass required arguments to SGL FA3 vision attention
sufubao Oct 14, 2026
fb029ed
fix: separate draft tail graph layouts across padding
sufubao Oct 15, 2026
16d55f8
test: cover continuous ReplaySSM derived state lifecycle
sufubao Oct 15, 2026
7dcda70
refactor: group ReplaySSM options in a JSON config
sufubao Oct 15, 2026
833d5eb
fix: reject unsupported compact MTP widths at startup
sufubao Oct 15, 2026
aca2281
fix: validate GDN and KDA MTP widths across state modes
sufubao Oct 15, 2026
b047f64
Merge remote-tracking branch 'upstream/main' into replayssm-main-sync
sufubao Oct 16, 2026
0fff948
refactor: centralize recurrent state lifecycle and checkpoints
sufubao Oct 17, 2026
9212702
fix: retain FP32 replay history for FP16 activations
sufubao Oct 17, 2026
cc9d9a5
fix: run Triton fallback on the failing FA3 invocation
sufubao Oct 17, 2026
0bb017d
refactor: clarify recurrent execution contracts and freeze graph meta…
sufubao Oct 17, 2026
d66fec2
Merge commit 'refs/pull/1585/head' of https://github.com/ModelTC/Ligh…
sufubao Oct 19, 2026
600df9e
refactor: split independent vision FA3 fixes out of ReplaySSM
sufubao Oct 19, 2026
60ba1f3
fix: shorten GDN precompute tuning cache filenames
sufubao Oct 19, 2026
a1c86f0
refactor: clarify linear layer index naming
sufubao Oct 19, 2026
e1dc47a
refactor: pass immutable SSM run configs directly
sufubao Oct 19, 2026
12532af
style: group PR imports and clarify SSM layer indices
sufubao Oct 19, 2026
0f663cd
fix: pass ReplaySSM tile dimensions as compile-time constants
sufubao Oct 20, 2026
167eb4e
Merge remote-tracking branch 'upstream/main' into merge-pr-1585
sufubao Oct 20, 2026
db380b5
style: match pinned Black formatting
sufubao Oct 20, 2026
f1e8288
fix: bound SSM tuning memory and prepare remote configs
sufubao Oct 20, 2026
924088d
refactor: simplify ReplaySSM state interfaces
sufubao Oct 21, 2026
c3818f8
style: revert unrelated blank-line changes in ReplaySSM PR
hiworldwzj Oct 22, 2026
1527002
refactor: keep SSM run configs in attention state
sufubao Oct 22, 2026
ac4a82c
refactor: split accepted-tail draft projection out of ReplaySSM PR
hiworldwzj Oct 22, 2026
355357a
style: restore original infer_struct imports
hiworldwzj Oct 22, 2026
69f65be
refactor: encapsulate hybrid checkpoint and PD state interfaces
hiworldwzj Oct 22, 2026
d3622db
refactor: separate SSM state execution and acceptance
sufubao Nov 3, 2026
26627bf
fix: preserve logical GDN layer state in loop models
sufubao Nov 3, 2026
38d9a6b
test: initialize runtime args for SSM checkpoint tests
sufubao Nov 3, 2026
cfc9f8b
docs: remove ReplaySSM design document
sufubao Nov 3, 2026
c3439c9
refactor: limit PR changes to ReplaySSM
sufubao Nov 4, 2026
dc85b49
refactor: unify SSM acceptance and execution
sufubao Nov 4, 2026
0de73fe
fix: bound SSM checkpoint memory and acceptance compilation
sufubao Nov 4, 2026
d3ca333
perf: reuse ReplaySSM kernels across eager batch sizes
sufubao Nov 4, 2026
e785143
docs: explain ReplaySSM state interfaces
sufubao Nov 5, 2026
f4b004b
refactor: split ReplaySSM kernels by lifecycle
sufubao Nov 5, 2026
2128f74
docs: clarify ReplaySSM interfaces and kernel lifecycle
sufubao Nov 5, 2026
ae6aa34
refactor: centralize bounded attention validation
sufubao Nov 5, 2026
3a95a9e
refactor: remove redundant ReplaySSM guards
sufubao Nov 5, 2026
0a44f17
perf: validate graph layout once per capture
sufubao Nov 5, 2026
439a1a5
refactor: split bounded attention state strategies
sufubao Nov 6, 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
10 changes: 8 additions & 2 deletions lightllm/common/attention_state/bounded_att/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
from .kda.create_kda_state import create_kda_state
from .conv_ssm_types import ConvSSMStateConfig
from .gdn.gdn_pages_pool import GDNPagesPool
from .gdn.gdn_state import GDNState
from .gdn.gdn_state import GDNCompactState, GDNNativeState, GDNReplayState, GDNState
from .kda.kda_pages_pool import KDAPagesPool
from .kda.kda_state import KDAState
from .kda.kda_state import KDACompactState, KDANativeState, KDAReplayState, KDAState
from .base_state import BoundedAttentionState

from .sliding_window.fp8_e8m0_swa_state import FP8E8M0SlidingWindowConfig, FP8E8M0SlidingWindowState
Expand All @@ -16,9 +16,15 @@
"BoundedAttentionState",
"ConvSSMStateConfig",
"GDNState",
"GDNNativeState",
"GDNCompactState",
"GDNReplayState",
"GDNPagesPool",
"create_gdn_state",
"KDAState",
"KDANativeState",
"KDACompactState",
"KDAReplayState",
"KDAPagesPool",
"create_kda_state",
"FP8E8M0SlidingWindowConfig",
Expand Down
4 changes: 4 additions & 0 deletions lightllm/common/attention_state/bounded_att/base_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@

class BoundedAttentionState(CoreInterface, CpuCacheInterface, DpCopyInterface, PdInterface):
"""单种 bounded-attention 方案的数据操作,索引和槽位由调用方分配。"""

def validate_bounded_att_commit(self, acceptance):

pass
561 changes: 561 additions & 0 deletions lightllm/common/attention_state/bounded_att/conv_ssm_state.py

Large diffs are not rendered by default.

11 changes: 9 additions & 2 deletions lightllm/common/attention_state/bounded_att/gdn/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
from .create_gdn_state import create_gdn_state
from .gdn_pages_pool import GDNPagesPool
from .gdn_state import GDNState
from .gdn_state import GDNCompactState, GDNNativeState, GDNReplayState, GDNState

__all__ = ["create_gdn_state", "GDNPagesPool", "GDNState"]
__all__ = [
"create_gdn_state",
"GDNPagesPool",
"GDNState",
"GDNNativeState",
"GDNCompactState",
"GDNReplayState",
]
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,33 @@
import torch

from ..conv_ssm_types import ConvSSMStateConfig
from .gdn_state import GDNState
from .gdn_state import GDNCompactState, GDNNativeState, GDNReplayState, GDNState


def create_gdn_state(
config: ConvSSMStateConfig,
request_capacity: int,
mtp_step: int = 0,
device: str | torch.device = "cuda",
*,
ssm_state_mode: str = "native",
ssm_replay_config: dict | None = None,
gate_lower_bound: float = -5.0,
) -> GDNState:
"""创建 GDN 请求运行态,大小页池由后续容量分配流程初始化。"""
return GDNState(
state_cls = {
"native": GDNNativeState,
"compact": GDNCompactState,
"replay": GDNReplayState,
}.get(ssm_state_mode)
if state_cls is None:
raise ValueError(f"unknown GDN state mode: {ssm_state_mode}")
return state_cls(
config=config,
request_capacity=request_capacity,
mtp_step=mtp_step,
device=device,
ssm_state_mode=ssm_state_mode,
ssm_replay_config=ssm_replay_config,
gate_lower_bound=gate_lower_bound,
)
523 changes: 15 additions & 508 deletions lightllm/common/attention_state/bounded_att/gdn/gdn_state.py

Large diffs are not rendered by default.

15 changes: 3 additions & 12 deletions lightllm/common/attention_state/bounded_att/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

import torch

from ..commit import StateAcceptance

from ..utils import deepcopy_result
from lightllm.common.attention_state.types import PageKind, StateTransferLayout, TransferRegion

Expand Down Expand Up @@ -98,12 +100,7 @@ def restore_bounded_att_runtime_from_pages(
...

@abstractmethod
def commit_bounded_att_state(
self,
req_indices: torch.Tensor,
accepted_steps: torch.Tensor,
) -> None:
"""两个输入均为 CUDA Tensor;int32 接受步数包含基准输入步,候选区与游标由实现管理。"""
def commit_bounded_att_state(self, acceptance: StateAcceptance) -> None:
...


Expand Down Expand Up @@ -173,10 +170,7 @@ def copy_runtime_state_from_dp(
dst_req_indices: List[int],
remote_dp_bounded_state: CoreInterface,
) -> None:
"""复制其他 DP 同一 TP 分片的 prefill 基准运行态并重置目标游标,不修改页池。

调用方保证源状态尚未执行 MTP 提交;KDA/GDN 的源游标必须为 0。
"""
...


Expand Down Expand Up @@ -205,10 +199,7 @@ def write_to_pd_page(
state_token_len: int,
layout: StateTransferLayout,
) -> None:
"""将指定槽位在 state_token_len 绝对长度处的 prefill 基准运行态写入 PD 页。

调用方保证源状态尚未执行 MTP 提交;KDA/GDN 的源游标必须为 0。
"""
...

@abstractmethod
Expand Down
11 changes: 9 additions & 2 deletions lightllm/common/attention_state/bounded_att/kda/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
from .create_kda_state import create_kda_state
from .kda_pages_pool import KDAPagesPool
from .kda_state import KDAState
from .kda_state import KDACompactState, KDANativeState, KDAReplayState, KDAState

__all__ = ["create_kda_state", "KDAPagesPool", "KDAState"]
__all__ = [
"create_kda_state",
"KDAPagesPool",
"KDAState",
"KDANativeState",
"KDACompactState",
"KDAReplayState",
]
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,33 @@
import torch

from ..conv_ssm_types import ConvSSMStateConfig
from .kda_state import KDAState
from .kda_state import KDACompactState, KDANativeState, KDAReplayState, KDAState


def create_kda_state(
config: ConvSSMStateConfig,
request_capacity: int,
mtp_step: int = 0,
device: str | torch.device = "cuda",
*,
ssm_state_mode: str = "native",
ssm_replay_config: dict | None = None,
gate_lower_bound: float = -5.0,
) -> KDAState:
"""创建 KDA 请求运行态,大小页池由后续容量分配流程初始化。"""
return KDAState(
state_cls = {
"native": KDANativeState,
"compact": KDACompactState,
"replay": KDAReplayState,
}.get(ssm_state_mode)
if state_cls is None:
raise ValueError(f"unknown KDA state mode: {ssm_state_mode}")
return state_cls(
config=config,
request_capacity=request_capacity,
mtp_step=mtp_step,
device=device,
ssm_state_mode=ssm_state_mode,
ssm_replay_config=ssm_replay_config,
gate_lower_bound=gate_lower_bound,
)
Loading
Loading