Skip to content

[Hardware][AMD][Kernel] mori all2all backend integration#26013

Closed
whitememory wants to merge 47 commits into
vllm-project:mainfrom
moreh-dev:mori_moreh
Closed

[Hardware][AMD][Kernel] mori all2all backend integration#26013
whitememory wants to merge 47 commits into
vllm-project:mainfrom
moreh-dev:mori_moreh

Conversation

@whitememory

@whitememory whitememory commented Oct 1, 2025

Copy link
Copy Markdown

Purpose

This PR is to integrate mori(https://github.com/ROCm/mori) kernel as all2all backend of vLLM to boost up EP performance at rocm. This is a work by a team from Moreh Inc.
Note that only low latency mode is available on mori. (internal static buffer size)
to activate mori -> install mori using from https://github.com/ROCm/mori and add export VLLM_ALL2ALL_BACKEND="mori" at server booting script

Test Plan

server

#!/bin/bash
export VLLM_ROCM_USE_AITER=1
export VLLM_RANDOMIZE_DP_DUMMY_INPUTS=1
export VLLM_ALL2ALL_BACKEND="mori"
export VLLM_MOE_DP_CHUNK_SIZE=1024
vllm serve "/app/model/DeepSeek-R1"
--served-model-name "deepseek-ai/DeepSeek-R1"
--port 8001
--trust-remote-code
--tensor-parallel-size 1
--data_parallel_size 8
--no-enable-prefix-caching
--enable-expert-parallel
--max-model-len 8192
--max-num-seqs 2048
--max_num_batched_token 32768
--gpu-memory-utilization 0.92
--block-size 1 --enforce-eager

curl test

curl http://localhost:8001/v1/chat/completions -H "Content-Type:
application/json" -d '{
"model": "deepseek-ai/DeepSeek-R1",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Who won the world series in 2020?"}
],
"max_tokens": 200
}'

benchmark script

#!/bin/bash
model_name="deepseek-ai/DeepSeek-R1"
CON=2000

curl -X POST http://localhost:8001/reset_prefix_cache
date
vllm bench serve
--backend vllm
--model $model_name
--metric-percentiles "25,50,75"
--percentile-metrics "itl,tps,ttft,e2el"
--port 8001
--num-prompts $CON
--max-concurrency $CON
--ignore-eos
--dataset-name random
--random-input-len 2000
--random-output-len 100

Test Result

  1. Introduction
    Since mori supports only low-latency, mori backend must use chunked forward (repeated moe)
Prefill performance can be worse than a2a backends which do not use chunked forward. (We set VLLM_MOE_DP_CHUNK_SIZE=1024, but test ISL was 2000 per each request)
    Thus, performance is measured using ITL metric.
    Cuda graph capture seems to have a problem at main 1405f0c, so we gave --enforce-eager to server argument.

  2. Performance result

mori

---------------Inter-token Latency----------------
Mean ITL (ms): 1146.22
Median ITL (ms): 189.88
P25 ITL (ms): 175.00
P50 ITL (ms): 189.88
P75 ITL (ms): 199.09

default(allgather_reducescatter)

---------------Inter-token Latency----------------
Mean ITL (ms): 1087.56
Median ITL (ms): 193.03
P25 ITL (ms): 175.06
P50 ITL (ms): 193.03
P75 ITL (ms): 203.93

naive

---------------Inter-token Latency----------------
Mean ITL (ms): 1198.89
Median ITL (ms): 259.74
P25 ITL (ms): 244.77
P50 ITL (ms): 259.74
P75 ITL (ms): 274.06

  1. Environment

