Add bounded LLM worker cancellation - #22070
Open
seyeong-han wants to merge 3 commits into
Open
Conversation
seyeong-han
requested review from
kirklandsign and
larryliu0820
as code owners
August 24, 2026 07:26
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/22070
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit ca6c74a with merge base cff6f4d ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR needs a
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add bounded cancellation for the existing process-isolated LLM worker protocol.
supports_canceland pass monotonically increasing request IDs over JSONL.stop()never waits behind the blocking request/response lock.LLMSession::stop()once at the next decode boundary. Cancelled sessions are marked dirty and reset before reuse./healthas unavailable. Model reload remains the supervisor's responsibility.Review guide:
examples/llm_server/python/worker_client.py.examples/llm_server/python/session_runtime.py,serving_chat.py, andserver.py.examples/llm_server/cpp/worker_loop.h.examples/models/muse-glimmer/runtime/runners/muse_glimmer_worker.cpp.Cancellation remains token-boundary cooperative: it cannot interrupt active prefill, vision preparation, or an in-progress backend invocation. The process fallback provides the bound in those cases.
Test plan
pytest -q examples/llm_server/python/tests(229 passed, 6 skipped)test_worker_loopandtest_worker_prefill_plan(2/2CTests passed)muse_glimmer_worker,qwen3_5_moe_worker, andgemma4_31b_workertargets