Repository navigation
[XPU] Use SYCL kernels for DeepSeek V4 MHC on XPU - #32166
Merged
Merged
Conversation
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
Signed-off-by: Cui, Lily <lily.cui@intel.com>
Signed-off-by: Cui, Lily <lily.cui@intel.com>
cyxlily
requested review from
BBuf,
DarkSharpness,
HydraQYH,
celve and
yuan-luo
as code owners
July 31, 2026 03:31
Signed-off-by: Cui, Lily <lily.cui@intel.com>
Signed-off-by: Cui, Lily <lily.cui@intel.com>
Signed-off-by: Cui, Lily <lily.cui@intel.com>
Contributor
Author
|
/tag-run-ci-label |
Contributor
Author
|
/tag-and-rerun-ci extra |
Contributor
Author
|
/tag-and-rerun-ci |
Contributor
Author
|
/rerun-failed-ci |
polisettyvarma
suggested changes
Aug 13, 2026
Contributor
|
@cyxlily please add intel and xpu labels also if you have permission |
Signed-off-by: Cui, Lily <lily.cui@intel.com>
mingfeima
reviewed
Aug 17, 2026
mingfeima
requested changes
Aug 20, 2026
mingfeima
left a comment
Collaborator
There was a problem hiding this comment.
Don’t try/except + fall back to TileLang mhc_pre in python/sglang/kernels/ops/layernorm/mhc.py. That file is CUDA/TileLang-only.
Keep XPU dispatch in deepseek_v4.py: lazy-import from sgl_kernel inside _get_mhc_ops() / if _is_xpu: (same as hc_pre today) and fail if the op is missing.
Leave _prewarm_mhc_kernels returning early on XPU — no XPU prewarm in mhc.py.
mingfeima
requested changes
Aug 20, 2026
mingfeima
requested changes
Aug 20, 2026
mingfeima
reviewed
Aug 20, 2026
Signed-off-by: Cui, Lily <lily.cui@intel.com>
Signed-off-by: Cui, Lily <lily.cui@intel.com>
Signed-off-by: Cui, Lily <lily.cui@intel.com>
Signed-off-by: Cui, Lily <lily.cui@intel.com>
mingfeima
approved these changes
Aug 24, 2026
mingfeima
left a comment
Collaborator
There was a problem hiding this comment.
LGTM. some minors to fix.
Signed-off-by: Cui, Lily <lily.cui@intel.com>
Signed-off-by: Cui, Lily <lily.cui@intel.com>
Signed-off-by: Cui, Lily <lily.cui@intel.com>
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
Enable XPU-specific optimized kernels for the DeepSeek V4 MHC (Multi-Head Compression) path on Intel XPU hardware. The existing CUDA-path kernels (deep_gemm, CUDA-first device selection) are either unavailable or suboptimal on XPU, causing incorrect device dispatch or missing performance opportunities.
Modifications
deepseek_v4.py: On XPU, dispatch hc_head to sgl_kernel.mhc.fused_hc_head (SYCL kernel) instead of the Triton implementation; dispatch mhc_fused_post_pre to the XPU-specific kernel; fix device selection to avoid falling back to CUDA when XPU is available.
Accuracy Tests
Verified the accuracy of MHC kernels in sgl-kernel-xpu:
hc_head:
sgl-project/sgl-kernel-xpu#345
mhc_fused_post_pre:
sgl-project/sgl-kernel-xpu#302
All configurations pass accuracy tests.
Speed Tests and Profiling
Benchmarked fused_hc_head SYCL kernel vs Triton on Intel XPU (BMG), hc_mult=4, dtype=bfloat16 (median latency, 50 iterations):
Speedup (triton / sycl)
CI States
Latest PR Test (Base): ❌ Run #32685541373
Latest PR Test (Extra): ❌ Run #32685541183
Latest PR Test (AMD ROCm 7.2): ❌ Run #32685541334