mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #3391] [CLOSED] [Engine] preserve prompt loan residency without token graph #4610
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#4610
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/3391
Author: @j-luwierski
Created: 10/20/2026
Status: ❌ Closed
Base:
main← Head:codex/prompt-loan-residency📝 Commits (1)
70660fa[Engine] preserve prompt loan residency without token graph📊 Changes
4 files changed (+198 additions, -63 deletions)
View changed files
📝
CMakeLists.txt(+9 -0)📝
include/strata/prefill/prefill.hpp(+15 -0)📝
src/program/generate.cpp(+129 -63)➕
tests/core/borrow_residency_test.cpp(+45 -0)📄 Description
Problem and result
On current main (0.2.1,
90767252), a profile-filled IQ3_XXS native pack with --prefill auto and --no-token-graph could not borrow the expert cache. The residency table was only built for the token-graph hit path, so the prompt path tried to allocate its own 8192-token buffers and failed with 23 MiB free while requesting an 80 MiB buffer.The fix builds the residency table whenever prefill borrowing is available, independently of token-graph capture. On the same RTX 4070 Ti SUPER, the updated build borrowed 2489 cache slots, refilled them after the prompt, processed 12,287 tokens, and generated one token. A token-graph control also completed and produced the same token.
Related discussion
Approach
The residency decision covers borrowing availability and a positive prefill chunk. The table is staged for either reader: the token-graph hit path or the prompt loan. Graph hit wiring remains gated by graph capture. A borrowing-only staging failure warns and disables borrowing for that run; graph staging failures retain their existing fatal behavior. Loan/refill trace lines report the slot range and any slots still lent.
Validation
Tested revision:
70660fa3on90767252. Environment: Linux, NVIDIA RTX 4070 Ti SUPER 16 GB, CUDA 13.4.92, CUDA arch 89, Ryzen 9 5900X, 125 GiB RAM. Model: Qwen3.8-Flash-Next IQ3_XXS native pack, int8 KV, 32K context, MTP spec 4. The prompt file contained 12,288 copies of token ID 198.Passed:
90767252: exited 1 at prefill initialization with 23 MiB free while the 8192-token chunk requested an 80 MiB buffer.70660fa3: completed the 12,287-token prompt and generated token 198; the log reported an 8192-token chunk, 2489 borrowed cache slots, and all 2489 slots refilled.70660fa3: completed the same prompt and generated token 198.Runtime prompt setup: python3 -c 'from pathlib import Path; Path("/tmp/strata-pr1131-prompt.txt").write_text("198 " * 12288)'. The engine command used --pack $DATA/packs/iq3_xxs, the IQ3_XXS native GGUF shard pair, --expert-profile data/expert-profile.bin, --expert-cache auto, --prefill auto, --spec 4, --mtp $DATA/mtp/rt, --max-context 32768, --max-new 1, --kv int8, --no-token-graph, and --tokens-file /tmp/strata-pr1131-prompt.txt.
Failed:
90767252failed as described above; no failure was observed on the tested final revision for the supported run.Not run:
Limits
The hardware run covers one CUDA GPU and one IQ3_XXS pack. It makes no performance claim and does not establish HIP, SYCL, multi-GPU, or repeated-serve behavior.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.