-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[Core] Introduce SPMD worker execution using Ray accelerated DAG #6032
Conversation
014685e
to
1758da9
Compare
I'd like to support this, but currently the problem is we need to serialize I think the first step should be simplify these two structure. |
Can you help me understand the problem better @youkaichao ? I want to understand if it's something we can solve with deltas, plus moving the on-device fields to worker state (like what Jamba modeling does). |
@cadedaniel I think #6241 should be a starting point. And, if this PR can achieve the same performance as the main, then I would be glad to accept it. My current impression is this would be slow because of the inefficient serialization overhead. |
OK. @ruisearch42 will collect numbers and report 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.
This changes the semantic of existing env var USE_RAY_COMPILED_DAG completely. Maybe we should just deprecate this env var (just raise an exception) and replace it to USE_SPMD_WORKER?
this is correct. Our old fork shows that doing input delta optimization can match the perf with the master. Do you think it makes sense to merge the PR and follow up after given the feature is isolated using an env var? |
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.
LGTM if tests pass!
sorry for the long wait. I did some benchmarking for this branch on 4 H100: without spmd (using mp backend): $ python benchmarks/benchmark_throughput.py --output-len 256 --input 256 --model meta-llama/Llama-2-7b-hf -tp 4
Throughput: 32.98 requests/s, 16883.88 tokens/s with spmd: $ VLLM_USE_SPMD_WORKER=1 VLLM_USE_RAY_COMPILED_DAG=1 python benchmarks/benchmark_throughput.py --output-len 256 --input 256 --model meta-llama/Llama-2-7b-hf -tp 4 --distributed-executor-backend ray
Throughput: 17.78 requests/s, 9102.25 tokens/s the throughput is only a half. I might be wrong in the benchmarking, please help me investigate or reproduce. there is also a shutdown error, although it is benign:
In general, this is the direction I want to push in the future. However, I would say this implementation is quick and dirty. It is too specialized, and would leave much tech debit for the future. We have two control-plane execution pattern in the same codebase, and the code can be very confusing. By "quick and dirty", I mean, this PR only specializes to My original plan, is to analyze which objects should live in the engine process and which objects should live in the worker process, and then minimize the data transfer between engine process and worker process. Then we can confidently remove the non-spmd style code completely. |
@youkaichao we will take a look at the benchmark. I am 99% sure it is due to that we send all tokens to workers at each batch. The overhead increases with more batch size. So this requires delta input optimization. |
why the benchmark of latency shown in #6032 (comment) is so different from benchmark of throughput then?
I assume this would also affect benchmark of latency. |
Btw, we are confirming the theory now! Latency benchmark has lower batch size in general compared to throughput benchmark, and I assume that's why. (so with higher batch, serialization overhead is much higher without delta optimization). But 2X is pretty big, and rui is taking a look at this. |
Looking into the benchmarks. Some quick responses:
Thanks for reporting. This is likely some Ray/config issue, I happen to see the same error yesterday where ADAG is not used. I didn't run into it last time in testing. Will take a look.
Hmm, I think in SPMD mode
Great thought. We are probably moving towards the same direction. In this PR, SPMD is config guarded and the plan is to remove non-SPMD path in future without being blocked. |
thanks for another review @youkaichao ! |
Signed-off-by: Rui Qiao <[email protected]>
Head branch was pushed to by a user without write access
dc0e6bb
to
90e358f
Compare
Signed-off-by: Rui Qiao <[email protected]>
…m-project#6032) Signed-off-by: Rui Qiao <[email protected]> Co-authored-by: Stephanie Wang <[email protected]>
…m-project#6032) Signed-off-by: Rui Qiao <[email protected]> Co-authored-by: Stephanie Wang <[email protected]>
…m-project#6032) Signed-off-by: Rui Qiao <[email protected]> Co-authored-by: Stephanie Wang <[email protected]>
…m-project#6032) Signed-off-by: Rui Qiao <[email protected]> Co-authored-by: Stephanie Wang <[email protected]> Signed-off-by: Alvant <[email protected]>
…m-project#6032) Signed-off-by: Rui Qiao <[email protected]> Co-authored-by: Stephanie Wang <[email protected]>
This introduces an SPMD execution mode for Worker. In this mode, there is no longer a driver worker and the rank 0 worker is moved to a separate process. All workers are expected to take an ExecuteModelRequest input, instead of using NCCL as a control plane to receive inputs.
To keep the changes contained, for now, this path needs to be used with the new Ray accelerated DAG feature. Compared to Ray Core, this feature reduces system performance overheads for task execution and args passing, by using an execution loop and shared memory, respectively.
This PR is based on top of #5980 , and added the following:
Benchmarking
TP = 4, requests = 500
Latency column format: latency_with_spmd_change / latency_without_spmd_change
Summary
For smaller input lengths, the latency is better than or the same as before. For larger input lengths, the latency has small overhead. For larger input lengths, it is expected to have better latency when delta optimization is built on top (work starting soon).
BEFORE SUBMITTING, PLEASE READ THE CHECKLIST BELOW AND FILL IN THE DESCRIPTION ABOVE
PR Checklist (Click to Expand)
Thank you for your contribution to vLLM! Before submitting the pull request, please ensure the PR meets the following criteria. This helps vLLM maintain the code quality and improve the efficiency of the review process.
PR Title and Classification
Only specific types of PRs will be reviewed. The PR title is prefixed appropriately to indicate the type of change. Please use one of the following:
[Bugfix]
for bug fixes.[CI/Build]
for build or continuous integration improvements.[Doc]
for documentation fixes and improvements.[Model]
for adding a new model or improving an existing model. Model name should appear in the title.[Frontend]
For changes on the vLLM frontend (e.g., OpenAI API server,LLM
class, etc.)[Kernel]
for changes affecting CUDA kernels or other compute kernels.[Core]
for changes in the core vLLM logic (e.g.,LLMEngine
,AsyncLLMEngine
,Scheduler
, etc.)[Hardware][Vendor]
for hardware-specific changes. Vendor name should appear in the prefix (e.g.,[Hardware][AMD]
).[Misc]
for PRs that do not fit the above categories. Please use this sparingly.Note: If the PR spans more than one category, please include all relevant prefixes.
Code Quality
The PR need to meet the following code quality standards:
format.sh
to format your code.docs/source/
if the PR modifies the user-facing behaviors of vLLM. It helps vLLM user understand and utilize the new features or changes.Notes for Large Changes
Please keep the changes as concise as possible. For major architectural changes (>500 LOC excluding kernel/data/config/test), we would expect a GitHub issue (RFC) discussing the technical design and justification. Otherwise, we will tag it with
rfc-required
and might not go through the PR.What to Expect for the Reviews
The goal of the vLLM team is to be a transparent reviewing machine. We would like to make the review process transparent and efficient and make sure no contributor feel confused or frustrated. However, the vLLM team is small, so we need to prioritize some PRs over others. Here is what you can expect from the review process:
action-required
label on the PR if there are changes required. The contributor should address the comments and ping the reviewer to re-review the PR.Thank You
Finally, thank you for taking the time to read these guidelines and for your interest in contributing to vLLM. Your contributions make vLLM a great tool for everyone!