-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Hardware][Intel GPU] Add intel GPU pipeline parallel support. #7810
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import vllm.envs as envs | ||
from vllm.executor.multiproc_gpu_executor import ( | ||
MultiprocessingGPUExecutor, MultiprocessingGPUExecutorAsync) | ||
from vllm.executor.xpu_executor import XPUExecutor | ||
from vllm.logger import init_logger | ||
from vllm.utils import make_async | ||
|
||
logger = init_logger(__name__) | ||
|
||
|
||
class MultiprocessingXPUExecutor(MultiprocessingGPUExecutor, XPUExecutor): | ||
"""Python multiprocessing-based multi-XPU executor""" | ||
|
||
def _check_executor_parameters(self): | ||
mp_method = envs.VLLM_WORKER_MULTIPROC_METHOD | ||
if mp_method != "spawn": | ||
raise RuntimeError( | ||
"XPU multiprocess executor only support spawn as mp method") | ||
|
||
|
||
class MultiprocessingXPUExecutorAsync(MultiprocessingXPUExecutor, | ||
MultiprocessingGPUExecutorAsync): | ||
|
||
def __init__(self, *args, **kwargs): | ||
super().__init__(*args, **kwargs) | ||
self.driver_exec_model = make_async(self.driver_worker.execute_model) |
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this the case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will throw such error if use fork
https://github.com/pytorch/pytorch/blob/main/torch/xpu/__init__.py#L114
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you initialize the gpu somewhere? usually this needs to be avoided, and should already be avoided in vllm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"spawn" will not work when users run
LLM
class directly, withoutif __name__ == "__main__"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when you import
intel_extension_for_pytorch
, it will call xpu initialization implicitly. and will fall into native runtime. I guess it will detect whether the process is started viafork
orspawn
.What do you mean
"spawn" will not work when users run LLM class directly
here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see #5637 for example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, got your point. I just tried with offline_inference.py with spawn + mp backend, it will throw same error in this issue. While this works fine with api_server(using
_AsyncLLMEngine
).I think ipex& xpu is following earlier CUDA implementation (CUDA also have similar issue long time ago, see pytorch/pytorch#40403) and I believe this(using fork as start method) can be fixed in the future.
So how about change to this way:
if user use
LLMEngine
on xpu, we will not support use mp as distributed backend.(spawn needs main function call, fork are not supported by torch xpu support yet)if user use
_AsyncLLMEngine
, and use mp as backend, please use spawn as start method.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated, thanks!