Skip to content

Conversation

@KuntaiDu
Copy link
Collaborator

@KuntaiDu KuntaiDu commented Jun 30, 2025

Essential Elements of an Effective PR Description Checklist

  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.

Purpose

Add a one-click runnable example for P2P NCCL XpYd introduced by #18242

(Optional) Documentation Update

@github-actions
Copy link

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can either: Add ready label to the PR or enable auto-merge.

🚀

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @KuntaiDu, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a new, self-contained example that allows users to quickly deploy and test the P2P NCCL XpYd disaggregated prefill feature within vLLM. It automates the setup of multiple vLLM instances and includes a basic benchmark to demonstrate the functionality.

Highlights

  • New Example Script: I've added a new one-click runnable example script, disagg_example_p2p_nccl_xpyd.sh, located in examples/online_serving/disaggregated_serving_p2p_nccl_xpyd/. This script demonstrates how to set up and run vLLM with P2P NCCL XpYd disaggregated prefill.
  • Disaggregated Serving Setup: The example script configures and launches one vLLM prefiller instance (acting as a KV producer) and three vLLM decoder instances (acting as KV consumers), all communicating via P2pNcclConnector for key-value transfer.
  • Automated Benchmarking: After successfully launching and verifying the vLLM servers, the script automatically executes a serving benchmark using benchmark_serving.py to simulate a workload against the disaggregated setup.
  • Prerequisite Checks: The script includes checks for necessary prerequisites such as the Hugging Face token, the availability of at least two GPUs, and the installation of required Python libraries (pandas, datasets, vllm, quart) to ensure a smooth execution experience.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@mergify mergify bot added the documentation Improvements or additions to documentation label Jun 30, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds a new example script for P2P NCCL disaggregated serving. The script is well-structured, but I've found a few issues related to correctness and robustness that should be addressed. My main concerns are an incorrect GPU count check which could lead to runtime failures, and missing shell script best practices for error handling. I've also pointed out a minor issue with signal trapping and a redundant environment variable definition.

KuntaiDu added 3 commits June 30, 2025 17:32
Signed-off-by: KuntaiDu <kuntai@uchicago.edu>
Signed-off-by: KuntaiDu <kuntai@uchicago.edu>
…ents.

Signed-off-by: KuntaiDu <kuntai@uchicago.edu>
@KuntaiDu KuntaiDu enabled auto-merge (squash) June 30, 2025 22:35
@github-actions github-actions bot added the ready ONLY add when PR is ready to merge/full CI is needed label Jun 30, 2025
@KuntaiDu
Copy link
Collaborator Author

Did a force push to resolve DCO issue.

@KuntaiDu KuntaiDu disabled auto-merge June 30, 2025 22:44
…used for XpYd

Signed-off-by: KuntaiDu <kuntai@uchicago.edu>
@KuntaiDu KuntaiDu merged commit 92ee7ba into vllm-project:main Jul 1, 2025
50 checks passed
@KuntaiDu KuntaiDu deleted the fix-p2p-doc branch July 1, 2025 04:04
@josephrocca
Copy link

josephrocca commented Jul 1, 2025

I'm probably doing something wrong, in which case please ignore this, but just in case it looks like it could be a bug: I tried DeepSeek using 1p1d based on this example, on a 8xH200 (i.e. 2x4xH200), and got this error on the decode server:

