Repository navigation
[TRTLLM-16316][feat] Generalize Runtime Sleep/Wakeup for LLM and trtllm-serve - #19016
Conversation
|
/bot run |
trtllm-servetrtllm-serve
|
PR_Github #72713 [ run ] triggered by Bot. Commit: |
|
PR_Github #72713 [ run ] completed with state
|
|
/bot run |
|
PR_Github #72747 [ run ] triggered by Bot. Commit: |
|
PR_Github #72747 [ run ] completed with state
|
07e5e71 to
3377097
Compare
|
/bot run |
|
PR_Github #72919 [ run ] triggered by Bot. Commit: |
|
PR_Github #72919 [ run ] completed with state
|
3377097 to
9899af1
Compare
|
/bot run |
|
PR_Github #72955 [ run ] triggered by Bot. Commit: |
|
PR_Github #72955 [ run ] completed with state
|
9899af1 to
33013ab
Compare
Enforce a five-minute signed timestamp window and atomically claim each accepted nonce in a server-scoped, lock-protected replay cache. Retain nonces for their complete validity interval, prune only expired entries, and fail closed when the bounded cache reaches capacity. Validate signatures before consuming cache state and claim the nonce before dispatching the control action. Cover missing and malformed headers, past and future expiry, boundary timestamps, exact and changed-request replays, cache capacity and expiry, invalid-signature ordering, and concurrent duplicate requests. Document retry and replay-cache behavior. Signed-off-by: Robin Kobus <[email protected]>
KV-cache allocations restored with NONE or MEMSET no longer contain the original cache data. V1 nevertheless retained its prefix-reuse metadata across sleep, allowing a later request to match blocks whose physical contents had been discarded or zeroed. Clear the V1 prefix cache after the executor is quiesced and immediately before releasing tagged KV memory. Limit invalidation to enabled V1 block reuse, KV-cache releases, and destructive restore modes so CPU/PINNED preservation and V2 behavior remain unchanged. Apply the hook to single-rank, MPI rank-zero and peer, and Ray sleep paths. Add CPU-only coverage for the mode/manager/reuse decision matrix and assertions that local and Ray sleep dispatch the invalidation hook. Signed-off-by: Robin Kobus <[email protected]>
KVCacheManagerV2 owns its main pools through an allocator outside the tagged virtual-memory release path. Accepting a KV_CACHE sleep request therefore reported the cache as parked even though those pools remained resident. Validate requested sleep tags at the worker boundary before beginning the admission transition or dispatching collective work. Reject KV_CACHE whenever manager V2 is active while preserving model-only V2 sleep and existing V1 behavior. Apply the validation consistently to local, MPI, and Ray workers. Add coverage for V1 and V2 tag combinations, mixed model/KV requests, pre-transition rejection, and Ray validation dispatch. Signed-off-by: Robin Kobus <[email protected]>
Signed-off-by: Robin Kobus <[email protected]>
Add synchronous and asynchronous resume tests that pass a mix of string and enum memory tags, including a duplicate. Verify that each API queries runtime memory status before issuing wakeup and that wakeup receives the exact normalized, deduplicated tag list. This retains coverage of the required status RPC while exercising the explicit-tag path. Signed-off-by: Robin Kobus <[email protected]>
Document in the KV_CACHE memory-tag entry that sleep requests are rejected when KV-cache manager V2 is enabled. This exposes the existing runtime limitation where users choose sleep tags. Signed-off-by: Robin Kobus <[email protected]>
Replace the sleep control-action decorator with an explicit context entered after begin_sleep_transition. Concurrent submission threads must observe PARKING before the control sentinel is queued, so they cannot leave requests behind the sentinel that run after GPU memory is released. Keep control-action entry and exit within the transition failure handler, restoring admission on pre-mutation failures and failing closed after memory mutation. Add regressions using the real admission queue and an independent submission thread, plus a drain-entry failure test. Validation: 30 Ray sleep-state and request-queue tests pass using the repository Ray stub because Ray is unavailable locally. All applicable pre-commit checks pass. Signed-off-by: Robin Kobus <[email protected]>
Add blocking collective_rpc dispatch to GenerationExecutorWorker so LLM release, get_memory_status, and resume work when the default orchestrator selects an in-process worker, including TP1 generation-logits gathering. Reuse the MPI proxy guards for multi-rank methods and rank selection. Reject nonblocking dispatch explicitly and propagate worker errors. Add CPU regression coverage for the LLM call path, arguments, results, and dispatch guards. Validation: 85 tests passed in test_sleep_collective_rpc_guards.py; pre-commit checks passed after formatting. Signed-off-by: Robin Kobus <[email protected]>
Runtime-control nonces are retained in a frontend-local replay cache. A signed release consumed by one frontend can therefore be accepted by a sibling after a legitimate resume while the signature remains valid, parking the shared executor again. Require a single frontend when runtime-control endpoints are enabled, both before server launch and when constructing OpenAIServer directly. Cover CLI, YAML, and --set frontend counts, synchronous and asynchronous generators, and replay rejection across a legitimate resume. Validation: 42 focused tests passed; pre-commit checks passed. The existing autodeploy rejection test fails because the removed backend is rejected by Click before sleep-mode validation and was excluded from the passing run. Signed-off-by: Robin Kobus <[email protected]>
AutoDeploy has been removed from the serving CLI. Remove the obsolete sleep-mode backend rejection test and its documentation reference while retaining the gRPC restriction. Validation: all 8 sleep-mode tests passed. Signed-off-by: Robin Kobus <[email protected]>
A release failure after memory mutation can leave admission failed before parked tags are published. Default resume previously treated the empty tag list as success and bypassed the worker state guard. Validate the reconciled status in synchronous and asynchronous resume before normalizing tags. Reject parking, waking, and failed states using the worker error wording while preserving the running no-op and parked restore behavior. Add CPU CI regression coverage for default and explicit tags with empty and populated parked tags. Validation: 86 memory API and serving tests passed. Signed-off-by: Robin Kobus <[email protected]>
Validate the embedding server role in OpenAIServer before initializing the server or registering runtime-control routes. Embedding servers do not support the runtime-control endpoint lifecycle. Add a CPU regression test with an encode-only LLM and otherwise valid runtime-control settings, asserting that construction raises ValueError before runtime-control route registration. Validation: all 9 serve sleep-mode tests and pre-commit checks pass. Signed-off-by: Robin Kobus <[email protected]>
TinyLlama selects KV cache manager V2 under the automatic default, but KV-cache sleep is unsupported by V2. Explicitly select V1 for the TP=2 KV-cache-only test so it exercises the supported release and resume path. Validation: Python syntax parsing and git diff --check passed. GPU test was not run. Signed-off-by: Robin Kobus <[email protected]>
Add a single-GPU TinyLlama test using KV cache manager V1 and block reuse. Tokenize a prompt longer than the configured KV block size and verify that warming the prompt reuses cached blocks without changing generated tokens. Release and resume only the KV cache with restore mode NONE, then verify that the next request reuses no stale blocks and produces the same tokens as before release. Validation: ruff lint and formatting, Python syntax parsing, and git diff --check passed. GPU execution is blocked by local bindings missing StreamingBlockRemovedData during TensorRT-LLM import. Signed-off-by: Robin Kobus <[email protected]>
Signed-off-by: Robin Kobus <[email protected]>
Signed-off-by: Robin Kobus <[email protected]>
The MNNVL engine checkpoint coordination test constructs a PyExecutor with object.__new__, bypassing its constructor. The sleep listener calls invalidate_v1_prefix_cache_for_sleep, which reads _is_kv_manager_v2 and enable_kv_cache_reuse. The synthetic executor omitted both attributes, causing AttributeError on peer ranks during checkpoint coordination. Initialize both flags to False in the test worker setup. The executor shell has no KV-cache reuse resources, so invalidation can safely return while the test continues to exercise the production coordinator, listener, and native MNNVL checkpoint hooks. Validation: nine focused tests covering V1 prefix-cache invalidation and MNNVL sleep/wakeup coordination passed. Ruff lint, formatting, and git diff --check passed. Signed-off-by: Robin Kobus <[email protected]>
5f50224 to
df782fd
Compare
|
/bot run |
|
PR_Github #77297 [ run ] triggered by Bot. Commit: |
|
PR_Github #77297 [ run ] completed with state
|
Barry-Delaney
left a comment
There was a problem hiding this comment.
Re-reviewed df782fd after the rebase. Range-diff against the previously reviewed 92c93ca retains the 29-commit series; the differing patches adapt the serving imports/CLI signature, single-frontend launch wiring and MPI test context to main. The runtime control frontend guard and argument forwarding remain intact, and the prefix invalidation behavior is unchanged. No new blocking code finding. All 25 changed Python files parse and diff --check passes; GPU tests were not rerun locally.
|
/bot run --disable-fail-fast |
|
PR_Github #77505 [ run ] triggered by Bot. Commit: |
|
/bot run |
|
PR_Github #77670 [ run ] triggered by Bot. Commit: |
|
PR_Github #77505 [ run ] completed with state |
|
PR_Github #77670 [ run ] completed with state |
Dev Engineer Review
LLMand asynchronousAsyncLLM.trtllm-serve --enable_sleep_modeoption.SUCCESS, but five corresponding L0 pipelines reportedFAILUREand three reportedUNSTABLE. The latest run reportedUNSTABLE.QA Engineer Review
ci: full pre-merge approvedlabel.Per-File QA Perspective
docs/source/features/sleep-wakeup.md: Verify documented API defaults, restore modes, eligibility, and GMS exclusions against implementation behavior.docs/source/index.rst: Verify the sleep/wakeup guide appears in the Features table of contents.tensorrt_llm/_torch/async_llm.py: Verify async status reconciliation, tag normalization, and default release and resume behavior.tensorrt_llm/_torch/pyexecutor/executor_request_queue.py: Verify status snapshots reflect admission state and parked tags atomically.tensorrt_llm/_torch/pyexecutor/py_executor.py: Verify status reporting, V1 prefix-cache invalidation conditions, and V2 rejection.tensorrt_llm/commands/serve.py: Verify sleep-mode backend and serving restrictions, API-key requirements, and default sleep configuration.tensorrt_llm/executor/base_worker.py: Verify tag filtering, transition checks, retries, and prefix-cache invalidation before sleep.tensorrt_llm/executor/proxy.py: Verifyget_memory_statusforwards correctly through multi-rank RPC.tensorrt_llm/executor/ray/gpu_worker.py: Verify transition publication, abort behavior before mutation, and failed-state handling after mutation.tensorrt_llm/llmapi/__init__.py: Verify the runtime-memory types are available through the public package exports.tensorrt_llm/llmapi/llm.py: Verify synchronous API tag validation, status reconciliation, and default and explicit release/resume behavior.tensorrt_llm/llmapi/llm_args.py: Verify allowed runtime-memory states and parked-tag ordering.tensorrt_llm/serve/openai_protocol.py: Verify optional runtime-memory tag parsing and handling of omitted versus empty tags.tensorrt_llm/serve/openai_server.py: Verify route enablement, authentication, sync/async dispatch, and HTTP error mapping.tensorrt_llm/serve/runtime_control_auth.py: Verify request signing, timestamp checks, and replay-cache behavior.tests/integration/test_lists/test-db/l0_cpu.yml: Adds CI entries fortest_runtime_control.py,test_runtime_memory_api.py, andtest_serve_sleep_mode.py.tests/integration/test_lists/test-db/l0_h100.yml: Adds the Ray sleep-state test to the H100 CI list.tests/unittest/_torch/executor/test_executor_request_queue.py: Covers parked-tag snapshots after partial restoration; listed in the CPU test list.tests/unittest/_torch/multi_gpu/test_mpi_sleep_wakeup.py: Covers public release/resume and partial restoration; included in the multi-GPU test suite, whose CI requires the full pre-merge approval label.tests/unittest/api_stability/references/llm.yaml: Adds API stability references forget_memory_status,release, andresume.tests/unittest/api_stability/references/trtllm_serve_cli.yaml: Adds the--enable_sleep_modeCLI stability reference.tests/unittest/executor/test_ray_sleep_state.py: Covers transition success and pre-/post-mutation failures; listed in the H100 test list.tests/unittest/executor/test_sleep_collective_rpc_guards.py: Covers V2 rejection, V1 invalidation conditions, retry behavior, and collective RPC forwarding.tests/unittest/llmapi/apps/test_anthropic_routes.py: Updates route-test setup for runtime-control endpoint state.tests/unittest/llmapi/test_runtime_control.py: Covers authentication, replay and nonce handling, endpoint errors, and conflicting control configuration; listed in the CPU test list.tests/unittest/llmapi/test_runtime_memory_api.py: Covers sync and async tag validation, status reconciliation, defaults, and no-op resume; listed in the CPU test list.tests/unittest/llmapi/test_serve_sleep_mode.py: Covers sleep-mode restrictions, default configuration, and server authentication setup; listed in the CPU test list.tests/unittest/llmapi/test_async_llm.py: Updates async release/resume coverage to exclude initialization-only memory types.Description
Test Coverage
PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
If PR introduces API changes, an appropriate PR label is added - either
api-compatibleorapi-breaking. Forapi-breaking, includeBREAKINGin the PR title.Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
Update tava architecture diagram if there is a significant design change in PR.
The reviewers assigned automatically/manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.
GitHub Bot Help
To see a list of available CI bot commands, please comment
/bot help.