Repository navigation
[Perf] sampling: JIT softmax and argmax kernels for the sampler and speculative verify - #44752
Closed
DarkSharpness wants to merge 1 commit into
Closed
DarkSharpness wants to merge 1 commit into
DarkSharpness wants to merge 1 commit into
Conversation
DarkSharpness
requested review from
BBuf,
Edwardf0t1,
Fridge003,
HaiShaw,
HydraQYH,
Qiaolin-Yu,
Ying1123,
celve,
ch-wan,
hnyls2002,
ispobock,
merrymercy and
yuan-luo
as code owners
October 16, 2026 14:33
This comment has been minimized.
This comment has been minimized.
DarkSharpness
force-pushed
the
sampling-jit-softmax-argmax
branch
4 times, most recently
from
October 19, 2026 12:39
621ce1f to
9c48977
Compare
DarkSharpness
force-pushed
the
sampling-jit-softmax-argmax
branch
4 times, most recently
from
October 21, 2026 12:39
2b5d04a to
6cb09dc
Compare
This comment has been minimized.
This comment has been minimized.
…tive verify - Add JIT fp32 softmax (fused per-request temperature, in place) and split-vocab argmax kernels under `sglang.kernels.ops.sampling`. - `Sampler` fuses the temperature into an in-place softmax and uses the JIT argmax for greedy rows; EAGLE / DFlash / UNO / DSpark verify use the same ops. - Drop the Cake softmax dispatch and DSpark's Triton `row_argmax` (kept as a benchmark baseline). - Add softmax / argmax benchmarks and an argmax test. Co-Authored-By: Claude Opus 5.5 <[email protected]>
DarkSharpness
force-pushed
the
sampling-jit-softmax-argmax
branch
from
October 21, 2026 13:42
6cb09dc to
eea9a0c
Compare
DarkSharpness
added a commit
to DarkSharpness/sglang
that referenced
this pull request
Oct 31, 2026
…ve verify Add a JIT row softmax (fp32 / bf16 / fp16 logits to fp32 probs, fused per-request temperature, one row per thread-block cluster held in registers, config chosen from the compiled candidates' real occupancy) and a JIT row argmax (int64, ties to the lowest index, NaN never selected). Wire them into the sampler (fused temperature, in-place probs, greedy argmax) and the speculative verify paths (EAGLE rows_per_request, EAGLE / DFlash / UNO / fast_sample / DSpark argmax); drop the DSpark per-model fused_argmax opt-in. Rename temperature_softmax.py to softmax_triton.py. Supersedes sgl-project#44752. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
What
sglang.kernels.ops.sampling.softmax): row cached in registers (one read, one write), one row per runtime-sized cluster, per-request temperature fused, safe in place. Used on SM100-family GPUs; other platforms keep Triton (ROCm) / torch.sglang.kernels.ops.sampling.argmax): ties take the lowest index, NaN never wins.Sampler: temperature + softmax run in place on the logits buffer (drops thediv_and thelogits[:] = ...copy); greedy rows use the JIT argmax.rows_per_requestinstead ofrepeat_interleave-ing temperatures.fused_argmaxswitch and the Tritonrow_argmax(kept inbench_argmax.pyas a baseline).Validation (GB300)
torch.argmaxreference: all pass.bench_softmax.py(fp32, per-row temperature, cold L2), us:bench_argmax.py(vocab 129280), us:row_argmax🤖 Generated with Claude Code
CI States
Latest PR Test (Base): ✅ Run #39610288367
Latest PR Test (Extra): ❌ Run #39610288299
Latest PR Test (AMD ROCm 10): ❌ Run #39610288322