mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #1457] [CLOSED] prefill: reuse shared scratch for the HC read #3470
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#3470
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/1457
Author: @W1nge
Created: 10/7/2026
Status: ❌ Closed
Base:
main← Head:codex/prefill-hc-gate-reuse📝 Commits (2)
efbbb26prefill: reuse shared scratch for the HC gate819881cprefill: extend scratch reuse to the complete HC read📊 Changes
1 file changed (+34 additions, -16 deletions)
View changed files
📝
src/prefill/prefill.cpp(+34 -16)📄 Description
The HC read's normalized rows, low-rank projections and gate currently retain separate allocations throughout prefill. Reuse the existing attention/MoE scratch region for the complete HC read. A shared take_hc helper supplies both the allocation layout and byte estimate, including the unfused FP32 copy, optional padding and BF16 low parts.
HC reads finish before attention/MoE uses the region on the compute stream. The fused next-half normalization follows those consumers; the existing fusion guard disables it before PLE, which also borrows the region. Persistent residuals, row scales, injection and mixed outputs stay separate. The legacy ring-byte estimate remains conservative.
At T=32768, with default BF16 HC mode and no padding, the removed separate payloads total 1980 MiB (640 MiB normalized rows, 60 MiB low-rank buffers, 1280 MiB gate). Actual savings include allocator rounding and depend on the largest scratch set. No new hardware-specific switch or chunk default.
Validation on RTX 2080 Ti / Windows:
These are short combined-regression checks, not isolated speed measurements or exhaustive state/logit equality. Long prompts, control vectors, padding, multi-device and non-CUDA runtime coverage remain outstanding; keep as draft.
Based directly on
d5ea713. Independent of the other PRs; integration with #1454 needs the adjacent allocation/count edits combined (already tested locally).🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.