[PR #1283] [CLOSED] prefill: bytes_needed sizes the MoE buffers for the layout init picks (with or without an expert source) #3357

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

📋 Pull Request Information

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

Base: main ← Head: pr/prefill-bytes-needed


📝 Commits (1)

  • e7635b6 prefill: bytes_needed sizes the MoE buffers for the layout init picks (with or without an expert source)

📊 Changes

3 files changed (+27 additions, -21 deletions)

View changed files

📝 include/strata/prefill/prefill.hpp (+9 -5)
📝 src/prefill/prefill.cpp (+11 -9)
📝 src/program/generate.cpp (+7 -7)

📄 Description

Replaces #1042, which GitHub closed when main's history was rewritten. The closing note says this was not a rejection. It is the same commit, cherry-picked onto the new main (v0.1.40.1).


Prefill::bytes_needed() sizes the region the prompt path borrows from the expert cache. It must count exactly what carve() allocates. 0.1.39 took the first part of #547 with #583 (the xn / grs count). This is what is left.

The MoE layout. bytes_needed sizes the MoE scratch with fused_layout(T, true) for every caller. carve takes the fused layout only when init gets an ExpertSource (fused_layout(T, m.src != nullptr)). So a prompt path without one is lent the fused layout's smaller MoE buffers, and its unfused buffers do not fit in them.

The change. bytes_needed_impl takes a src flag. So do bytes_needed, bytes_needed_no_ring and 0.1.40's bytes_needed_owned (#796), all defaulting to true. Every caller in generate.cpp passes srcp != nullptr, the same source it hands init. That includes STRATA_OWNED_PRICE=exact's sizing.

Identity. With an ExpertSource (every normal run) nothing changes. The logits and the 32 greedy tokens after a 32K prompt equal v0.1.40 on IQ2_XS: identical bytes, same expert cache. The engine's sources here are the same bytes as on that branch, because 0.1.40.1 changed only the server and setup.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VZy1yKaDDiA8a7svdwaHio


🔄 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/1283 **Author:** [@sergqwer](https://github.com/sergqwer) **Created:** 10/7/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `pr/prefill-bytes-needed` --- ### 📝 Commits (1) - [`e7635b6`](https://github.com/Niko1221/Strata/commit/e7635b642a09ee901b506166bd682c8d19eb356c) prefill: bytes_needed sizes the MoE buffers for the layout init picks (with or without an expert source) ### 📊 Changes **3 files changed** (+27 additions, -21 deletions) <details> <summary>View changed files</summary> 📝 `include/strata/prefill/prefill.hpp` (+9 -5) 📝 `src/prefill/prefill.cpp` (+11 -9) 📝 `src/program/generate.cpp` (+7 -7) </details> ### 📄 Description Replaces #1042, which GitHub closed when `main`'s history was rewritten. The closing note says this was not a rejection. It is the same commit, cherry-picked onto the new `main` (v0.1.40.1). --- `Prefill::bytes_needed()` sizes the region the prompt path borrows from the expert cache. It must count exactly what `carve()` allocates. 0.1.39 took the first part of #547 with #583 (the `xn` / `grs` count). This is what is left. **The MoE layout.** `bytes_needed` sizes the MoE scratch with `fused_layout(T, true)` for every caller. `carve` takes the fused layout only when `init` gets an `ExpertSource` (`fused_layout(T, m.src != nullptr)`). So a prompt path without one is lent the fused layout's smaller MoE buffers, and its unfused buffers do not fit in them. **The change.** `bytes_needed_impl` takes a `src` flag. So do `bytes_needed`, `bytes_needed_no_ring` and 0.1.40's `bytes_needed_owned` (#796), all defaulting to `true`. Every caller in `generate.cpp` passes `srcp != nullptr`, the same source it hands `init`. That includes `STRATA_OWNED_PRICE=exact`'s sizing. **Identity.** With an `ExpertSource` (every normal run) nothing changes. The logits and the 32 greedy tokens after a 32K prompt equal v0.1.40 on IQ2_XS: identical bytes, same expert cache. The engine's sources here are the same bytes as on that branch, because 0.1.40.1 changed only the server and setup. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01VZy1yKaDDiA8a7svdwaHio --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 14:40:54 +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#3357
No description provided.