fix(hcu): prevent MRV2 async output stalls - #25
Open
alexanderbin123 wants to merge 3 commits into
Open
alexanderbin123 wants to merge 3 commits into
alexanderbin123 wants to merge 3 commits into
Conversation
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
VLLM_ENGINE_ITERATION_TIMEOUT_Sso workers cannot silently block foreverFAILUREresponse pathRoot cause of the MRV2 async-output stall
MRV2 copies sampled tokens and related output tensors to CPU on a dedicated output stream. Upstream
AsyncOutputrecords a CUDA-specific blocking event for that copy and later waits with an unbounded call:On HCU, the event/copy completion wait was observed to occasionally stop returning. Because
synchronize()has no deadline, the async-output thread could remain blocked forever. The worker would then enqueue neither aModelRunnerOutputnor a failure response, so the engine and HTTP request appeared to hang silently.This MR addresses the confirmed failure mechanism in two layers:
torch.EventAPI instead of the CUDA-only blocking event pathevent.query()polling bounded byVLLM_ENGINE_ITERATION_TIMEOUT_SIf the event does not complete before the deadline,
get_output()raisesTimeoutError;WorkerProc.enqueue_output()converts it into aFAILUREresponse, allowing the engine to fail explicitly instead of waiting forever.The lower-level reason an individual HCU runtime event or asynchronous D2H copy can fail to complete is not established by this MR. The fix hardens the vLLM/HCU integration boundary so such a runtime condition cannot become an unbounded silent worker stall.
Scope
This MR targets
v0.25.1and contains only the MRV2 stability fix and its regression tests. It does not include model adaptation, MoE, attention, or other operator changes.Validation
953 passed, 37 deselected70 passedReview follow-up: test module-state isolation
Problem
test_hcu_model_runner_v2_is_thin_upstream_adaptertemporarily replacesvllm.v1.worker.gpu.model_runnerand re-imports the HCU MRV2 adapter. The test restored thesys.modulesentry, but left thevllm_hcu.v1.hcu_model_runner_v2attribute on the parent package pointing to the temporary adapter module.When
test_hcu_mrv2_runner_routes_async_output_before_upstream_initran afterward,from vllm_hcu.v1 import hcu_model_runner_v2returned that stale module. The runner then updatedAsyncOutputon the temporary upstream module instead of the restored real module, making the test suite order-dependent.Impact
1 passed, 1 failedFix
Commit
8d8ce8asnapshots, removes, and restores both the adapter'ssys.modulesentry and its parent-package attribute in afinallyblock. This preserves the thin-adapter assertions while guaranteeing cleanup on success, import failure, or assertion failure.Additional validation
2 passed40 passed45 passedcompileallandgit diff --check: passed