-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
[BugFix] pp cannot run successfully under NixlConnector #22976
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
base: main
Are you sure you want to change the base?
Conversation
👋 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 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 🚀 |
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.
Code Review
This pull request aims to fix an issue where Pipeline Parallelism (PP) could not run successfully with the NixlConnector. The core of the change is to use the device ID from torch.cuda.current_device()
instead of the tensor parallelism rank (tp_rank
) to uniquely identify workers. This correctly resolves device and port conflicts for workers within a single instance when using PP. However, this change introduces a critical issue for cross-instance communication. The client-side handshake logic for connecting to a remote producer instance has not been updated and still relies on the tp_rank
to determine the port, creating a mismatch that will lead to connection failures when the producer uses pipeline parallelism. This side effect needs to be addressed.
03f4998
to
945bf70
Compare
/gemini review |
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.
Code Review
This pull request aims to fix an issue where Pipeline Parallelism (PP) fails with NixlConnector. The core of the fix is to use the correct device ID (torch.cuda.current_device()
) instead of the tensor parallel rank for NIXL memory registration, which correctly resolves device conflicts in a PP setup. Additionally, the side-channel port calculation for worker processes is updated to include the pipeline parallel rank, ensuring unique listening ports for each worker and preventing port collisions. While these changes are necessary for PP support, the update to the worker's listening port is not reflected in the scheduler's logic, which will cause connection failures in Prefill-Decode disaggregation scenarios. This is a critical issue that needs to be addressed.
/gemini review |
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.
Code Review
This pull request provides a crucial bugfix for running Pipeline Parallelism (PP) with the NixlConnector. The core issue, as you've correctly identified, was the use of the tensor parallelism (TP) rank as a device identifier for NIXL memory registration, which is not unique across different pipeline stages. Your solution to use torch.cuda.current_device()
to get the actual device ID is the correct approach to resolve this conflict. Furthermore, you've updated the side-channel port calculation to properly account for data, tensor, and pipeline parallelism, ensuring each worker gets a unique port. The addition of the get_pipeline_model_parallel_rank
helper function is a clean way to support this. The changes are well-targeted and appear to correctly solve the reported problem. I found no issues of high or critical severity in this pull request.
…Connector Signed-off-by: R2-Y <[email protected]>
@WoosukKwon @robertgshaw2-redhat @lk-chen Hi could you help to review? |
You may want to add some basic tests in and cc @NickLucche |
[BugFix] pp cannot run successfully under NixlConnector
Purpose
I previously raised issue #22430 regarding NixlConnector failing with Pipeline Parallelism (PP) + Prefill-Decode (PD) configurations, but it hasn't received attention from the community yet. Since I need PP functionality for my project and my benchmarks show that NixlConnector delivers significantly better performance than LMCacheConnector, I'm motivated to contribute a fix.
My testing on Qwen 2.5 7B demonstrates NixlConnector's clear advantage:
The error occurs during KV cache initialization when


nixl_wrapper.register_memory()
is called in a Pipeline Parallelism setup. After investigating the codebase, I discovered that the current implementation only considers Tensor Parallelism (TP) when initializing KV caches.When registering cache data with NIXL, different PP stages that share the same TP rank are assigned to the same device ID. This causes device conflicts during PP memory registration, leading to the
NIXL_ERR_BACKEND
failure. Therefore, I modified the device ID assignment from using TP rank to automatically detecting the current device usingtorch.cuda.current_device()
.Test Plan
Tested by running the model under PP + NixlConnector for both PD disaggregation and PD aggregation scenarios.
Test Result
The error no longer occurs.
(Optional) Documentation Update
Essential Elements of an Effective PR Description Checklist
supported_models.md
andexamples
for a new model.