Skip to content

🧗 Add Ascend NPU support for vLLM server #3286

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

Merged
merged 2 commits into from
Apr 15, 2025

Conversation

ji-huazhong
Copy link
Contributor

@ji-huazhong ji-huazhong commented Apr 12, 2025

What does this PR do?

closes #3211

Note: This PR needs to be used with the main branch of vllm and vllm-ascend to work properly

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a GitHub issue? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

cc @qgallouedec

@ji-huazhong ji-huazhong marked this pull request as draft April 12, 2025 07:20
@ji-huazhong ji-huazhong marked this pull request as ready for review April 12, 2025 09:31
@@ -114,7 +124,7 @@ def update_named_param(self, name: str, dtype: torch.dtype, shape: Sequence[int]
weight = torch.empty(shape, dtype=dtype, device=self.device)

# Use NCCL to broadcast the updated weights from the client (src) to all workers.
self.pynccl_comm.broadcast(weight, src=self.client_rank, stream=torch.cuda.current_stream())
Copy link
Contributor Author

@ji-huazhong ji-huazhong Apr 12, 2025

Choose a reason for hiding this comment

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

We don't need to explicitly pass the stream to pynccl_comm, as pynccl_comm will get the current stream internally
https://github.com/vllm-project/vllm/blob/68bb122eb458a42169dd9d1772a7b32b84b2be95/vllm/distributed/device_communicators/pynccl.py#L207

@@ -212,7 +215,7 @@ def init_communicator(self):

# Set up the communication group for weight broadcasting
pg = StatelessProcessGroup.create(host=self.host, port=self.group_port, rank=self.rank, world_size=world_size)
self.pynccl_comm = PyNcclCommunicator(pg, device="cuda:0")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here we remove the hardcoded "cuda" to support third-party accelerators

Copy link
Member

@qgallouedec qgallouedec left a comment

Choose a reason for hiding this comment

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

LGTM! I'm just running a few tests to ensure there is no regression with CUDA and we are good to merge

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@qgallouedec
Copy link
Member

For the record: I can't test for Ascend NPU, but this PR introduces no regression for cuda

@qgallouedec qgallouedec changed the title Add Ascend NPU support for vLLM server 🧗 Add Ascend NPU support for vLLM server Apr 15, 2025
@qgallouedec qgallouedec merged commit 27adc30 into huggingface:main Apr 15, 2025
9 checks passed
shirinyamani pushed a commit that referenced this pull request Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants