[CI][CPU] Fix worker shutdown crash on CPU backend#41130
Closed
haosdent wants to merge 1 commit intovllm-project:mainfrom
Closed
[CI][CPU] Fix worker shutdown crash on CPU backend#41130haosdent wants to merge 1 commit intovllm-project:mainfrom
haosdent wants to merge 1 commit intovllm-project:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a new private method, _empty_cache, to both CPUModelRunner and GPUModelRunner classes for standardized cache management. The GPUModelRunner's implementation wraps torch.accelerator.empty_cache(), while the CPU version is a no-op. Additionally, the _cleanup_profiling_kv_cache method in GPUModelRunner is refactored to utilize these new and existing private methods (_empty_cache and _sync_device), abstracting direct calls to torch.accelerator functions for improved encapsulation and consistency. There is no feedback to provide.
PR vllm-project#38503 added a model_runner.shutdown() call from Worker.shutdown(), which invokes _cleanup_profiling_kv_cache() containing direct torch.accelerator.synchronize() and torch.accelerator.empty_cache() calls. On CPU-only hosts these raise "Cannot access accelerator device when none is available." causing every CPU CI worker to crash on teardown and the suite to time out. Route both calls through the existing _sync_device() virtualization hook plus a matching new _empty_cache() hook, with no-op overrides on CPUModelRunner. XPU keeps inheriting the GPU defaults since torch.accelerator works there. Signed-off-by: haosdent <haosdent@gmail.com>
Member
|
Thanks for the fix :) But it duplicates with #41034 |
Contributor
Author
|
thanks @bigPYJ1151 |
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.
Purpose
Fix CPU CI regression from #38503. The new
Worker.shutdown()→model_runner.shutdown()→_cleanup_profiling_kv_cache()path callstorch.accelerator.synchronize()/empty_cache()directly, which raiseRuntimeError: Cannot access accelerator device when none is available.on CPU-only hosts. Every CPU worker crashes on teardown and the suite times out (Buildkite #63257, exit 124).Route both calls through the existing
_sync_device()virtualization hook plus a matching new_empty_cache()hook, with no-op overrides onCPUModelRunner. XPU is unaffected (torch.acceleratorworks there).Test Plan
Test Result