Skip to content

[XPU] Enable sequence parallel support for XPU - #38608

Merged
vllm-bot merged 6 commits into
vllm-project:mainfrom
chaojun-zhang:seq_parallel
Jun 15, 2026
Merged

vllm-bot merged 6 commits into
vllm-project:mainfrom
chaojun-zhang:seq_parallel

Conversation

@chaojun-zhang

@chaojun-zhang chaojun-zhang commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

Test Plan

Test Result

UT :
pytest -s -v tests/compile/correctness_e2e/test_sequence_parallel.py
pytest -s -v pytest -s -v tests/compile/correctness_e2e/test_sequence_parallel.py

Accuracy (GSM8K)

meta-llama/Llama-2-13b-chat-hf

Case Strict Flexible
Enable SP 0.360 0.364
Disable SP 0.372 0.376
Eager 0.368 0.372

Qwen/Qwen3-32B

Configuration Strict Flexible
Enable SP 0.740 0.652
Disable SP 0.752 0.644
Eager 0.764 0.648

Benchmark

meta-llama/Llama-2-13b-chat-hf

Case Mean TTFT (ms) Median TTFT (ms) P99 TTFT (ms) Mean TPOT (ms) Median TPOT (ms) P99 TPOT (ms) Output token throughput (tok/s)
Eager 2246.43 2024.30 2964.17 52.33 52.01 59.83 196.31
Disable SP 2238.68 (+0.34%) 2018.57 (+0.28%) 2951.89 (+0.41%) 52.80 (-0.90%) 51.57 (+0.85%) 64.85 (-8.39%) 181.18 (-7.71%)
Enable SP 2216.08 (+1.35%) 1998.83 (+1.26%) 2920.51 (+1.47%) 52.92 (-1.13%) 51.73 (+0.54%) 64.65 (-8.06%) 181.94 (-7.32%)

Qwen/Qwen3-32B

Case Mean TTFT (ms) Median TTFT (ms) P99 TTFT (ms) Mean TPOT (ms) Median TPOT (ms) P99 TPOT (ms) Output token throughput (tok/s)
Eager 6733.47 6860.12 10630.22 63.18 62.95 73.86 419.04
Disable SP 6675.10 (+0.87%) 6801.23 (+0.86%) 10533.09 (+0.91%) 63.12 (+0.09%) 62.88 (+0.11%) 73.69 (+0.23%) 420.04 (+0.24%)
Enable SP 6393.19 (+5.05%) 6511.97 (+5.07%) 10087.97 (+5.10%) 62.81 (+0.59%) 62.58 (+0.59%) 72.92 (+1.27%) 424.83 (+1.38%)

Summary

  • On meta-llama/Llama-2-13b-chat-hf, Enable SP gives the best TTFT, while Eager keeps the best throughput.
  • On Qwen/Qwen3-32B, Enable SP is the best case on TTFT, TPOT, and throughput.
  • Accuracy stays in the same range across these variants;

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.
  • (Optional) Release notes update. If your change is user facing, please update the release notes draft in the Google Doc.

@mergify mergify Bot added the intel-gpu Related to Intel GPU label Mar 31, 2026

@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 enables sequence parallelism tests on XPU platforms by updating pytest markers and generalizing device selection using current_platform.device_type and torch.accelerator. It also moves the SequenceParallelismPass import out of the CUDA-specific guard in the pass manager. Feedback indicates that moving this pass alone is insufficient, as RMSNormQuantFusionPass remains guarded but is required by the newly enabled XPU tests, which will likely result in a NameError.

Comment thread vllm/compilation/passes/pass_manager.py Outdated
@@ -23,13 +23,14 @@
RocmAiterTritonAddRMSNormPadFusionPass,
)

from .fusion.sequence_parallelism import SequenceParallelismPass

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.

high

Moving SequenceParallelismPass out of the is_cuda_alike() guard is necessary to support it on XPU. However, RMSNormQuantFusionPass (currently at line 32) remains inside the guard. Since the XPU tests added in this PR (tests/compile/passes/distributed/test_sequence_parallelism.py) explicitly enable fuse_norm_quant, the PostGradPassManager.configure() method will raise a NameError on XPU platforms when it attempts to instantiate RMSNormQuantFusionPass.

Additionally, AsyncTPPass (line 39) is guarded by is_cuda(), which will cause a similar NameError if fuse_gemm_comms is enabled on XPU. You should move RMSNormQuantFusionPass out of the guard as well, and ensure AsyncTPPass is handled safely for XPU.

@chaojun-zhang chaojun-zhang changed the title [Tests] Update sequence parallelism tests to support XPU [XPU] Enable sequence parallel support for XPU Mar 31, 2026
Comment thread vllm/compilation/passes/pass_manager.py Outdated
@mergify

mergify Bot commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

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

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 Mar 31, 2026
@yma11

yma11 commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

@chaojun-zhang Any latency difference w/ and w/o this feature enabled? and also the case with asyncTP enabled.

@chaojun-zhang
chaojun-zhang force-pushed the seq_parallel branch 2 times, most recently from 751f05a to e31dea0 Compare April 2, 2026 01:33
@mergify mergify Bot removed the needs-rebase label Apr 2, 2026
@chaojun-zhang

Copy link
Copy Markdown
Contributor Author

@chaojun-zhang Any latency difference w/ and w/o this feature enabled? and also the case with asyncTP enabled.

  • For latency please refer to Test Result in PR description.
  • We will have a separate draft PR for asyncTP

@chaojun-zhang
chaojun-zhang marked this pull request as ready for review April 2, 2026 02:16