test machine : mi300x
test model : DeepSeek-R1
base docker image : rocm/vllm-dev:official_0909_rc3_20250906
mori version : main 0a6f908
vllm version : 0.11.0rc1 and main 1405f0c

  1. Etc tests
    4-1. test at 0.11.0rc1
    curl test passed at all a2a backends tested on rocm. (naive, allgather_reducescatter, mori)
    cuda graph capture passed at all a2a backends tested on rocm. (allgather_reducescatter, mori) - naive backend is supposed to fail
    with this fix from mori cuda graph replay is also fine.
    4-2. test at main 1405f0c -> main at commit 1405f0c seems to have problem.
    curl test DID NOT PASS using all a2a backends tested on rocm. (naive, allgather_reducescatter, mori)
    cuda graph capture DID NOT PASS using all a2a backends tested on rocm. (naive, allgather_reducescatter, mori) - naive backend is supposed to fail
    4-2-1.
    Result of curl test seems like, at main 1405f0c, server responded to “You are a helpful assistant.” not "Who won the world series in 2020?”.
    server at 0.11.0rc1 responded to "Who won the world series in 2020?” correctly.

  2. Future works
    5-1. Even at 0.11.0rc1, cuda graph replay seems to have a problem. cuda graph capture is done, but it hangs at replay. We will investigate on this.
    5-2 integrate mori with DBO
    5-3. when mori HT mode releases, apply the mode to enhance prefill performance


Essential Elements of an Effective PR Description Checklist
  • [O] The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • [O] The test plan, such as providing test command.
  • [O] 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.
  • (Optional) Release notes update. If your change is user facing, please update the release notes draft in the Google Doc.

@github-actions

github-actions Bot commented Oct 1, 2025

Copy link
Copy Markdown

👋 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 ask your reviewers to trigger select CI tests on top of fastcheck CI.

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.

If you have any questions, please reach out to us on Slack at https://slack.vllm.ai.

🚀

@mergify mergify Bot added the rocm Related to AMD ROCm label Oct 1, 2025

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

Copy link
Copy Markdown
Contributor

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 integrates the mori all2all backend to enhance performance on ROCm platforms. The changes are extensive, touching communication, model execution layers, and configuration. My review focuses on the correctness and robustness of the new integration. I've identified a few critical issues related to state management, incorrect caching, and potential runtime errors that should be addressed to ensure the stability and correctness of this new feature.

Comment thread vllm/distributed/device_communicators/all2all.py Outdated
Comment thread vllm/model_executor/layers/fused_moe/modular_kernel.py Outdated
Comment thread vllm/distributed/device_communicators/all2all.py Outdated
Comment thread vllm/model_executor/layers/fused_moe/aiter_experts.py Outdated
@whitememory whitememory changed the title vllm mori integration [Hardware][AMD} mori integration Oct 1, 2025
@whitememory whitememory changed the title [Hardware][AMD} mori integration [Hardware][AMD] mori integration Oct 1, 2025
@whitememory whitememory changed the title [Hardware][AMD] mori integration [Hardware][AMD] mori all2all backend integration Oct 1, 2025
@whitememory

Copy link
Copy Markdown
Author

At my environment, the pre-commit hanged...

I will apply pre-commit result, and respond to any reviews or code-assists tomorrow.

