mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
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#5075
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/4522
Author: @cobra91
Created: 10/28/2026
Status: 🔄 Open
Base:
main← Head:trim-auto-split📝 Commits (2)
af3596ePer-card weight trimming on --layer-split auto, from Hardin22's Strata-DualGPU (d9ff514), rebased onto main1f3a326Trimmed reload: reset the process-wide layer range before each stage reloads📊 Changes
3 files changed (+190 additions, -54 deletions)
View changed files
📝
include/strata/core/native_dense.hpp(+6 -0)📝
src/core/native_dense.cpp(+28 -0)📝
src/program/generate.cpp(+156 -54)📄 Description
Problem and result
Main already trims each card's dense weights to its own layer range, but only with an explicit
--layer-split, opt-in, off by default - so the common path (--layer-split auto, what the app and most setups use) never trims, and CUDA0 never trims at all. Result measured on a 4060 Ti + 5080 / 32 GB rig, Swift 1.5 IQ2_XS, 64K, q4_0 KV: CUDA0's expert cache holds 6812 slots and decode runs at 33.9-38.8 tok/s. With this change every card, including the first, reloads only the dense weights of the layers it runs and the freed VRAM goes to its expert cache: 8021 slots on CUDA0 (+19%) and decode 52.0 tok/s - +34 to +53%,--no-trim-stage-weightsrestoring today's behaviour.Related discussion
The implementation is Hardin22's per-card trimming (Strata-DualGPU
d9ff514, part of what #642 described); JeanP00l's #639 explored the same idea for explicit splits. Our measurements of the fork on this GPU class: #4470. No maintainer agreement on the default yet - flipping it to on-by-default is the one scope point worth a call, and I am happy to keep it opt-in if preferred.Approach
NativeDense::release()/bytes_in()/ per-layer byte accounting, alongside main's layer-rangeloadandset_layer_range; the freed bytes feed the split search (trim_frees()added tostage_left()); after the first card's trimmed reload the sixblk.1.ple_*weights are wired again (wire_ple), which is also what makes a reload safe with the PLE;--trim-stage-weights/--no-trim-stage-weightsflags. Later stages keep loading through main's existinglate_weightspath - this PR only adds CUDA0's trimmed reload, which main never does. The second commit fixes a plain bug of the reload: an explicit split loads its later stages eagerly and theset_layer_rangethey leave behind intersected with CUDA0's own range to nothing ("no supported GDN/QSA matrices"); each reload now resets the range to its own stage first.Validation
Engine built from main at
46c152a1(MSVC 19.51 / Ninja / CUDA 13.4, arch 89;120), with and without this PR, same host (serve/server.py), same prompts, greedy. Rig: RTX 5080 + RTX 4060 Ti 16 GB, Ryzen 7 9800X3D, 32 GB RAM, Windows 11.Passed:
layer split: each card keeps only its own layers' dense weights (2.86 GiB in all): CUDA0 0-22 (1497 MiB freed), CUDA1 23-47 (1431 MiB freed); expert cache CUDA0 6812 -> 8021 slots.--layer-split 19: loads, trims, and runs (after the second commit; it crashed with "native dense: already loaded"-class state before it).Failed:
Not run:
Limits
Measured on one rig and one model family. The freed VRAM lands in the expert caches, so a placement that counted it can fill the cards harder (with #4534's search price the pair lands low on free VRAM on the later card;
--vram-reserve-later-mibcovers the margin, and the fork has two follow-up changes for that which I can bring separately).🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.