@ProExpertProg ProExpertProg left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

2 nits

Comment thread tests/compile/passes/distributed/test_sequence_parallelism.py Outdated
Comment thread tests/compile/passes/distributed/test_sequence_parallelism.py Outdated
Comment thread vllm/compilation/passes/fusion/sequence_parallelism.py Outdated
Comment thread vllm/compilation/passes/pass_manager.py
Comment thread vllm/platforms/xpu.py Outdated
@@ -247,6 +247,10 @@ def is_data_center_gpu(cls) -> bool:
device_name = cls.get_device_name().lower()
return device_name.count("data center gpu") > 0

@classmethod
def use_custom_op_collectives(cls) -> bool:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I remember that all reduce op provided by xpu communicator is in place instead of out place, this may have accuracy issue or some other issue.

Comment thread tests/compile/passes/distributed/test_sequence_parallelism.py Outdated
Comment thread vllm/compilation/passes/pass_manager.py Outdated
@@ -111,7 +129,9 @@ def __init__(
self.tp_size = get_tensor_model_parallel_world_size()

def _all_reduce(self, x: torch.Tensor) -> torch.Tensor:
return tensor_model_parallel_all_reduce(x)
return torch.ops.vllm.all_reduce.default(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

is it safe to replace?

@chaojun-zhang chaojun-zhang Apr 9, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes. safe to use custom op for torch.compile mode , otherwise it will throw below error when xpu set use_custom_op_collectives to False.

NotImplementedError: c10d::allreduce_: attempted to run this operator with Meta tensors, but there was no fake impl or Meta kernel registered.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

my question may be :

  • will it break other platform/OOT device if it doesn't registere this but enabled this pass.
  • will it impact cuda graph capture behavior.

@chaojun-zhang chaojun-zhang Apr 26, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

  1. It won't break other platform. when enable SP pass, custom-op collectives must be use. To use the custom-op collective, either:
  • directly in the SP pass, or
  • indirectly by enabling use_custom_op_collectives(). (CUDA & ROCM follow this path)
  1. I have reverted code and enabling use_custom_op_collectives For XPU.

@mergify

mergify Bot commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

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

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

@mergify

mergify Bot commented May 6, 2026

Copy link
Copy Markdown
Contributor

Documentation preview: https://vllm--38608.org.readthedocs.build/en/38608/

@mergify mergify Bot added documentation Improvements or additions to documentation ci/build deepseek Related to DeepSeek models frontend multi-modality Related to multi-modality (#4194) mistral Related to Mistral models new-model Requests to new models performance Performance-related issues qwen Related to Qwen models gpt-oss Related to GPT-OSS models nvidia labels May 6, 2026
@mergify

mergify Bot commented May 6, 2026

Copy link
Copy Markdown
Contributor

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

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

@mergify

mergify Bot commented May 6, 2026

Copy link
Copy Markdown
Contributor

Hi @chaojun-zhang, the pre-commit checks have failed. Please run:

uv pip install pre-commit>=4.5.1
pre-commit install
pre-commit run --all-files

Then, commit the changes and push to your branch.

For future commits, pre-commit will run automatically on changed files before each commit.

Tip

Is mypy failing?
mypy is run differently in CI. If the failure is related to this check, please use the following command to run it locally:
# For mypy (substitute "3.10" with the failing version if needed)
pre-commit run --hook-stage manual mypy-3.10

1 similar comment
@mergify

mergify Bot commented May 6, 2026

Copy link
Copy Markdown
Contributor

Hi @chaojun-zhang, the pre-commit checks have failed. Please run:

uv pip install pre-commit>=4.5.1
pre-commit install
pre-commit run --all-files

Then, commit the changes and push to your branch.

For future commits, pre-commit will run automatically on changed files before each commit.

Tip

Is mypy failing?
mypy is run differently in CI. If the failure is related to this check, please use the following command to run it locally:
# For mypy (substitute "3.10" with the failing version if needed)
pre-commit run --hook-stage manual mypy-3.10

Signed-off-by: chaojun-zhang <chaojun.zhang@intel.com>
Signed-off-by: Chaojun Zhang <chaojun.zhang@intel.com>
Signed-off-by: Chaojun,Zhang <chaojun.zhang@intel.com>
Signed-off-by: Chaojun Zhang <chaojun.zhang@intel.com>
- Fix mock_cuda_platform: is_xpu.return_value was set to 'not is_cuda',
  so mock_cuda_platform(is_cuda=False) accidentally triggered the XPU
  branch in get_sequence_parallelism_threshold. Set is_xpu=False always.
- Add mock_xpu_platform fixture for XPU platform mocking.
- Add TestGetSequenceParallelismThresholdXPU test class covering:
  - XPU small hidden_size returns None
  - XPU large model returns calculated threshold
  - XPU threshold calculation with various parameters
  - XPU hidden_size boundary behavior

Signed-off-by: Chaojun Zhang <chaojun.zhang@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/build cpu Related to CPU backends deepseek Related to DeepSeek models documentation Improvements or additions to documentation frontend gpt-oss Related to GPT-OSS models intel-gpu Related to Intel GPU kv-connector mistral Related to Mistral models multi-modality Related to multi-modality (#4194) new-model Requests to new models nvidia performance Performance-related issues qwen Related to Qwen models ready ONLY add when PR is ready to merge/full CI is needed rocm Related to AMD ROCm speculative-decoding structured-output v1

Projects

Status: Done
Status: Done
Status: Done
Status: Done
Status: Done

Development

Successfully merging this pull request may close these issues.

6 participants