[PR #1465] [CLOSED] cuda: retain HC norm products in existing scratch #3475

Closed
opened 2026-11-07 14:41:44 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/1465
Author: @W1nge
Created: 10/7/2026
Status: ❌ Closed

Base: main ← Head: codex/hc-norm-input-reuse


📝 Commits (1)

  • e952756 cuda: retain HC norm products in existing scratch

📊 Changes

1 file changed (+8 additions, -16 deletions)

View changed files

📝 src/kernels/cuda/fused_gr.cu (+8 -16)

📄 Description

The split/staged HC normalization reads the residual twice and recomputes a pending write after its reduction. Store the unscaled R * norm product in the existing xn scratch during the first pass, then scale it in place. The reduction order and two multiplication roundings stay unchanged. This extracts the useful part of our local stream-norm path without adding another kernel variant or tuning flag.

Validation on RTX 2080 Ti (sm_75), Windows/MSVC, driver 560.94:

  • The existing fused_gr_selftest passed all plain/split/staged comparisons, including windows of 1..8 tokens with and without a pending write, bit for bit.
  • A direct norm comparison also matched xn and rs bit for bit at T=1,2,4,8, both write modes.
  • A CUDA-graph microprobe (1000 launches per graph, 10 alternating rounds) measured reductions from 3.2% to 17.1% for this norm kernel. These are component timings, not end-to-end decode gains. Other GPU generations and HIP are not measured; draft pending broader validation. The existing per-device correctness check/fallback remains intact.

The existing internal selftest can be run in a small CUDA TU including src/kernels/cuda/fused_gr.cu, calling fused_gr_selftest(ok, why), and requiring ok[1], ok[2], ok[3]. This checks the actual production kernels. No changes to public APIs, allocation sizes or hardware selection.

Based directly on d5ea713, independent of the prefill memory and prompt-reuse PRs.

Validation update (2026-10-08): a complete current-main integration build including #1451, #1454, #1455, #1457 and #1465 passed four real IQ3_XXS model baseline/integration pairs on RTX 2080 Ti: default, GR_UNFUSED, PREFILL_BF16X2 and legacy RING_BYTES modes. Each used INT8 KV, 194 input tokens, two prefill chunks and 8 output tokens; all runs exited successfully and output IDs matched within each pair. A 256K configured-context startup and short generation also passed (this did not fill a 256K prompt). These are combined regression checks, not an isolated performance result or exhaustive state equality. Other hardware/backends remain untested. The earlier draft-only status reflected the absence of any current-main model run; now requesting review with these limits explicit.


🔄 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/1465 **Author:** [@W1nge](https://github.com/W1nge) **Created:** 10/7/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `codex/hc-norm-input-reuse` --- ### 📝 Commits (1) - [`e952756`](https://github.com/Niko1221/Strata/commit/e952756edac8be771895cd71745e1cc05b988f38) cuda: retain HC norm products in existing scratch ### 📊 Changes **1 file changed** (+8 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `src/kernels/cuda/fused_gr.cu` (+8 -16) </details> ### 📄 Description The split/staged HC normalization reads the residual twice and recomputes a pending write after its reduction. Store the unscaled R * norm product in the existing xn scratch during the first pass, then scale it in place. The reduction order and two multiplication roundings stay unchanged. This extracts the useful part of our local stream-norm path without adding another kernel variant or tuning flag. Validation on RTX 2080 Ti (sm_75), Windows/MSVC, driver 560.94: - The existing fused_gr_selftest passed all plain/split/staged comparisons, including windows of 1..8 tokens with and without a pending write, bit for bit. - A direct norm comparison also matched xn and rs bit for bit at T=1,2,4,8, both write modes. - A CUDA-graph microprobe (1000 launches per graph, 10 alternating rounds) measured reductions from 3.2% to 17.1% for this norm kernel. These are component timings, not end-to-end decode gains. Other GPU generations and HIP are not measured; draft pending broader validation. The existing per-device correctness check/fallback remains intact. The existing internal selftest can be run in a small CUDA TU including src/kernels/cuda/fused_gr.cu, calling fused_gr_selftest(ok, why), and requiring ok[1], ok[2], ok[3]. This checks the actual production kernels. No changes to public APIs, allocation sizes or hardware selection. Based directly on d5ea713, independent of the prefill memory and prompt-reuse PRs. Validation update (2026-10-08): a complete current-main integration build including #1451, #1454, #1455, #1457 and #1465 passed four real IQ3_XXS model baseline/integration pairs on RTX 2080 Ti: default, GR_UNFUSED, PREFILL_BF16X2 and legacy RING_BYTES modes. Each used INT8 KV, 194 input tokens, two prefill chunks and 8 output tokens; all runs exited successfully and output IDs matched within each pair. A 256K configured-context startup and short generation also passed (this did not fill a 256K prompt). These are combined regression checks, not an isolated performance result or exhaustive state equality. Other hardware/backends remain untested. The earlier draft-only status reflected the absence of any current-main model run; now requesting review with these limits explicit. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 14:41:44 +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#3475
No description provided.