- Eliminate core/ directory into cache/, runtime/, network/ subpackages plus flat modules
- Split cache.py (647 lines) into cache/{buffer,strategy,pool}.py by layer
- Add explicit ContiguousStrategy, make AllocationStrategy a real ABC
- Move TaskCacheState to cache/strategy.py, drop string forward references
- Rename api/ to network/, server.py to app.py
- Move sample.py into runtime/ alongside executor and graph
- Simplify TaskCacheManager.__init__ to single pool param
- Expose pool.strategy and pool.req_pool as public properties
- Fix KVCache import in attention_backend.py (TYPE_CHECKING guard)
- Fix steady-state decode reading uninitialized position_ids on first step
28 lines
642 B
Python
28 lines
642 B
Python
"""KV cache subsystem: buffers, strategies, pool management."""
|
|
|
|
from astrai.inference.cache.buffer import KVCache, KVStorage, ReqToTokenPool
|
|
from astrai.inference.cache.pool import PagePool, TaskCacheManager, page_hash
|
|
from astrai.inference.cache.strategy import (
|
|
AllocationStrategy,
|
|
Allocator,
|
|
ContiguousStrategy,
|
|
PagedStrategy,
|
|
RadixCache,
|
|
TaskCacheState,
|
|
)
|
|
|
|
__all__ = [
|
|
"KVCache",
|
|
"KVStorage",
|
|
"ReqToTokenPool",
|
|
"Allocator",
|
|
"RadixCache",
|
|
"TaskCacheState",
|
|
"AllocationStrategy",
|
|
"ContiguousStrategy",
|
|
"PagedStrategy",
|
|
"PagePool",
|
|
"TaskCacheManager",
|
|
"page_hash",
|
|
]
|