[PR #186] [CLOSED] decode: hyper-connection read in 2 kernels, stream-split (-1.5 ms per verify window) #2494

Closed
opened 2026-11-04 02:00:43 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/186
Author: @q8atnight
Created: 9/30/2026
Status: ❌ Closed

Base: main ← Head: pr/hc-read-v3


📝 Commits (2)

  • 33729e1 decode: hyper-connection read in 2 kernels - norm folded into a stream-split down kernel (164 blocks), rs/lo/inject in up's prologue (STRATA_GR_V3=0 = old)
  • f9ba00f decode: hc read v3 is opt-in (STRATA_GR_V3=1: another summation order); its shared memory is sized from the card's opt-in limit - one or two column halves, else the default kernels (Turing/HIP 64 KB fit with two; capability-based split as proposed by @Adamyno); the neutral knobs (DOWN_R2, UP_PF, KSPLIT) dropped (review)

📊 Changes

1 file changed (+228 additions, -0 deletions)

View changed files

📝 src/kernels/cuda/fused_gr.cu (+228 -0)

📄 Description

Summary

In fused_gr_read_multi the norm kernel ran on only T blocks (~16 us of pure latency per call, 96 calls per verify
window) and down on 41 blocks (~280 GB/s). v3 does the hyper-connection read in 2 kernels instead of 3:

  • down is split over (row group, stream) = 164 blocks; each block stages its stream's R' * w_norm for the T tokens,
    reduces that stream's sum of squares itself, and writes UNSCALED per-stream partial dots
  • since the rms scale is per stream, w_down . xn = sum_c rs[c] * (w_down[:, c] . (R'[c] * w_norm[c])), and up
    applies it in its prologue (lo, inject, rs)

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): decode verify
window 23.25 -> 21.69 ms (about +7 % decode).

Correctness

Same maths, another summation order, so NOT bitwise identical to the old kernels. Our dual-vs-single exactness gate
passes with it (both paths use it).

Switches

STRATA_GR_V3=0 = the old 3 kernels. A/B knobs measured neutral or slower, left off by default:
STRATA_GR_KSPLIT=2, STRATA_GR_DOWN_R2=2, STRATA_GR_UP_PF=1.


🔄 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/Niko1221/Strata/pull/186 **Author:** [@q8atnight](https://github.com/q8atnight) **Created:** 9/30/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `pr/hc-read-v3` --- ### 📝 Commits (2) - [`33729e1`](https://github.com/Niko1221/Strata/commit/33729e155a13caa03c96890df5d00010ee03438c) decode: hyper-connection read in 2 kernels - norm folded into a stream-split down kernel (164 blocks), rs/lo/inject in up's prologue (STRATA_GR_V3=0 = old) - [`f9ba00f`](https://github.com/Niko1221/Strata/commit/f9ba00fffa9d7be5f185d93d4146bcbb0b5dee78) decode: hc read v3 is opt-in (STRATA_GR_V3=1: another summation order); its shared memory is sized from the card's opt-in limit - one or two column halves, else the default kernels (Turing/HIP 64 KB fit with two; capability-based split as proposed by @Adamyno); the neutral knobs (DOWN_R2, UP_PF, KSPLIT) dropped (review) ### 📊 Changes **1 file changed** (+228 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `src/kernels/cuda/fused_gr.cu` (+228 -0) </details> ### 📄 Description ## Summary In `fused_gr_read_multi` the norm kernel ran on only T blocks (~16 us of pure latency per call, 96 calls per verify window) and `down` on 41 blocks (~280 GB/s). v3 does the hyper-connection read in 2 kernels instead of 3: - `down` is split over (row group, stream) = 164 blocks; each block stages its stream's R' * w_norm for the T tokens, reduces that stream's sum of squares itself, and writes UNSCALED per-stream partial dots - since the rms scale is per stream, w_down . xn = sum_c rs[c] * (w_down[:, c] . (R'[c] * w_norm[c])), and `up` applies it in its prologue (lo, inject, rs) 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): decode verify window 23.25 -> 21.69 ms (about +7 % decode). ## Correctness Same maths, another summation order, so NOT bitwise identical to the old kernels. Our dual-vs-single exactness gate passes with it (both paths use it). ## Switches `STRATA_GR_V3=0` = the old 3 kernels. A/B knobs measured neutral or slower, left off by default: `STRATA_GR_KSPLIT=2`, `STRATA_GR_DOWN_R2=2`, `STRATA_GR_UP_PF=1`. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-04 02:00:43 +07:00
Sign in to join this conversation.
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
Niko1221/Strata#2494
No description provided.