[PR #1454] [CLOSED] prefill: reuse embedding storage for half outputs #3466

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

📋 Pull Request Information

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

Base: main ← Head: codex/prefill-embedding-reuse


📝 Commits (1)

  • 304f325 prefill: reuse embedding storage for half outputs

📊 Changes

1 file changed (+5 additions, -3 deletions)

View changed files

📝 src/prefill/prefill.cpp (+5 -3)

📄 Description

Reuse the prompt embedding allocation for the later half output (bo). Embedding gathers, image-row uploads, the last embedding consumer (gr_broadcast), output projections, MoE combine and HC writes are ordered on m.cs. A following chunk reloads its embeddings; a stage receiving hand_in_ does not read emb. PLE embeddings retain their separate allocation.

Remove the corresponding bo allocation from bytes_needed_impl as well as carve. This saves chunk * 2560 * sizeof(float) payload bytes (320 MiB at 32768 rows), with allocator rounding handled by the existing allocator. No new flags, default chunk changes, or numerical kernels. Independent of #1451.

Validation: reviewed all m.emb/m.bo accesses in current main d5ea713; prefill.cpp compiles with MSVC 19.44/CUDA 12.4 headers both without native/MMQ and with native/MMQ/fused enabled; git diff --check passes.

Draft: this alias was part of the locally validated 32K fork, but this isolated upstream port has not had a full-model, peer/stage or other-backend runtime comparison. The allocation saving is not an isolated throughput measurement. No broader HC scratch overlay is included.

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/1454 **Author:** [@W1nge](https://github.com/W1nge) **Created:** 10/7/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `codex/prefill-embedding-reuse` --- ### 📝 Commits (1) - [`304f325`](https://github.com/Niko1221/Strata/commit/304f325af4e442f1f4c87e59136df5f16829751d) prefill: reuse embedding storage for half outputs ### 📊 Changes **1 file changed** (+5 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `src/prefill/prefill.cpp` (+5 -3) </details> ### 📄 Description Reuse the prompt embedding allocation for the later half output (`bo`). Embedding gathers, image-row uploads, the last embedding consumer (`gr_broadcast`), output projections, MoE combine and HC writes are ordered on `m.cs`. A following chunk reloads its embeddings; a stage receiving `hand_in_` does not read `emb`. PLE embeddings retain their separate allocation. Remove the corresponding `bo` allocation from `bytes_needed_impl` as well as `carve`. This saves `chunk * 2560 * sizeof(float)` payload bytes (320 MiB at 32768 rows), with allocator rounding handled by the existing allocator. No new flags, default chunk changes, or numerical kernels. Independent of #1451. Validation: reviewed all `m.emb`/`m.bo` accesses in current main d5ea713; `prefill.cpp` compiles with MSVC 19.44/CUDA 12.4 headers both without native/MMQ and with native/MMQ/fused enabled; `git diff --check` passes. Draft: this alias was part of the locally validated 32K fork, but this isolated upstream port has not had a full-model, peer/stage or other-backend runtime comparison. The allocation saving is not an isolated throughput measurement. No broader HC scratch overlay is included. 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:40 +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#3466
No description provided.