mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #185] [CLOSED] sampler: the sampled path over 64 vocabulary chunks per token (identical picks, ~12% faster sampled decode) #2496
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#2496
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/185
Author: @q8atnight
Created: 9/30/2026
Status: ❌ Closed
Base:
main← Head:pr/sampler-chunks📝 Commits (1)
6e2e315sampler: the sampled path over 64 vocabulary chunks per token + a merge block (identical picks, ~3 ms less per sampled verify window)📊 Changes
1 file changed (+203 additions, -2 deletions)
View changed files
📝
src/kernels/cuda/sampler.cu(+203 -2)📄 Description
Summary
The sampled path in
sampler.cuput ONE block per token over the 248,320-logit vocabulary and ran top_k (20) argmaxrounds, each a full scan with an inner "already taken?" loop: ~3 ms per sampled verify window on 3 of 82 SMs.
This splits the same selection into two kernels:
values in shared memory, a taken value set to -inf)
top_p / min_p / temperature / Philox chain, line for line
The global top-k in (value desc, index asc) order is the union of the chunks' top-k's, so the kept list - set AND
order - is exactly the serial one.
One commit on top of 0.1.27 (
a790805); all four of my current branches were compile-tested together on 0.1.27.Measured
Measured on 2x RTX 3090, IQ3_S, with the engine this was developed in (0.1.24 + the dual-GPU work): sampled decode
(temperature 0.7, top_p 0.95, top_k 20) at 1K context 102 -> 114 tok/s; about 3 ms less per sampled verify window.
Greedy is unaffected (it does not go through this path).
Correctness
STRATA_SAMPLER_CHECK=1runs the old one-block kernel beside the new one and compares every pick:1,001 of 1,001 identical.
Switch
STRATA_SAMPLER_FAST=0= the old one-block kernel.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.