[mem_cache][10/N] refactor: drop the redundant _component suffix in unified_cache/components (#35644)
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
14a131ad5b
commit
7f1f8c706a
@@ -17,10 +17,10 @@ import torch
|
||||
|
||||
from sglang.srt.mem_cache.base_prefix_cache import EvictParams, InsertResult
|
||||
from sglang.srt.mem_cache.memory_pool import ReqToTokenPool
|
||||
from sglang.srt.mem_cache.unified_cache.components.mamba_component import (
|
||||
from sglang.srt.mem_cache.unified_cache.components.base import TreeComponent
|
||||
from sglang.srt.mem_cache.unified_cache.components.mamba import (
|
||||
MambaComponent,
|
||||
)
|
||||
from sglang.srt.mem_cache.unified_cache.components.tree_component import TreeComponent
|
||||
|
||||
_CACHE_ATTRS = ("offset", "lengths", "left_padding")
|
||||
_MISSING = object()
|
||||
|
||||
@@ -9,7 +9,7 @@ if TYPE_CHECKING:
|
||||
from sglang.srt.mem_cache.allocator import BaseTokenToKVPoolAllocator
|
||||
from sglang.srt.mem_cache.memory_pool import ReqToTokenPool
|
||||
from sglang.srt.mem_cache.unified_cache.components import ComponentType
|
||||
from sglang.srt.mem_cache.unified_cache.components.tree_component import (
|
||||
from sglang.srt.mem_cache.unified_cache.components.base import (
|
||||
TreeComponent,
|
||||
)
|
||||
|
||||
|
||||
@@ -74,10 +74,10 @@ node.component_data[ComponentType.MAMBA] # MambaComponent data
|
||||
| `../unified_cache/unified_tree_core.py` | `UnifiedTreeCore` — the tree, LRUs, and size counters; `UnifiedTreeNode`, `UnifiedLRUList` |
|
||||
| `../unified_cache/unified_tree_core_interface.py` | `UnifiedTreeCoreInterface`, `NodeId` — the tree/cache boundary contract |
|
||||
| `../unified_cache/cache_action.py` | Deferred `CacheAction`/`ComponentAction` types emitted by the tree |
|
||||
| `tree_component.py` | `TreeComponent` ABC, `ComponentType`, `ComponentData`, `get_and_increase_time_counter`, `next_component_uuid` |
|
||||
| `full_component.py` | `FullComponent` — standard full-attention KV cache component |
|
||||
| `swa_component.py` | `SWAComponent` — sliding-window attention component with tombstone/window tracking |
|
||||
| `mamba_component.py` | `MambaComponent` — Mamba/SSM state component with copy-on-write |
|
||||
| `base.py` | `TreeComponent` ABC, `ComponentType`, `ComponentData`, `get_and_increase_time_counter`, `next_component_uuid` |
|
||||
| `full.py` | `FullComponent` — standard full-attention KV cache component |
|
||||
| `swa.py` | `SWAComponent` — sliding-window attention component with tombstone/window tracking |
|
||||
| `mamba.py` | `MambaComponent` — Mamba/SSM state component with copy-on-write |
|
||||
| `../hybrid_cache/hybrid_cache_controller.py` | `HybridCacheController` — HiCache multi-pool controller (L1 GPU → L2 CPU, optional L3 storage) |
|
||||
| `__init__.py` | Re-exports: `ComponentType`, `ComponentData`, `TreeComponent`, `FullComponent`, `SWAComponent`, `MambaComponent` |
|
||||
|
||||
@@ -276,7 +276,7 @@ Cache an in-progress request's partial KV data (chunked prefill).
|
||||
|
||||
## TreeComponent Hook Reference
|
||||
|
||||
Each component implements these hooks. See `tree_component.py` for the ABC and docstrings.
|
||||
Each component implements these hooks. See `base.py` for the ABC and docstrings.
|
||||
|
||||
### Match Phase
|
||||
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
from sglang.srt.mem_cache.unified_cache.components.full_component import FullComponent
|
||||
from sglang.srt.mem_cache.unified_cache.components.mamba_component import MambaComponent
|
||||
from sglang.srt.mem_cache.unified_cache.components.swa_component import SWAComponent
|
||||
from sglang.srt.mem_cache.unified_cache.components.tree_component import (
|
||||
from sglang.srt.mem_cache.unified_cache.components.base import (
|
||||
_NUM_COMPONENT_TYPES,
|
||||
BASE_COMPONENT_TYPE,
|
||||
CacheTransferPhase,
|
||||
@@ -17,6 +14,9 @@ from sglang.srt.mem_cache.unified_cache.components.tree_component import (
|
||||
get_and_increase_time_counter,
|
||||
next_component_uuid,
|
||||
)
|
||||
from sglang.srt.mem_cache.unified_cache.components.full import FullComponent
|
||||
from sglang.srt.mem_cache.unified_cache.components.mamba import MambaComponent
|
||||
from sglang.srt.mem_cache.unified_cache.components.swa import SWAComponent
|
||||
|
||||
__all__ = [
|
||||
"BASE_COMPONENT_TYPE",
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ from sglang.srt.mem_cache.hicache_storage import (
|
||||
PoolTransferResult,
|
||||
)
|
||||
from sglang.srt.mem_cache.unified_cache.cache_action import FreeComponentDeviceSlot
|
||||
from sglang.srt.mem_cache.unified_cache.components.tree_component import (
|
||||
from sglang.srt.mem_cache.unified_cache.components.base import (
|
||||
CacheTransferPhase,
|
||||
ComponentType,
|
||||
EvictLayer,
|
||||
+1
-1
@@ -25,7 +25,7 @@ from sglang.srt.mem_cache.unified_cache.cache_action import (
|
||||
FreeComponentHostSlot,
|
||||
MambaEvictExcessPathStates,
|
||||
)
|
||||
from sglang.srt.mem_cache.unified_cache.components.tree_component import (
|
||||
from sglang.srt.mem_cache.unified_cache.components.base import (
|
||||
CacheTransferPhase,
|
||||
ComponentType,
|
||||
EvictLayer,
|
||||
+1
-1
@@ -30,7 +30,7 @@ from sglang.srt.mem_cache.unified_cache.cache_action import (
|
||||
RecoverSWAWithLockedFull,
|
||||
SWARebuild,
|
||||
)
|
||||
from sglang.srt.mem_cache.unified_cache.components.tree_component import (
|
||||
from sglang.srt.mem_cache.unified_cache.components.base import (
|
||||
BASE_COMPONENT_TYPE,
|
||||
CacheTransferPhase,
|
||||
ComponentType,
|
||||
@@ -12,7 +12,7 @@ from typing import TYPE_CHECKING, Optional
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from sglang.srt.managers.schedule_batch import Req
|
||||
from sglang.srt.mem_cache.unified_cache.components.tree_component import (
|
||||
from sglang.srt.mem_cache.unified_cache.components.base import (
|
||||
TreeComponent,
|
||||
)
|
||||
from sglang.srt.mem_cache.unified_cache.unified_tree_core import UnifiedTreeCore
|
||||
|
||||
Reference in New Issue
Block a user