HakJu Kim and others added 5 commits October 2, 2025 11:25
Note that only low latency mode is available on mori (https://github.com/ROCm/mori)

Co-authored-by: Inhyeok Bang <inhyeok.bang@moreh.io>
Co-authored-by: Dongmin Ra <dongmin.ra@moreh.io>
Co-authored-by: Jimin Park <jimin.park@moreh.io>
Co-authored-by: Geonwoo Choi <geonwoo.choi@moreh.io>
Signed-off-by: HakJu Kim <hakju.kim@moreh.io>
caused by version difference

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: HakJu Kim <niveusmemoria@gmail.com>
Signed-off-by: HakJu Kim <hakju.kim@moreh.io>
accepted suggestion

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: HakJu Kim <niveusmemoria@gmail.com>
Signed-off-by: HakJu Kim <hakju.kim@moreh.io>
Signed-off-by: HakJu Kim <hakju.kim@moreh.io>
Signed-off-by: HakJu Kim <hakju.kim@moreh.io>
HakJu Kim added 3 commits October 2, 2025 11:41
Signed-off-by: HakJu Kim <hakju.kim@moreh.io>
Signed-off-by: HakJu Kim <hakju.kim@moreh.io>
Signed-off-by: HakJu Kim <hakju.kim@moreh.io>
@whitememory whitememory changed the title [Hardware][AMD] mori all2all backend integration [Hardware][AMD][Kernel] mori all2all backend integration Oct 2, 2025
whitememory and others added 2 commits October 15, 2025 09:19
this happened because of code conflict(semantically)

Signed-off-by: HakJu Kim <hakju.kim@moreh.io>
@whitememory

whitememory commented Oct 15, 2025

Copy link
Copy Markdown
Author

NOTE : we made a progress in cuda graph problem. (capture ok, but replay hang)
-> if some rank runs cuda graph, and other ranks do not run cuda graph (like dummy run in some versions of vllm). mori hangs (mori depends on a cpu variable, which is updated in eager mode, but not updated in cuda graph mode)
We believe it is mori's bug which can occur at some versions of vllm.
We will test more and my colleague will register PR to mori repo.
-> we found similar fix at mori branch, and it's merged. we are "fixing that fix" in this PR.

Test Result is updated.

@mergify

mergify Bot commented Oct 17, 2025

Copy link
Copy Markdown
Contributor

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

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 Oct 17, 2025
Signed-off-by: ihbang <bih3754@gmail.com>
@ihbang

ihbang commented Oct 20, 2025

Copy link
Copy Markdown

I added "json_config" to EpDispatchCombineConfig and dispatch/combine methods of EpDispatchCombineOp to change its configs easily.
You can manage warp_num_per_block and block_num values with json file like below.
(VLLM_MORI_CONFIG_PATH should be set to the path of your json file)

{
  "global": {
    "warp_num_per_block": 8,
    "block_num": 80
  },
  "dispatch": {
    "warp_num_per_block": 16,
    "block_num": 80
  }
}

Signed-off-by: ihbang <bih3754@gmail.com>
Signed-off-by: ihbang <bih3754@gmail.com>
@whitememory whitememory requested a review from HAIAI October 21, 2025 08:58
@HAIAI

HAIAI commented Oct 24, 2025

Copy link
Copy Markdown
Collaborator

@whitememory may you fix the conflict? Thanks.

Signed-off-by: HakJu Kim <niveusmemoria@gmail.com>
HakJu Kim added 2 commits October 27, 2025 11:12
Signed-off-by: HakJu Kim <hakju.kim@moreh.io>
Signed-off-by: HakJu Kim <hakju.kim@moreh.io>
@whitememory

Copy link
Copy Markdown
Author

@whitememory may you fix the conflict? Thanks.

@HAIAI
we fixed the conflict, thank you

@whitememory

Copy link
Copy Markdown
Author

@HAIAI
Is it possible to continue reviewing before more conflicts come in?

@mergify

mergify Bot commented Nov 11, 2025

Copy link
Copy Markdown
Contributor

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

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 Nov 11, 2025
@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had any activity within 90 days. It will be automatically closed if no further activity occurs within 30 days. Leave a comment if you feel this pull request should remain open. Thank you!

@github-actions github-actions Bot added the stale Over 90 days of inactivity label Feb 10, 2026
@github-project-automation github-project-automation Bot moved this to Todo in AMD Feb 10, 2026
@github-actions

Copy link
Copy Markdown

This pull request has been automatically closed due to inactivity. Please feel free to reopen if you intend to continue working on it. Thank you!

@github-actions github-actions Bot closed this Mar 13, 2026
@github-project-automation github-project-automation Bot moved this to Done in NVIDIA Mar 13, 2026
@github-project-automation github-project-automation Bot moved this from Todo to Done in AMD Mar 13, 2026
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 needs-rebase nvidia rocm Related to AMD ROCm stale Over 90 days of inactivity

Projects

Status: Done
Status: Done

Development

Successfully merging this pull request may close these issues.

7 participants