...                            
INFO 07-01 16:09:00 [launcher.py:37] Route: /invocations, Methods: POST                                                                                                                                         
INFO 07-01 16:09:00 [launcher.py:37] Route: /metrics, Methods: GET                                                                                                                                              
INFO:     Started server process [39501]                                                                                                                                                                        
INFO:     Waiting for application startup.                                                                                                                                                                      
INFO:     Application startup complete.                                                                                                                                                                         
(VllmWorker rank=0 pid=40513) INFO 07-01 16:19:04 [p2p_nccl_engine.py:46] set_p2p_nccl_context, original_values: {'NCCL_MAX_NCHANNELS': None, 'NCCL_MIN_NCHANNELS': None, 'NCCL_CUMEM_ENABLE': '0', 'NCCL_BUFFSIZE': None, 'NCCL_PROTO': None, 'NCCL_ALGO': None}
(VllmWorker rank=3 pid=40516) INFO 07-01 16:19:04 [p2p_nccl_engine.py:46] set_p2p_nccl_context, original_values: {'NCCL_MAX_NCHANNELS': None, 'NCCL_MIN_NCHANNELS': None, 'NCCL_CUMEM_ENABLE': '0', 'NCCL_BUFFSIZE': None, 'NCCL_PROTO': None, 'NCCL_ALGO': None}
(VllmWorker rank=1 pid=40514) INFO 07-01 16:19:04 [p2p_nccl_engine.py:46] set_p2p_nccl_context, original_values: {'NCCL_MAX_NCHANNELS': None, 'NCCL_MIN_NCHANNELS': None, 'NCCL_CUMEM_ENABLE': '0', 'NCCL_BUFFSIZE': None, 'NCCL_PROTO': None, 'NCCL_ALGO': None}
(VllmWorker rank=2 pid=40515) INFO 07-01 16:19:04 [p2p_nccl_engine.py:46] set_p2p_nccl_context, original_values: {'NCCL_MAX_NCHANNELS': None, 'NCCL_MIN_NCHANNELS': None, 'NCCL_CUMEM_ENABLE': '0', 'NCCL_BUFFSIZE': None, 'NCCL_PROTO': None, 'NCCL_ALGO': None}
(VllmWorker rank=3 pid=40516) INFO 07-01 16:19:05 [p2p_nccl_engine.py:307] 🤝ncclCommInitRank Success, 172.18.0.2:22004👈172.18.0.2:21004, MyRank:1                                                                                                             
(VllmWorker rank=2 pid=40515) INFO 07-01 16:19:05 [p2p_nccl_engine.py:307] 🤝ncclCommInitRank Success, 172.18.0.2:22003👈172.18.0.2:21003, MyRank:1                                                             
(VllmWorker rank=1 pid=40514) INFO 07-01 16:19:05 [p2p_nccl_engine.py:307] 🤝ncclCommInitRank Success, 172.18.0.2:22002👈172.18.0.2:21002, MyRank:1                                                                                                             
(VllmWorker rank=0 pid=40513) INFO 07-01 16:19:05 [p2p_nccl_engine.py:307] 🤝ncclCommInitRank Success, 172.18.0.2:22001👈172.18.0.2:21001, MyRank:1                                                             
INFO:     172.18.0.2:48792 - "POST /v1/completions HTTP/1.1" 200 OK                                                                                                                                             
(VllmWorker rank=3 pid=40516) ERROR 07-01 16:19:13 [multiproc_executor.py:522] WorkerProc hit an exception.                                                                                                     
(VllmWorker rank=3 pid=40516) ERROR 07-01 16:19:13 [multiproc_executor.py:522] Traceback (most recent call last):                                                                                               
(VllmWorker rank=3 pid=40516) ERROR 07-01 16:19:13 [multiproc_executor.py:522]   File "/root/vllm/vllm/v1/executor/multiproc_executor.py", line 517, in worker_busy_loop                                        
(VllmWorker rank=3 pid=40516) ERROR 07-01 16:19:13 [multiproc_executor.py:522]     output = func(*args, **kwargs)                                                                                               
(VllmWorker rank=3 pid=40516) ERROR 07-01 16:19:13 [multiproc_executor.py:522]              ^^^^^^^^^^^^^^^^^^^^^                                                                                               
(VllmWorker rank=3 pid=40516) ERROR 07-01 16:19:13 [multiproc_executor.py:522]   File "/opt/conda/lib/python3.11/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context                       
(VllmWorker rank=3 pid=40516) ERROR 07-01 16:19:13 [multiproc_executor.py:522]     return func(*args, **kwargs)                                                                                                 
(VllmWorker rank=3 pid=40516) ERROR 07-01 16:19:13 [multiproc_executor.py:522]            ^^^^^^^^^^^^^^^^^^^^^                                                                                                 
(VllmWorker rank=3 pid=40516) ERROR 07-01 16:19:13 [multiproc_executor.py:522]   File "/root/vllm/vllm/v1/worker/gpu_worker.py", line 308, in execute_model                                                     
(VllmWorker rank=3 pid=40516) ERROR 07-01 16:19:13 [multiproc_executor.py:522]     output = self.model_runner.execute_model(scheduler_output,                                                                   
(VllmWorker rank=3 pid=40516) ERROR 07-01 16:19:13 [multiproc_executor.py:522]              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                   
(VllmWorker rank=3 pid=40516) ERROR 07-01 16:19:13 [multiproc_executor.py:522]   File "/opt/conda/lib/python3.11/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context                       
(VllmWorker rank=3 pid=40516) ERROR 07-01 16:19:13 [multiproc_executor.py:522]     return func(*args, **kwargs)                                                                                                 
(VllmWorker rank=3 pid=40516) ERROR 07-01 16:19:13 [multiproc_executor.py:522]            ^^^^^^^^^^^^^^^^^^^^^                                                                                                 
(VllmWorker rank=3 pid=40516) ERROR 07-01 16:19:13 [multiproc_executor.py:522]   File "/root/vllm/vllm/v1/worker/gpu_model_runner.py", line 1374, in execute_model                                              
(VllmWorker rank=3 pid=40516) ERROR 07-01 16:19:13 [multiproc_executor.py:522]     self.maybe_setup_kv_connector(scheduler_output)                                                                              
(VllmWorker rank=3 pid=40516) ERROR 07-01 16:19:13 [multiproc_executor.py:522]   File "/root/vllm/vllm/v1/worker/gpu_model_runner.py", line 1697, in maybe_setup_kv_connector                                   
(VllmWorker rank=3 pid=40516) ERROR 07-01 16:19:13 [multiproc_executor.py:522]     kv_connector.start_load_kv(get_forward_context())                                                                            
(VllmWorker rank=3 pid=40516) ERROR 07-01 16:19:13 [multiproc_executor.py:522]   File "/root/vllm/vllm/distributed/kv_transfer/kv_connector/v1/p2p/p2p_nccl_connector.py", line 207, in start_load_kv 
(VllmWorker rank=3 pid=40516) ERROR 07-01 16:19:13 [multiproc_executor.py:522]     inject_kv_into_layer(kv_cache_layer, kv_cache,                                                                     
(VllmWorker rank=3 pid=40516) ERROR 07-01 16:19:13 [multiproc_executor.py:522]   File "/root/vllm/vllm/distributed/kv_transfer/kv_connector/v1/p2p/p2p_nccl_connector.py", line 167, in inject_kv_into_layer                                                     
(VllmWorker rank=3 pid=40516) ERROR 07-01 16:19:13 [multiproc_executor.py:522]     dst_kv_cache_layer = dst_kv_cache_layer.reshape(                                                                   
(VllmWorker rank=3 pid=40516) ERROR 07-01 16:19:13 [multiproc_executor.py:522]                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                   
(VllmWorker rank=3 pid=40516) ERROR 07-01 16:19:13 [multiproc_executor.py:522] RuntimeError: shape '[2, 36864, -1]' is invalid for input of size 360124416

Reproduction:

# Install vllm:
cd /root
git clone https://github.com/vllm-project/vllm.git
cd vllm
# Pinned to ~most recent commit as of writing:
git reset --hard ecad851cbd0a2a6f9922fc9f3e94bde3f8220176
VLLM_USE_PRECOMPILED=1 pip install --editable .
# Proxy server:
tmux new -s proxy
pip install quart==0.20.0
wget -O /root/disagg_proxy_p2p_nccl_xpyd.py "https://raw.githubusercontent.com/vllm-project/vllm/0e96cc9b7e473afda794fa3c32e83c391d9a3d27/examples/online_serving/disaggregated_serving_p2p_nccl_xpyd/disagg_proxy_p2p_nccl_xpyd.py"
python3 /root/disagg_proxy_p2p_nccl_xpyd.py
# Prefill server:
tmux new -s prefill
CUDA_VISIBLE_DEVICES=0,1,2,3 VLLM_USE_V1=1 VLLM_WORKER_MULTIPROC_METHOD=spawn VLLM_MARLIN_USE_ATOMIC_ADD=1 vllm serve RedHatAI/DeepSeek-R1-0528-quantized.w4a16 --enforce-eager --host 0.0.0.0 --port 20003 --tensor-parallel-size 4 --max-model-len 8192 --max-seq-len-to-capture 8192 --enable-chunked-prefill --enable-prefix-caching --trust-remote-code --disable-log-requests --gpu-memory-utilization 0.95 --served-model-name deepseek-chat --compilation-config '{"full_cuda_graph": true}' --kv-transfer-config '{"kv_connector":"P2pNcclConnector","kv_role":"kv_producer","kv_buffer_size":"1e1","kv_port":"21001","kv_connector_extra_config":{"proxy_ip":"0.0.0.0","proxy_port":"30001","http_port":"20003","send_type":"PUT_ASYNC","nccl_num_channels":"16"}}'
# Decode server:
tmux new -s decode
CUDA_VISIBLE_DEVICES=4,5,6,7 VLLM_USE_V1=1 VLLM_WORKER_MULTIPROC_METHOD=spawn VLLM_MARLIN_USE_ATOMIC_ADD=1 vllm serve RedHatAI/DeepSeek-R1-0528-quantized.w4a16 --enforce-eager --host 0.0.0.0 --port 20005 --tensor-parallel-size 4 --max-model-len 8192 --max-seq-len-to-capture 8192 --enable-chunked-prefill --enable-prefix-caching --trust-remote-code --disable-log-requests --gpu-memory-utilization 0.95 --served-model-name deepseek-chat --compilation-config '{"full_cuda_graph": true}' --kv-transfer-config '{"kv_connector":"P2pNcclConnector","kv_role":"kv_consumer","kv_buffer_size":"8e9","kv_port":"22001","kv_connector_extra_config":{"proxy_ip":"0.0.0.0","proxy_port":"30001","http_port":"20005","send_type":"PUT_ASYNC","nccl_num_channels":"16"}}'

Then I sent a request at the proxy server, and got the error on the decode server.

I tried removing all of these: --enable-chunked-prefill --enable-prefix-caching --compilation-config '{"full_cuda_graph": true}' but that didn't help.

@KuntaiDu
Copy link
Collaborator Author

KuntaiDu commented Jul 2, 2025

@Abatom Would be nice if you could take a look

@Abatom
Copy link
Contributor

Abatom commented Jul 3, 2025

@Abatom Would be nice if you could take a look

Sure, I'll take a look.

@renwuli
Copy link

renwuli commented Jul 6, 2025

same issue @Abatom
I have test 3 models with tp=8 and ep was enabled, each prefill or decode instance was run on a 8*H100 machine:

  1. DeepSeek-R1-0528-quantized.w4a16 failed, the error was reported the same as @josephrocca
  2. Llama-3.1-8B works
  3. deepseek-moe-16b-base works

@Abatom
Copy link
Contributor

Abatom commented Jul 6, 2025

same issue @Abatom
I have test 3 models with tp=8 and ep was enabled, each prefill or decode instance was run on a 8*H100 machine:

  1. DeepSeek-R1-0528-quantized.w4a16 failed, the error was reported the same as @josephrocca
  2. Llama-3.1-8B works
  3. deepseek-moe-16b-base works

Okay, I will reproduce DeepSeek-R1-0528.

@Abatom
Copy link
Contributor

Abatom commented Jul 7, 2025

@josephrocca @renwuli Can the non-quantized version of DeepSeek-R1-0528 work normally on H200?

@Abatom
Copy link
Contributor

Abatom commented Jul 7, 2025

@josephrocca @renwuli I don't have access to an H200. Could you help print out the type of attn_metadata in if isinstance(attn_metadata, MLACommonMetadata):? At first glance, it seems that the logic took the wrong branch, leading to a shape mismatch.

@renwuli
Copy link

renwuli commented Jul 7, 2025

@Abatom I don't have access to H200 either, but I can access to 2 H100s whose memory is 640GB in total, for the unquantized version of DeepSeek-R1 671B, do you have any suggestion in parallel config?

@Abatom
Copy link
Contributor

Abatom commented Jul 7, 2025

@Abatom I don't have access to H200 either, but I can access to 2 H100s whose memory is 640GB in total, for the unquantized version of DeepSeek-R1 671B, do you have any suggestion in parallel config?

The current P2P NCCL solution doesn't support pipeline parallelism (PP). We need one machine capable of running DeepSeek-R1 671B, and for a 1P1D setup, two machines are required.

By the way, would it be possible for us to communicate via Slack?

jinzhen-lin pushed a commit to jinzhen-lin/vllm that referenced this pull request Aug 9, 2025
…ect#20246)

Signed-off-by: KuntaiDu <kuntai@uchicago.edu>
Signed-off-by: Jinzhen Lin <linjinzhen@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation ready ONLY add when PR is ready to merge/full CI is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants