Skip to content

Add interleave mode for split qkv norm rope#503

Merged
iforgetmyname merged 2 commits into
sgl-project:mainfrom
McZyWu:split-norm-rope-interleave
May 27, 2026
Merged

Add interleave mode for split qkv norm rope#503
iforgetmyname merged 2 commits into
sgl-project:mainfrom
McZyWu:split-norm-rope-interleave

Conversation

@McZyWu

@McZyWu McZyWu commented May 19, 2026

Copy link
Copy Markdown
Contributor

As mrope support rotary mode interleaved, which use interleaved data to compute x, https://www.hiascend.com/document/detail/zh/Pytorch/2600/apiref/torchnpuCustomsapi/docs/zh/custom_APIs/torch_npu/torch_npu-npu_mrope.md, this pr was proposed to align with different scenes of mrope, interleaved and half.

@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 introduces support for interleaved Rotary Positional Embeddings (RoPE) alongside the existing Neox-style implementation by adding an is_neox_style parameter and adjusting slicing and insertion logic with strides. The review feedback highlights several improvement opportunities: specifically, the use of hardcoded bfloat16 for intermediate tensors should be replaced with the input's native dtype to maintain precision, the duplicated logic between Query and Key blocks should be refactored to improve maintainability, and the new functionality should be extended to the Gemma-style kernel for consistency.

Comment thread python/sgl_kernel_npu/sgl_kernel_npu/norm/split_qkv_rmsnorm_rope.py Outdated
Comment thread python/sgl_kernel_npu/sgl_kernel_npu/norm/split_qkv_rmsnorm_rope.py Outdated
Comment thread python/sgl_kernel_npu/sgl_kernel_npu/norm/split_qkv_rmsnorm_rope.py
Comment thread python/sgl_kernel_npu/sgl_kernel_npu/norm/split_qkv_rmsnorm_rope.py
@iforgetmyname iforgetmyname merged commit bc38689 into sgl-project:main May 27, 2026
10 of 13 checks passed
1329009851 added a commit to 1329009851/sgl-kernel-npu that referenced this pull request May 29, 2026
* 'main' of https://github.com/1329009851/sgl-kernel-npu:
  added new commands to README for DeepEP (sgl-project#514)
  feat: pto mega-gdn support dynamic num heads (sgl-project#517)
  [NPU][Feat] Add alltoall mode on deepep (sgl-project#508)
  support torch_memory_saver preload hook_mode (sgl-project#463)
  DeepEP: expand moe specifications (sgl-project#515)
  refactor: separate submodule init and build, remove cuda deps from CI (sgl-project#516)
  Add interleave mode for split qkv norm rope (sgl-project#503)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants