[PR #1471] [CLOSED] feat: optionally offload idle session state while keeping model weights loaded #3477

Closed
opened 2026-11-07 14:41:44 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/1471
Author: @W1nge
Created: 10/7/2026
Status: ❌ Closed

Base: main ← Head: codex/idle-session-offload


📝 Commits (1)

  • 71c5d7e feat: offload idle serving session state with stable CUDA addresses

📊 Changes

10 files changed (+676 additions, -13 deletions)

View changed files

📝 CMakeLists.txt (+7 -1)
➕ docs/IDLE_SESSION.md (+38 -0)
➕ include/strata/core/idle_cache.hpp (+61 -0)
📝 include/strata/core/mtp.hpp (+5 -0)
📝 serve/server.py (+13 -0)
➕ serve/test_idle_cache_status.py (+25 -0)
➕ src/core/idle_cache.cpp (+249 -0)
📝 src/core/mtp.cpp (+7 -4)
📝 src/program/generate.cpp (+180 -8)
➕ tests/cuda/idle_cache_test.cpp (+91 -0)

📄 Description

An idle serving process currently keeps its session VRAM and host checkpoint payloads allocated even when the model should stay loaded but no request is running. This adds opt-in session offload using the existing CUDA VMM implementation: commit a process-local snapshot, release physical session pages, then restore at the same virtual addresses on the next command.

The default remains disabled. The supported scope is one CUDA VMM GPU with fully resident KV; incompatible batch, pipeline, remote, multi-GPU and elastic-KV configurations are rejected. Writes finish before memory is released; write failure retains memory. Missing, corrupt or expired snapshots clear cached history and reread the next prompt. GPU remap failure is fatal. The server exposes cache state and released bytes in /v1/status. Usage and limitations are in docs/IDLE_SESSION.md.

Validation on Windows / RTX 2080 Ti, based on v0.1.40.3:

  • Full engine build and native idle_cache_test: exact multi-region restore, CUDA graph replay after remapping, constants, corruption/truncation/missing/expired files and cleanup.
  • 263 Python server tests passed; the cache-status test was rerun after final changes.
  • Real IQ3_XXS, INT8 KV, MTP HTTP lifecycle passed twice: idle save and cache-hit restore, corrupt-file fallback, expiry fallback, cancellation followed by offload and successful generation. The 4096-context snapshot was 309,197,048 bytes, with approximately 5.3 s save and 367 ms restore in one local run. These are local operation timings, not a throughput claim.

Linux/HIP and other GPUs were not runtime-tested. Explicit conversation SAVE/RESTORE commands have not received a separate offloaded-state integration test. This is a focused port of our local idle-session implementation, adapted to upstream VmmRange and current checkpoint fields; no machine-specific tuning is enabled.

Prepared and tested with Codex at the repository owner's request.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/1471 **Author:** [@W1nge](https://github.com/W1nge) **Created:** 10/7/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `codex/idle-session-offload` --- ### 📝 Commits (1) - [`71c5d7e`](https://github.com/Niko1221/Strata/commit/71c5d7e530f22306fb0bc937d7da5582e9e64b14) feat: offload idle serving session state with stable CUDA addresses ### 📊 Changes **10 files changed** (+676 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+7 -1) ➕ `docs/IDLE_SESSION.md` (+38 -0) ➕ `include/strata/core/idle_cache.hpp` (+61 -0) 📝 `include/strata/core/mtp.hpp` (+5 -0) 📝 `serve/server.py` (+13 -0) ➕ `serve/test_idle_cache_status.py` (+25 -0) ➕ `src/core/idle_cache.cpp` (+249 -0) 📝 `src/core/mtp.cpp` (+7 -4) 📝 `src/program/generate.cpp` (+180 -8) ➕ `tests/cuda/idle_cache_test.cpp` (+91 -0) </details> ### 📄 Description An idle serving process currently keeps its session VRAM and host checkpoint payloads allocated even when the model should stay loaded but no request is running. This adds opt-in session offload using the existing CUDA VMM implementation: commit a process-local snapshot, release physical session pages, then restore at the same virtual addresses on the next command. The default remains disabled. The supported scope is one CUDA VMM GPU with fully resident KV; incompatible batch, pipeline, remote, multi-GPU and elastic-KV configurations are rejected. Writes finish before memory is released; write failure retains memory. Missing, corrupt or expired snapshots clear cached history and reread the next prompt. GPU remap failure is fatal. The server exposes cache state and released bytes in `/v1/status`. Usage and limitations are in `docs/IDLE_SESSION.md`. Validation on Windows / RTX 2080 Ti, based on v0.1.40.3: - Full engine build and native `idle_cache_test`: exact multi-region restore, CUDA graph replay after remapping, constants, corruption/truncation/missing/expired files and cleanup. - 263 Python server tests passed; the cache-status test was rerun after final changes. - Real IQ3_XXS, INT8 KV, MTP HTTP lifecycle passed twice: idle save and cache-hit restore, corrupt-file fallback, expiry fallback, cancellation followed by offload and successful generation. The 4096-context snapshot was 309,197,048 bytes, with approximately 5.3 s save and 367 ms restore in one local run. These are local operation timings, not a throughput claim. Linux/HIP and other GPUs were not runtime-tested. Explicit conversation SAVE/RESTORE commands have not received a separate offloaded-state integration test. This is a focused port of our local idle-session implementation, adapted to upstream VmmRange and current checkpoint fields; no machine-specific tuning is enabled. Prepared and tested with Codex at the repository owner's request. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 14:41:44 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#3477
No description provided.