Repository navigation
[Engine] preserve prompt loan residency without token graph - #3391
Draft
j-luwierski wants to merge 1 commit into
Draft
j-luwierski wants to merge 1 commit into
j-luwierski wants to merge 1 commit into
Conversation
j-luwierski
marked this pull request as draft
October 20, 2026 08:11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem and result
On current main (0.2.1, 9076725), 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: 70660fa on 9076725. 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:
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:
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.