Repository navigation
[Fix] [Intel] dp-attention: Skip the CustomAllReduceV2 import on XPU - #46417
Merged
mingfeima merged 2 commits intoOct 26, 2026
Merged
Conversation
sgl-project#46138 added a module-level CustomAllReduceV2 import to dp_attention.py. custom_all_reduce_v2 pulls in kernels/ops/communication/all_reduce.py, which does "import tvm_ffi". tvm_ffi is not installed in the XPU image, so importing sglang now fails on XPU, e.g. the diffusion test runner: ModuleNotFoundError: No module named 'tvm_ffi' On XPU only, skip the import and bind CustomAllReduceV2 to an empty tuple, so the isinstance check in _decode_sum_len_fits_custom_all_reduce returns False (XPU never uses the v2 custom all-reduce). Other platforms keep the module-level import unchanged.
arathi-hlab
requested review from
BBuf,
Edwardf0t1,
Fridge003,
HaiShaw,
Ying1123,
ch-wan,
ispobock and
merrymercy
as code owners
October 25, 2026 09:26
mingfeima
approved these changes
Oct 26, 2026
2 of 5 tasks
This was referenced Oct 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
#46138 added a module-level
from sglang.srt.distributed.device_communicators.custom_all_reduce_v2 import CustomAllReduceV2todp_attention.py.custom_all_reduce_v2importssglang/kernels/ops/communication/all_reduce.py, which doesimport tvm_ffiat module level.tvm_ffiis not installed in the XPU image (intel/sglang-dev:latest), anddp_attention.pyis imported almost everywhere, so importing sglang on XPU now fails. For example, the XPU diffusion job dies before running any test:https://github.com/sgl-project/sglang/actions/runs/40179531469/job/121127481365
Modifications
On XPU only, skip the import and bind
CustomAllReduceV2 = (). The class's only use isisinstance(comm, CustomAllReduceV2)in_decode_sum_len_fits_custom_all_reduce, andisinstance(x, ())is alwaysFalse. That is correct on XPU, which cannot create a v2 custom all-reduce.Checklist
CI States
Latest PR Test (Base): ✅ Run #40180912773
Latest PR Test (Extra): ❌ Run #40180912700
Latest PR Test (AMD ROCm 10): ❌ Run #40180912717