-
-
Notifications
You must be signed in to change notification settings - Fork 35
feat(scheduler): VramReservationManager — atomic VRAM bookkeeping for GpuArbiter [#1683] #1759
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a32ea2b
9714de0
1277abe
74b1185
d51641a
6a8f8f9
34ed95a
c7fde9d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,7 +57,8 @@ async def get_response(self, path, scope): | |
| from tinyagentos.backend_adapters import check_backend_health | ||
| from tinyagentos.benchmark import BenchmarkStore | ||
| from tinyagentos.installation_state import InstallationState | ||
| from tinyagentos.scheduler import BackendCatalog, HistoryStore, ScoreCache, TaskScheduler | ||
| from tinyagentos.scheduler import BackendCatalog, GpuArbiter, HistoryStore, ScoreCache, TaskScheduler | ||
| from tinyagentos.scheduler.gpu_arbiter import _probe_nvidia_vram | ||
| from tinyagentos.scheduler.discovery import build_scheduler as build_resource_scheduler | ||
| from tinyagentos.torrent_settings import TorrentSettingsStore | ||
| from tinyagentos.relationships import RelationshipManager | ||
|
|
@@ -1124,6 +1125,7 @@ async def _reload_llm_proxy_on_catalog_change() -> None: | |
| # Build the resource scheduler from hardware profile + live catalog. | ||
| # Phase 1: local resources only (NPU + CPU), capability-based routing | ||
| # with fallback and priority. Cluster-aware dispatch is Phase 3. | ||
| resource_scheduler = None | ||
| try: | ||
| resource_scheduler = build_resource_scheduler( | ||
| hardware_profile, | ||
|
|
@@ -1140,6 +1142,24 @@ async def _reload_llm_proxy_on_catalog_change() -> None: | |
| except Exception: | ||
| logger.exception("resource scheduler failed to build — routes will use static config") | ||
| app.state.resource_scheduler = None | ||
|
|
||
| # Build the GPU arbiter — wraps the resource scheduler with VRAM-accounted | ||
| # admission control, queuing, and eviction for GPU-bound workloads. | ||
| try: | ||
| gpu_arbiter = GpuArbiter( | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CRITICAL: Consequence: Reply with |
||
| scheduler=resource_scheduler if resource_scheduler is not None else None, | ||
| cluster_manager=cluster_manager, | ||
| vram_probe=_probe_nvidia_vram, | ||
| max_queue_size=100, | ||
| eviction_enabled=True, | ||
| ) | ||
| await gpu_arbiter.start() | ||
| app.state.gpu_arbiter = gpu_arbiter | ||
| cluster_manager._gpu_arbiter = gpu_arbiter # wire for eviction paths | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. WARNING: Reply with |
||
| logger.info("GPU arbiter ready (queue size=100, eviction=enabled)") | ||
| except Exception: | ||
| logger.exception("GPU arbiter failed to start — GPU tasks will use vanilla scheduler") | ||
| app.state.gpu_arbiter = None | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| # Detect and set container runtime | ||
| from tinyagentos.containers.backend import configure_container_runtime | ||
| configure_container_runtime(config) | ||
|
|
@@ -1567,6 +1587,7 @@ async def dispatch(self, request, call_next): | |
| import platform as _platform | ||
| app.state.host_arch = _platform.machine() | ||
| app.state.trace_registry = None | ||
| app.state.gpu_arbiter = None | ||
| app.state.otel_emitter = None | ||
| app.state.span_store_registry = None | ||
| app.state.bridge_sessions = None | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SUGGESTION: Importing the private symbol
_probe_nvidia_vram(underscore-prefixed) couplesapp.pyto an internal API ofgpu_arbiterthat may be renamed or removed without notice. Consider exporting a public probe name (e.g.probe_nvidia_vram) or aGpuArbiterfactory, and importing that instead.Reply with
@kilocode-bot fix itto have Kilo Code address this issue.