[PR #131] [CLOSED] sampler92: the radix sampled path as one cheaper kernel pair, picks unchanged #356

Closed
opened 2026-10-29 21:24:35 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/mw00/project-maya/pull/131
Author: @handmade0octopus
Created: 10/12/2026
Status: ❌ Closed

Base: main ← Head: pr/sampler92


📝 Commits (1)

  • 21dda14 sampler92: the radix sampled path as one cheaper kernel pair, picks unchanged

📊 Changes

2 files changed (+315 additions, -34 deletions)

View changed files

📝 src/kernels/cuda/sampler.cu (+184 -34)
➕ src/kernels/cuda/sampler_legacy.inc (+131 -0)

📄 Description

What

The sampled chain ran as two kernels: one pass to pick the top-k, then a second pass applying top_p/temperature over a partial sort of the k survivors. Both passes re-read the whole vocabulary. This replaces the pair with cheaper kernels that keep the picks identical, and makes the fast path the default (STRATA_GLM_SAMPLER92=0 falls back to the old pair for an A/B).

Numbers (Maya-S-v2-IQ2_XXS, one 4090 D, RAM-resident tiers)

Campaign protocol: 32,755-token prompt, 128 warm-up tokens, 2,048 measured on the fully cached prefix, temp 1.0 / top_p 0.95 / seed 734621, thinking max.

build decode
v1.1.0 (stock kernels) 27.86 tok/s
v1.1.0 + this kernel 29.31 tok/s (+5.2%)

The gain is kernel-only, not stream luck: both builds produced the identical token stream (same seed; 2,048-token server generations and 256-token CLI generations match token for token), same tier attribution, same VRAM hit. Teacher-forced scoring (2,047 positions): nll 0.16356 / top-1 97.61% both before and after.

Verification

  • STRATA_GLM_SAMPLER92=0 restores the old kernel pair (the fork's legacy kernel, kept as sampler_legacy.inc, also picks identically to the fast path).
  • Full-request output parity checked against the old path on a 32k prompt (thinking on, sampled chain).

Bench context: Ryzen 5 3600 CPU lane, 128 GB RAM, engine args --glm-ram-resident --max-context 262144, no prefetch, PROMOTE_MIN=6, CPU plan 000111222.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/mw00/project-maya/pull/131 **Author:** [@handmade0octopus](https://github.com/handmade0octopus) **Created:** 10/12/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `pr/sampler92` --- ### 📝 Commits (1) - [`21dda14`](https://github.com/mw00/project-maya/commit/21dda14f12d8d2beed2be0cd16d3a41532c8a171) sampler92: the radix sampled path as one cheaper kernel pair, picks unchanged ### 📊 Changes **2 files changed** (+315 additions, -34 deletions) <details> <summary>View changed files</summary> 📝 `src/kernels/cuda/sampler.cu` (+184 -34) ➕ `src/kernels/cuda/sampler_legacy.inc` (+131 -0) </details> ### 📄 Description ## What The sampled chain ran as two kernels: one pass to pick the top-k, then a second pass applying top_p/temperature over a partial sort of the k survivors. Both passes re-read the whole vocabulary. This replaces the pair with cheaper kernels that keep the picks identical, and makes the fast path the default (`STRATA_GLM_SAMPLER92=0` falls back to the old pair for an A/B). ## Numbers (Maya-S-v2-IQ2_XXS, one 4090 D, RAM-resident tiers) Campaign protocol: 32,755-token prompt, 128 warm-up tokens, 2,048 measured on the fully cached prefix, temp 1.0 / top_p 0.95 / seed 734621, thinking max. | build | decode | |---|---| | v1.1.0 (stock kernels) | 27.86 tok/s | | v1.1.0 + this kernel | **29.31 tok/s (+5.2%)** | The gain is kernel-only, not stream luck: both builds produced the **identical token stream** (same seed; 2,048-token server generations and 256-token CLI generations match token for token), same tier attribution, same VRAM hit. Teacher-forced scoring (2,047 positions): nll 0.16356 / top-1 97.61% both before and after. ## Verification - `STRATA_GLM_SAMPLER92=0` restores the old kernel pair (the fork's legacy kernel, kept as `sampler_legacy.inc`, also picks identically to the fast path). - Full-request output parity checked against the old path on a 32k prompt (thinking on, sampled chain). Bench context: Ryzen 5 3600 CPU lane, 128 GB RAM, engine args `--glm-ram-resident --max-context 262144`, no prefetch, PROMOTE_MIN=6, CPU plan `000111222`. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-29 21:24:35 +07:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
mw00/project-maya#356
No description provided.