Skip to content

Integrate quick allreduce and select the best allreduce implementation #18473

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

lihaoyang-amd
Copy link

@lihaoyang-amd lihaoyang-amd commented May 21, 2025

  1. With its low-granularity quantization, https://github.com/mk1-project/quickreduce brings huge performance gains to allreduce on tp2 and tp4 on rocm, and does not significantly degrade the model's performance.
  2. We integrated quick allreduce into vllm to support 1stage(f16 ), and 2stage(f16, fp8, Q8, Q6, Q4).
  3. It is worth mentioning that the speedup of qr is brought about by sacrificing a certain amount of precision, and custom_qr is significantly better than qr's 1stage and 2stage methods at low data volumes (less than 128kb), so we need to judge whether to choose qr or cr or rccl by some conditions.

@mergify mergify bot added documentation Improvements or additions to documentation ci/build frontend v1 labels May 21, 2025
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.

🚀

@lihaoyang-amd
Copy link
Author

lihaoyang-amd commented May 21, 2025

tp2
custom when 4k-128k
qr2stagef16 when 256k-512k
qr+quant when 1MB-64MB

<style> </style>
kenrel   vllm qr qr qr qr qr
time(us)   custom allreduce 1stage 2stage f16 2stage f8 2stage Q6 2stage Q4
tp2 4k 9.7 15 15.42 25.79 34.98 27.59
  8k 11.25 16.98 15.87 27.07 35.91 29.32
  16k 12.3 14.48 18.98 28.06 31.31 28.67
  32k 13.27 18.3 16.4 26.9 33.46 28.37
  64k 9.6 20.97 18.03 25.33 31.38 42.63
  128k 13.44 15.77 18.17 27.24 36.72 30.7
  256k 38.84 19.39 18.86 30.02 32.33 30.96
  512k 30.6 25.64 24.46 33.3 32.05 29.04
  1M 33.46 36.05 39.58 35.57 37.65 36.32
  2M 57.96 60.01 62.22 66.15 47.17 44.97
  4M 108.15 106.8 105.33 75.19 66.4 55.14
  8M 204.3 195.46 199 134.91 113.08 90.14
  16M 394.06 369.52 371.06 241.09 203.82 154.48
  32M 781.73 732.85 735.03 446.94 367.06 290.67
  64M 1552.63 1443.03 1447.09 833.53 674.4 529.25

I'll add tp4, tp8 and e2e experimental data later, and cleaning up.

@lihaoyang-amd lihaoyang-amd marked this pull request as ready for review May 21, 2025 10:41
@lihaoyang-amd lihaoyang-amd changed the title add quick allreduce for vllm Integrate quick allreduce and select the best allreduce implementation May 21, 2025
@lihaoyang-amd lihaoyang-amd force-pushed the amd/add_quick_allreduce branch from 5a6a5a8 to e272658 Compare May 21, 2025 12:22
@youkaichao
Copy link
Member

what's the relationship between this and #16804 ?

@lihaoyang-amd
Copy link
Author

what's the relationship between this and #16804 ?

Aha, maybe we are competitive. I am from amd. We recently spent some time trying to integrate qr into vllm (because qr is very suitable for rocm)

Integrating qr makes the two pr have many similarities, but it seems that the pr you mentioned #16804 only supports Q8 and Q 4. There are no obvious boundary conditions, quantization seems to have some problems, and lack of experimental data.

Maybe we can work together to finish the work.

@lihaoyang-amd lihaoyang-amd force-pushed the amd/add_quick_allreduce branch 2 times, most recently from 08caa03 to 0989304 Compare May 22, 2025 16:40
Copy link

mergify bot commented May 22, 2025

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @lihaoyang-amd.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify bot added the needs-rebase label May 22, 2025
Signed-off-by: Haoyang Li <[email protected]>
Signed-off-by: Haoyang Li <[email protected]>
Signed-off-by: Haoyang Li <[email protected]>
Signed-off-by: Haoyang Li <[email protected]>
@lihaoyang-amd lihaoyang-amd force-pushed the amd/add_quick_allreduce branch from 0989304 to 84b2ca1 Compare May 23, 2025 07:17
@mergify mergify bot removed the needs-rebase label May 23, 2025
Signed-off-by: Haoyang Li <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci/build documentation Improvements or additions to documentation frontend v1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants