Skip to content

[Kernel] Reclassify kernel tests by ops group + move helpers out of the package (RFC #29630) - #32128

Merged
BBuf merged 6 commits into
sgl-project:mainfrom
BBuf:bbuf/kernels-tests-reclassify
Jul 23, 2026
Merged

BBuf merged 6 commits into
sgl-project:mainfrom
BBuf:bbuf/kernels-tests-reclassify

Conversation

@BBuf

@BBuf BBuf commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to RFC #29630. Organizes all kernel tests + benchmarks to mirror sglang.kernels.ops.<group>, keeps tests and benchmarks separate, and gets the last test files out of the sglang package.

Final layout

test/registered/kernels/
  ops/<group>/         # tests            (test_*.py)
  benchmark/<group>/   # benchmarks       (bench_*.py + data fixtures)
python/sglang/kernels/testing/   # shared test-support helpers (importable)

What changed

  • Reclassify by ops group — moved test/registered/jit/ (102) + test/registered/kernels/ (21) into test/registered/kernels/ops/<group>/ (tests) and test/registered/kernels/benchmark/<group>/ (benchmarks), classified by the operator each exercises, primarily by its sglang.kernels.ops.<group> imports. Tests and benchmarks are kept in separate trees.
  • Move test helpers out of the package — the awkward python/sglang/kernels/jit/tests/ folder → proper support package python/sglang/kernels/testing/ (utils.py, kv_canary/, deepseek_v4/); rewrote all sglang.kernels.jit.testssglang.kernels.testing imports.
  • Register 6 previously-orphaned testsminimax_m3_{mxfp8,rmsnorm}, sconv_{decode,extend}_metadata, moe_{preprocess,topk_sigmoid} had test functions but no CI registration (never ran). Added register_*_ci: CUDA → base-b-kernel-unit; ROCm-only minimax_m3jit-kernel-unit (amd).
  • Resolve a name collision — two test_sigmoid_gate_mul.py (base vs broadcast); broadcast one renamed test_sigmoid_gate_mul_broadcast.py.
  • Move the nvfp4 bench data fixture (diffusion_nvfp4_shapes.json) alongside its bench.
  • Repoint CI change-filterstest/registered/jit/**test/registered/kernels/** (covers ops/ tests + benchmark/ benches), diffusion bench filter → test/registered/kernels/benchmark/diffusion/**.

Why it's safe

Benchmarks and tests are both CI-registered and stay under test/registered/. CI discovery is a recursive glob over test/registered/** keyed on each file's register_*_ci(stage=...)path-independent — so nothing changes about which suite each test/benchmark runs in. (Registered files cannot live in the package: run_suite.py doesn't glob it, and the check-no-registered-tests-in-package hook forbids it.) python/sglang/ now has zero CI-registered tests.

Validated: validate registered test CI registries + reject CI-registered tests inside the sglang package hooks pass, sglang.kernels.testing imports, import sglang.kernels.ops stays metadata-only, pre-commit clean. Almost entirely git mv renames.


CI States

Latest PR Test (Base): ⏳ Run #29973449279
Latest PR Test (Extra): ⏳ Run #29977423820

…ernels/ops/ (RFC sgl-project#29630)

Follow-up to RFC sgl-project#29630: organize all kernel tests to mirror the
sglang.kernels.ops.<group> structure, and get the last test files out of the
sglang package.

- Move test/registered/jit/ (102) + test/registered/kernels/ (21) test &
  benchmark files into test/registered/kernels/ops/<group>/ (tests) and
  .../<group>/benchmark/ (benches), classified by the operator each exercises
  (attention/moe/layernorm/quantization/kvcache/gemm/diffusion/kv_canary/
  speculative/communication/mamba/activation/embeddings/model).
- Relocate shared test helpers out of the package's odd
  python/sglang/kernels/jit/tests/ folder into a proper support package
  python/sglang/kernels/testing/ (utils, kv_canary/, deepseek_v4/); rewrite all
  sglang.kernels.jit.tests imports -> sglang.kernels.testing.
- Register the 6 previously-orphaned in-package tests (minimax_m3 x2, sconv
  metadata x2, moe preprocess/topk_sigmoid) that were never run by CI: CUDA ones
  -> base-b-kernel-unit; ROCm-only minimax_m3 ones -> jit-kernel-unit (amd).
- Rename colliding test_sigmoid_gate_mul.py (broadcast variant) ->
  test_sigmoid_gate_mul_broadcast.py.

CI discovery is recursive over test/registered/** and keyed on register_*_ci
stage, so these moves don't change which suite each test runs in. python/sglang/
now has zero CI-registered tests. Validated: registry-validation +
no-registered-tests-in-package hooks pass, testing package imports, namespace
stays metadata-only, pre-commit clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@github-actions github-actions Bot added quant LLM Quantization amd lora deepseek hicache Hierarchical Caching for SGLang blackwell SM100/SM120 jit-kernel labels Jul 23, 2026
…-filters to kernels/ops

- Move test/registered/jit/benchmark/diffusion/diffusion_nvfp4_shapes.json (a
  non-.py data fixture the earlier .py-only move missed) into the nvfp4 bench's
  new dir; bench loads it via Path(__file__).parent / "...json".
- Repoint stale CI change-filters test/registered/jit/** ->
  test/registered/kernels/ops/** (and the diffusion-specific globs) in
  pr-test-amd, pr-test-amd-rocm720, _pr-test-check-changes, so editing a moved
  test/bench still triggers its suite. test/registered/jit/ now fully empty.

Benchmarks themselves keep running unchanged: run_suite.py discovers recursively
over test/registered/** keyed on register_*_ci (path-independent).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…hmark/<group>/

Per review: keep benchmarks out of the ops/ test dirs, but still classified by
group. Move test/registered/kernels/ops/<group>/benchmark/bench_*.py ->
test/registered/kernels/benchmark/<group>/ (57 benches + the nvfp4 shapes JSON
fixture). Tests stay in test/registered/kernels/ops/<group>/.

Benchmarks stay under test/registered/ (NOT the package): they are CI-registered
and run_suite.py only globs test/registered/**, plus the
check-no-registered-tests-in-package hook forbids register_*_ci inside the wheel.
So this is the closest layout to "benchmarks under a jit-style dir" that keeps
them runnable in CI.

CI change-filters updated: general test path -> test/registered/kernels/**
(covers both ops/ tests and benchmark/ benches); diffusion bench filter ->
test/registered/kernels/benchmark/diffusion/**.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
BBuf and others added 2 commits July 23, 2026 09:51
…runtime kernels package)

The shared test-support helpers do not belong under the runtime `kernels/`
package. Move python/sglang/kernels/testing/ -> python/sglang/test/kernels/
(utils, kv_canary/, deepseek_v4/), the established in-package test-support
namespace (alongside test_utils, ci_register, runners, mock_model, ...), and
rewrite sglang.kernels.testing -> sglang.test.kernels imports.

Kept separate from the existing srt-level sglang/test/kv_canary/ (e2e fixtures):
these are the kernel-level fuzz/oracle helpers, so they live under
sglang/test/kernels/kv_canary/ mirroring the kernel test tree
test/registered/kernels/. Still an importable installed package (required:
test/registered/ tests import it by absolute path).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…yout

- Add the jit/ subpackage (shared JIT build/runtime infra) to the Layout.
- All 19 operator groups are populated; drop the stale "reserved placeholders /
  implementations not moved yet" wording (migration complete via sgl-project#31666/sgl-project#32015/
  sgl-project#32045/sgl-project#32072).
- Note sglang.jit_kernel removed; ops live at kernels.ops.<group>._jit_<op>;
  tests/benchmarks under test/registered/kernels/{ops,benchmark}/<group>/;
  shared test helpers in sglang.test.kernels.
- Fix the fused-op parity test path (now under ops/layernorm/).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Jul 23, 2026
The newly-registered test_minimax_m3_rmsnorm.py (register_amd_ci) lacked the
`if __name__ == "__main__":` entry that run_suite.py's collection requires for
registered pytest-style tests (otherwise `python3 file.py -f` silently skips).
Surfaced by stage-a-unit-test-mlx collection. Add the standard
`sys.exit(pytest.main([__file__, "-v"]))` block.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@BBuf
BBuf merged commit 2d1a7be into sgl-project:main Jul 23, 2026
152 of 229 checks passed
xinguozhu-2026 pushed a commit to xinguozhu-2026/sglang that referenced this pull request Jul 23, 2026
…he package (RFC sgl-project#29630) (sgl-project#32128)

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
chuyeh added a commit to chuyeh/sglang that referenced this pull request Jul 29, 2026
pr-test-amd-rocm724.yml was branched from pr-test-amd-rocm720.yml before the
kernel module reorganization, and being a separate file it does not inherit
later template fixes. Carry over the two that diverged:

- Point the jit_kernel and multimodal_gen path filters at sglang/kernels and
  test/registered/kernels (sgl-project#32072, sgl-project#32128). The old jit_kernel paths no longer
  exist, so those filters could never match and the jobs would be skipped in
  filtered mode without any error.
- Split stage-c-test-large-8-gpu-amd-mi35x across 3 partitions instead of 2,
  matching sgl-project#24651. The suite grew, and two partitions risk exceeding the
  60-minute timeout.

Co-authored-by: Cursor <cursoragent@cursor.com>
Zhylkaaa pushed a commit to Zhylkaaa/sglang that referenced this pull request Jul 29, 2026
…he package (RFC sgl-project#29630) (sgl-project#32128)

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
…he package (RFC sgl-project#29630) (sgl-project#32128)

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
…he package (RFC sgl-project#29630) (sgl-project#32128)

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
…he package (RFC sgl-project#29630) (sgl-project#32128)

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

amd blackwell SM100/SM120 bypass-fastfail bypass-maintenance deepseek documentation Improvements or additions to documentation enable-retry Enable retry logic for CI tests hicache Hierarchical Caching for SGLang jit-kernel lora quant LLM Quantization run-ci run-ci-extra

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant