[Kernel] Classification cleanup: unify _jit_ naming, drop empty/model groups, add elementwise (RFC #29630) - #32148
Merged
Conversation
… groups, add elementwise (RFC sgl-project#29630) Post-migration review follow-up: - **Unify JIT-op naming**: drop the leftover `_jit_` prefix (a batch-1 shim-era artifact) from 8 modules so JIT-backed ops are named consistently with the rest (flash_attention.py, rope.py, ...): activation, layernorm/norm, gemm/dsv3_{fused_a,router}_gemm, kvcache/set_mla_kv_buffer, quantization/per_{tensor_quant_fp8,token_group_quant,token_group_quant_8bit_v2}. - **Delete the empty `spatial` group** (declared in _GROUPS with zero ops). - **Remove the `model` group**: redistribute inkling kernels by function — communication (all_reduce, ar_fused, ar_scattered_sconv), attention (attn_prologue, rel_proj, row_scale), moe (gate_topk_renorm). - **Add an `elementwise` group** for cross-cutting pointwise kernels: move attention/add_constant.py (generic JIT reference kernel, no prod use) and the mixed fused-pointwise collection layernorm/elementwise.py (softcap / sigmoid-mul / gated-act / fused-rmsnorm shared across models) into it. The two fused-rmsnorm variants stay `layernorm.*` ops (target repointed). - **Move hadamard** attention -> quantization (Hadamard transform is a quantization-rotation primitive). All refs rewritten (dotted + package-relative + stale comments). Validated: `import sglang.kernels.ops` stays metadata-only (CLEAN), 18 groups load, all 18 renamed/moved targets resolve via find_spec, py_compile + pre-commit clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
BBuf
requested review from
FlamingoPg,
ispobock,
merrymercy and
yizhang2077
as code owners
July 23, 2026 05:00
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
BBuf
requested review from
1am9trash,
AgainstEntropy,
Alisehen,
AniZpZ,
DarkSharpness,
Edwardf0t1,
Fridge003,
HaiShaw,
OrangeRedeng,
YAMY1234,
Ying1123,
b8zhong,
celve,
ch-wan,
fzyzcjy,
hubertlu-tw,
kkHuang-amd,
mickqian,
ping1jing2,
rainj-me,
yhyang201,
yichiche,
yingluosanqian and
yuan-luo
as code owners
July 23, 2026 05:00
…removal The hardcoded GROUPS canary in test_kernels_namespace.py still listed the now-deleted `spatial` group (and lacked the new `elementwise` group), so test_group_importable[spatial] failed with ModuleNotFoundError. Update the expected list: drop `spatial`, add `elementwise`. Verified locally: 16 passed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
xinguozhu-2026
pushed a commit
to xinguozhu-2026/sglang
that referenced
this pull request
Jul 23, 2026
… groups, add elementwise (RFC sgl-project#29630) (sgl-project#32148) Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Zhylkaaa
pushed a commit
to Zhylkaaa/sglang
that referenced
this pull request
Jul 29, 2026
… groups, add elementwise (RFC sgl-project#29630) (sgl-project#32148) Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
jinzhenfan
pushed a commit
to jinzhenfan/sglang
that referenced
this pull request
Jul 29, 2026
… groups, add elementwise (RFC sgl-project#29630) (sgl-project#32148) Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
jakki-amd
pushed a commit
to jakki-amd/sglang
that referenced
this pull request
Sep 9, 2026
… groups, add elementwise (RFC sgl-project#29630) (sgl-project#32148) Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Atituiset
pushed a commit
to Atituiset/sglang
that referenced
this pull request
Sep 10, 2026
… groups, add elementwise (RFC sgl-project#29630) (sgl-project#32148) Co-authored-by: Claude Opus 4.8 <noreply@anthropic.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.
Summary
Post-migration review follow-up on
python/sglang/kernels/— tightens classification and naming consistency. Almost entirelygit mvrenames + import rewrites.Changes
_jit_prefix (a batch-1 shim-era artifact) from 8 modules so JIT-backed ops read consistently with the rest (flash_attention.py,rope.py, …):activation/activation,layernorm/norm,gemm/dsv3_{fused_a,router}_gemm,kvcache/set_mla_kv_buffer,quantization/per_{tensor_quant_fp8,token_group_quant,token_group_quant_8bit_v2}.spatialgroup — it was declared in_GROUPSwith zero operators.modelgroup — redistribute the inkling kernels by function:communication(all_reduce, ar_fused, ar_scattered_sconv),attention(attn_prologue, rel_proj, row_scale),moe(gate_topk_renorm).elementwisegroup for cross-cutting pointwise kernels — moveattention/add_constant.py(the generic JIT reference kernel the dev guide walks through; no production caller) and the mixed fused-pointwise collectionlayernorm/elementwise.py(softcap / sigmoid-mul / gated-activation / fused-rmsnorm shared across grok/qwen) into it. The two fused-rmsnorm variants staylayernorm.*ops (registrationtargetrepointed to the new module; op ids unchanged).hadamardattention → quantization (the Hadamard transform is a quantization-rotation primitive).opsgroups: 19 → 18 (−spatial, −model, +elementwise).Validation
import sglang.kernels.opsstays metadata-only (CLEAN — nosgl_kernel/sglang.kernels.jit); all 18 groups load.find_spec.py_compile+pre-commit(isort/ruff/black + registry-validation + no-registered-tests-in-package) clean.Follow-up to #32072 / #32128.
CI States
Latest PR Test (Base): ⏳ Run #29981512360
Latest PR Test (Extra): ⏳ Run #29981512306