mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #3309] [Engine] warm up the prompt path once before READY #4561
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#4561
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/3309
Author: @gopinath87607
Created: 10/20/2026
Status: 🔄 Open
Base:
main← Head:prefill-warm-prompt📝 Commits (1)
af867e7serve: STRATA_WARM_PROMPT (off) reads one synthetic prompt before READY📊 Changes
2 files changed (+146 additions, -0 deletions)
View changed files
📝
docs/DETAILS.md(+11 -0)📝
src/program/generate.cpp(+135 -0)📄 Description
Problem and result
A session's first prompt pays what no later prompt pays: the first chunk carries every kernel's first launch, the prompt path's own allocations and the tiers' first reads. After this change,
STRATA_WARM_PROMPT=N(off by default) reads one synthetic N-token prompt through the whole part chain before the engine says READY, so the first real request does not pay it. Unset or0, the block is skipped and the engine says READY exactly as before.Related discussion
The original pull request and its discussion: #2832 (closed when its fork was deleted; this PR replaces it). The work comes from the Maya checkout (
project-maya), local commitcc58309(2026-10-14).Approach
STRATA_WARM_PROMPT=N(--serve): one synthetic prompt of N tokens (32 if you ask for less) is read through the whole part chain before READY.STRATA_GLM_WARM_PROMPTis accepted as the same knob.The synthetic ids are spread over the vocabulary (
100 + (i * 131) % 20000), so the routes are not one expert's. It takes the same loan a request takes (the slots the prompt path is laid out in go non-resident and are refilled from the arena afterwards), and every participant's state is zeroed before and after it, so no conversation can see it. A prompt path that cannot run prints why and the first prompt pays it; the start never fails because of it.Unset or
0(the default), the whole block is skipped and the engine says READY exactly as before. Nothing outside the block changes; this is by construction.Validation
Tested revision:
af867e73, one commit on currentmain(e88ee39d). Environment: Linux, CUDA 13.2 (V13.2.86),sm_86+sm_120; the build machine is the Q8_0 4-way rig (2x RTX 3060 12 GB, 2x RTX 5060 8 GB).Passed:
git rebase e88ee39d- the conflict ingenerate.cppwith upstream'schunk_vramprompt planner was resolved; the branch's diff is this feature only.ninja -C build strataataf867e73- exit 0 (CUDA 13.2,sm_86+sm_120).-fsyntax-onlyonsrc/program/generate.cppwith the build's own flags - clean; one pre-existing unused-variable warning in unrelated code. This was run before the rebase; the full build above covers the rebased head.--batch 8 --batch-groups 4, v0.1.45 + this PR + #2673, one run per case, warm page cache): time to READY 102 s unset vs 101 s atSTRATA_WARM_PROMPT=512; first request (a ~325-token prompt) time to first token 1.00 s unset vs 0.72 s at 512; later requests were unaffected.Failed:
Not run:
af867e73.generate.cppcarries no per-backend code, so both builds compile the same change.Limits
PPline, with the variable set and unset is the A/B.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.