- Add KVCache/CacheView abstract base classes in cache.py - Add ContiguousCache (contiguous per-slot buffer, default) alongside PageCache (paged, renamed from old KVCache) - Merge make_table_tensor + bind into bind_tasks on KVCache interface - Remove task_cached/task_record_hashes from base class (PageCache-only) - Scheduler: decode all position groups instead of just the largest (eliminates 63% group skip rate) - Scheduler: accept optional cache param for swapping implementations - Model layer type hints use CacheView base class - Batch 1-32: 1-7% speedup from eliminating Storage.gather overhead - All 183 inference tests pass
41 lines
838 B
Python
41 lines
838 B
Python
"""Inference core: cache, executor, scheduler, task management."""
|
|
|
|
from astrai.inference.core.cache import (
|
|
Allocator,
|
|
CacheView,
|
|
ContiguousCache,
|
|
ContiguousCacheView,
|
|
KVCache,
|
|
PageCache,
|
|
PageCacheView,
|
|
PagePool,
|
|
PrefixCache,
|
|
Storage,
|
|
TaskTable,
|
|
page_hash,
|
|
)
|
|
from astrai.inference.core.executor import Executor
|
|
from astrai.inference.core.scheduler import InferenceScheduler
|
|
from astrai.inference.core.task import STOP, Task, TaskManager, TaskStatus
|
|
|
|
__all__ = [
|
|
"Allocator",
|
|
"CacheView",
|
|
"KVCache",
|
|
"ContiguousCache",
|
|
"ContiguousCacheView",
|
|
"PageCache",
|
|
"PageCacheView",
|
|
"PagePool",
|
|
"PrefixCache",
|
|
"Storage",
|
|
"TaskTable",
|
|
"page_hash",
|
|
"Executor",
|
|
"InferenceScheduler",
|
|
"STOP",
|
|
"Task",
|
|
"TaskManager",
|
|
"TaskStatus",
|
|
]
|