Skip to content

[Kernel] Move CUDA and ROCm speculative kernels to JIT - #40033

Merged
hnyls2002 merged 5 commits into
mainfrom
lsyin/spec-kernels-jit
Sep 18, 2026
Merged

hnyls2002 merged 5 commits into
mainfrom
lsyin/spec-kernels-jit

Conversation

@hnyls2002

@hnyls2002 hnyls2002 commented Sep 17, 2026 •

Copy link
Copy Markdown
Collaborator

Routes the EAGLE tree, greedy verify, ngram reconstruction, and target-only sampling kernels through sglang.kernels.ops.speculative (JIT) on CUDA and ROCm, with the device kernels shared as headers so the MUSA AOT build keeps using the same source. No functional change: every device kernel is byte-identical to main modulo whitespace.


CI States

Latest PR Test (Base): 🚫 Run #35289016252
Latest PR Test (Extra): ❌ Run #35289016113
Latest PR Test (AMD ROCm 10): ❌ Run #35289016194

@hnyls2002

Copy link
Copy Markdown
Collaborator Author

/tag-and-rerun-ci

@github-actions github-actions Bot added the run-ci CI: run the baseline test suite on this PR label Sep 17, 2026
@hnyls2002

hnyls2002 commented Sep 17, 2026 •

Copy link
Copy Markdown
Collaborator Author

/rerun-test test_eagle_utils.py test_ngram_utils.py test_speculative_sampling.py
(3 tries)

@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Results for /rerun-test test_eagle_utils.py test_ngram_utils.py test_speculative_sampling.py:

🚀 1-gpu-h100 (3 tests): ❌ View workflow run

cd test/ && python3 registered/kernel/speculative/test_eagle_utils.py
cd test/ && python3 registered/kernel/speculative/test_ngram_utils.py
cd test/ && python3 registered/kernel/speculative/test_speculative_sampling.py

@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Results for /rerun-test test_eagle_utils.py test_ngram_utils.py test_speculative_sampling.py:

🚀 1-gpu-h100 (3 tests): ✅ View workflow run

cd test/ && python3 registered/kernel/speculative/test_eagle_utils.py
cd test/ && python3 registered/kernel/speculative/test_ngram_utils.py
cd test/ && python3 registered/kernel/speculative/test_speculative_sampling.py

@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Results for /rerun-test test_eagle_utils.py test_ngram_utils.py test_speculative_sampling.py:

🚀 1-gpu-h100 (3 tests): ✅ View workflow run

cd test/ && python3 registered/kernel/speculative/test_eagle_utils.py
cd test/ && python3 registered/kernel/speculative/test_ngram_utils.py
cd test/ && python3 registered/kernel/speculative/test_speculative_sampling.py

# Conflicts:
#	test/registered/kernels/ops/speculative/test_eagle_utils.py
#	test/registered/kernels/ops/speculative/test_ngram_utils.py
#	test/registered/kernels/ops/speculative/test_speculative_sampling.py
@github-actions

github-actions Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Results for /rerun-test test_eagle_utils.py test_ngram_utils.py test_speculative_sampling.py:

🚀 1-gpu-h100 (3 tests): ✅ View workflow run

cd test/ && python3 registered/kernels/ops/speculative/test_eagle_utils.py
cd test/ && python3 registered/kernels/ops/speculative/test_ngram_utils.py
cd test/ && python3 registered/kernels/ops/speculative/test_speculative_sampling.py

@hnyls2002
hnyls2002 merged commit f65c70b into main Sep 18, 2026
143 of 200 checks passed
@hnyls2002
hnyls2002 deleted the lsyin/spec-kernels-jit branch September 18, 2026 00:27
yeahdongcn added a commit to yeahdongcn/sglang that referenced this pull request Nov 17, 2026
… MUSA FlashInfer API

The AOT MUSA wheel has been failing since sgl-project#40033 turned the AOT speculative
header into an include of the JIT one:

    jit/include/sgl_kernel/speculative/sampling.cuh:156:5: error: no matching
    function for call to 'DeviceSamplingFromProb'
      flashinfer/sampling.cuh:602:3: note: candidate function not viable:
      requires 7 arguments, but 8 were provided

The JIT header tracks the newer FlashInfer API, where the fallback index is
thread-local and `DeviceSamplingFromProb` takes it as an extra argument. The
MUSA build compiles the same header against the revision `setup_musa.py` pins
(`bc29697`), where that index lives in `temp_storage` and the call takes seven
arguments.

`USE_MUSA` is defined by `setup_musa.py` only, so the guard keeps the CUDA and
JIT compilations on the eight-argument call and gives the AOT MUSA build the
seven-argument one. Nothing else in the kernel changes, including the
accept rule sgl-project#40033 fixed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant