mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #5255] [Engine] layer-major: say how much VRAM a super-chunk needs, and that the walk stays off #5363
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#5363
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/5255
Author: @Norhiro
Created: 11/4/2026
Status: 🔄 Open
Base:
main← Head:lm-off-need-side📝 Commits (1)
d9e7c25Layer-major: say how much VRAM a super-chunk needs, and that the walk stays off📊 Changes
1 file changed (+22 additions, -2 deletions)
View changed files
📝
src/prefill/prefill.cpp(+22 -2)📄 Description
Problem and result
When the layer-major walk cannot get VRAM for a super-chunk, the engine logs
layer-major off for this prompt: no VRAM for a super-chunk (622 MiB free). That line gives the free side only. It does not say which card ran short or how much the walk would need, so a user cannot tell whether freeing 40 MiB or 4 GB would let it run. It is also printed once per distinct text, so a log read later does not show that the walk stayed off for every long prompt after the first. In #3976, @udqe (221 such lines, all free side only), @fioruccione and @cobra91 asked for the need side.After this change, on the same run:
Every 16th long prompt in a row that the walk turns down also gets a line, whatever the reason:
Only the refusal text and the logging change. The walk's decision, the chunk path and everything else are as before.
Related discussion
#3976: the need-side line was offered there on 11-04 and got +1s from @udqe, @fioruccione and @cobra91. No maintainer scope agreement was asked for, since this is a log-text change with no behaviour change.
Approach
lm_prepare: when no super-chunk fits, the need is computed from the same quantitiesfit()uses.fit()tried:S - (S - min_s) / T * T.STRATA_PREFILL_LM_R=vram.lm_margin_bytes.free >= needis the condition under which the walk would run, give or take the MiB rounding: need is rounded up, free down.CUDA<n>as in the engine's other lines.Prefill::run: a counter of long prompts turned down in a row.Validation
Tests 4 and a repeat of test 1 ran on
d9e7c251, this branch onffa80d73= v0.2.10. The repeat of test 1 gave the same lines, with CUDA0 at 626 MiB free. Tests 1-3 ran on the first version of the patch. Itslm_preparechange is identical; only the in-a-row counter differed (see Failed). Both were built with-DSTRATA_ENABLE_CUDA=ON -DSTRATA_ISA_FLOOR=avx -DCMAKE_CUDA_ARCHITECTURES="86;120", CUDA 13.3, g++ 15, Release. The "before" build is v0.2.10 with the same options.Machine: i7-7800X, 125 GiB RAM, Fedora 44. GPUs: RTX 3060 12 GB (CUDA0, PCIe 3.0 x16) and RTX 5060 Ti 16 GB (CUDA1, 3.0 x8). Model: Qwen3.8-Flash-Next UD-Q4_K_XL native,
--max-context 65536 --prefill auto --expert-cache auto --spec 4, MTP, all experts in RAM. Prompts are unique slices of one long document, temperature 0.Passed:
Two cards, layer split,
STRATA_PREFILL_LAYER_MAJOR=1, no VRAM reserve, 3 prompts of 28.6K-31.4K tokens.layers 18..48: no VRAM for a super-chunk (149 MiB free)andno VRAM for a super-chunk (622 MiB free).Two cards, nothing set (0.2.10's default, chunk-major), 2 prompts. No layer-major line of any kind, as in v0.2.10.
The need matches the decision in every case. I used the RTX 3060 alone, where the small-card rule turns the walk on by default, and moved the margin with
STRATA_PREFILL_LM_MARGIN_MIB:... MiB VRAM free beforein the run line)In the 245 MiB start the cache came out smaller, the default chunk was 3840, and the line said "the smallest, 7680 tokens". So the printed size follows the run's own chunk.
The in-a-row line. The RTX 3060 alone with a 2000 MiB margin and 17 long prompts. All 17 were turned down. Seven different texts were printed, because the free MiB moved between 530 and 658.
layer-major still off, 16 long prompts in a rowappeared once, at the 16th.Build: the build passed (ninja, 170/170). No new warnings in
prefill.cpp. The two that remain,ssqandmulti, are in lines this patch does not touch.Failed:
Not run:
prefill.cppis part ofstrata_prefillfor HIP too. The patch only adds calls the file already makes (cudaGetDevice,cudaGetLastError), but I have no AMD card and did not build it. I am keeping this a draft until someone can build HIP, or a maintainer says the CUDA build is enough for a log-text change.STRATA_PREFILL_LAYER_MAJOR=1, so the margin shown there is 96 MiB, not the 512 MiB a by-default run would use.Limits
AI-assisted: Claude Code wrote the patch with me and ran the tests on my machine. I read every changed line, and the logs quoted above are from those runs.
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.