mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #315] [CLOSED] hc: the multi-token hyper-connection read split finer #2571
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#2571
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/315
Author: @BlueKingMuch
Created: 9/30/2026
Status: ❌ Closed
Base:
main← Head:hc-read-bitwise📝 Commits (1)
334bb2bhc: the multi-token hyper-connection read split finer, checked bit for bit on each card (STRATA_HC_V2)📊 Changes
3 files changed (+451 additions, -34 deletions)
View changed files
📝
include/strata/kernels/fused_gr.hpp(+11 -0)📝
src/core/verify.cpp(+1 -0)📝
src/kernels/cuda/fused_gr.cu(+439 -34)📄 Description
The multi-token hyper-connection read (
fused_gr_read_multi: every verify window and the MTP drafter) keeps v1's arithmetic exactly - every sum over the same elements in the same order - and only splits the work differently. On an RTX 4080 SUPER it takes the two HC reads of a verify window from 5.01 to 4.21 ms (-16 %), about 0.9 ms of GPU time per round, with the same tokens.What changes
rsis v1's;R' * w_normis recomputed and scaled once (the same two roundings as v1's store and in-place scale).cp.asyncin half-stream tiles (1280 floats: 160 = 5 x 32 chunks, so a lane still accumulates its chunkslane + 32 qin ascending order), two in flight, in a bank-conflict-free two-plane layout, and the next tile's weights load while the current one is used. Before sm_80 and on HIP the staging is a plain copy (the same bits).Exactness
Verifier::initrunsfused_gr_check()once per card: v1, v2, v3 and the single-token read on random bf16 weights and inputs (1..8 tokens, with and without the pending write), every output compared bit for bit. The newest variant that agrees runs on that card, and the log says which:strata hc: CUDA0: the hyper-connection read runs as v3 (...); checked bit for bit against v1 on this card.A card that has not been checked runs v1.
STRATA_HC_V2=0keeps v1,=2stops at v2.pcie_frac=0) give the same 256 tokens with v3 and v1, greedy and sampled (T 1.0, top_p 0.95, top_k 20, seed 1), in the same number of rounds.It is on by default where the check passes, since it changes no bit. If you prefer it opt-in, that is one line in
env_variant().Measured
RTX 4080 SUPER 32 GB (sm_89), Ryzen 7 5800X3D, 64 GB DDR4, PCIe 3.0 x16, Windows 11, CUDA 13.3; IQ3_S,
--max-context 262144, int8 KV, 11055 experts in VRAM. A local test build of 0.1.30 (30ec18e) with this commit, #242, #284, and #186 and #258 behind switches; every comparison is within that one build (STRATA_HC_V2unset = v3 againstSTRATA_HC_V2=0= v1), so everything else is identical.The deterministic requests above (8K context, 256 tokens, the same tokens and 100 / 99 rounds in both):
With prompt-lookup drafts and expert swaps (3 x 256 tokens per cell, 8K and 64K context, greedy and sampled) tokens/s scatter by several percent from request to request, but the GPU wait per round drops in every cell: 14.67 -> 13.63, 14.90 -> 13.77, 15.94 -> 14.91, 16.00 -> 15.03 ms.
GPU stages (
STRATA_VERIFY_PROFILE=1, 8K, ms per verify window, DeltaNet + attention layers summed; the stamps split only the first read of each layer):STRATA_GR_V3=1)On this card v3 is 0.6 ms per window faster than #186, and it keeps v1's bits.
To reproduce on the same build:
STRATA_HC_V2=0(v1) against unset (v3);STRATA_VERIFY_PROFILE=1for the stages.Tested on sm_89 only. The pre-sm_80 and HIP paths compile the same kernel with plain copies instead of
cp.async; there the startup check decides as well.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.