pool: reuse pieces the card is through with; rest staging 250 ms #393
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/lobomfz--VIctory-xmem!393
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-393"
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?
@cerealfordinner on GitHub · 2026-12-03 23:55 UTC · original
cerealfordinner:upstream/staging-rest-on-fence→main· +598 −105 · 1 files · 5 commits · openCombines the texture-fence reuse from #364 with the 250 ms staging rest from
#279, rebased onto current
main. Both touch the same piece bookkeeping, sothey ship as one change.
take()andtake_ripe()were test-only, andthey dropped the blocks
take_piece()freed instead of returning them tohost::retire, so a 64 MiB block past the spares could be unmapped live.They return what went with the piece now;
take_piece()returns itsretired blocks instead of taking a seventh argument (the one clippy lint in
pool.rs). No behaviour change.rested 5 s by the clock alone, which under pressure loops: the sweep frees
host copies, their pieces rest, the blocks can't go back, new textures take
new blocks, and the card fills. On a 16 GB card (Boat and Prison) that was
94 % of the budget, 1,325 passes without room, and 14,721 copies remade.
A piece is free now once the card has finished
FENCE_LAG(128, same ashost::BURY_LAG) submissions after the newest one that may name it.Staging stays on the clock;
RESTis the fallback for a card that finishesnothing.
list that names them, so the upload heap can rest 250 ms instead of 5 s and
be reused and retired sooner in streaming bursts. Texture pieces keep the
fence path above.
@Kal0s-design on GitHub · 2026-12-04 00:20 UTC · original
Checked this against #364 and #279 put together by hand.
The first two commits are #364 unchanged:
git diffbetween #364's head and 1c75d6a..e3b2e00 on pool.rs is empty, so what I wrote on #364 still applies here. For the third commit I rebuilt the combination myself (cherry-picked #364's two commits, then #279's, on the same base1152b9c, resolved the four conflicts the obvious way) and diffed pool.rs against this branch. The non-test code comes out the same:new(most, fenced)just callswith_rest(most, fenced, REST)(pool.rs:296-300), so TEXTURES still gets 5000 ms as the clock fallback.give_atsetsrested_at = now + self.rest_ms(pool.rs:538).free_fromis still computed the same way.with_rest(STAGING_KEPT, false, STAGING_REST)(pool.rs:672). It is unfenced, soby_fencereturns straight away for it (pool.rs:600), and the tick passesfinished = 0for staging anyway (pool.rs:70). Staging goes by 250 ms on the clock and nothing else. Textures go by the fence, with 5 s as the fallback.RESToutside the tests. The only code use is the default innew, so no other timer or retire path is still on 5 s for staging.The differences are comments and tests:
STAGING_RESTsits afterRESTand the doc is reworded (pool.rs:97-102). The new wording is a bit stronger than #279's: it says the piece's list "has finished by then". That's true when the wait succeeds. The caveat from my #279 comment still applies: the host sync path warns and carries on if Signal/SetEventOnCompletion fails, and the ahead path drops jobs after a failed wait. With 250 ms there's much less slack in those cases than with 5 s. That gap was already there and isn't something this PR needs to fix. I'd just soften the comment a little.RESTfor staging buffers (pool.rs:18). It's 250 ms for staging now.a_staging_piece_rests_less_than_a_texture_piece(pool.rs:1328-1352). It checks the 249/250 ms edge for staging and the 5 s fallback for a fenced pool with no finished submissions, all throughreclaim. Compared with #279's first test, it no longer checks reuse throughtake()at the edge or that the blocks pastSTAGING_KEPTget retired. Losing the concurrent test costs nothing, because it passed with rest 0 too (see my note on #279).Tests on this branch, one NVIDIA desktop card:
cargo test -p victory-gpu --lib pool::: 16 tests, 20/20 debug, 20/20 release. The new test fails ifgive_atignoresrest_ms, so it does pin the wiringvictory-gpu --librun: 346 passed, 5 failed. Those are the same 5 that fail on main for me (twoindirect::host_list_*, twopipeline::host, the flaky watch test)cargo clippy -p victory-gpu --all-targets: nothing in pool.rsSo this matches #364 + #279 apart from the test swap and the two doc points above.
AI-assisted: yes
@deyvideguilherme on GitHub · 2026-12-04 01:58 UTC · original
Tested #393 (
26b70f7, on top ofmain1152b9c) on Linux/RADV in a ~5 min live gameplay session (Series S,1920x1080,VICTORY_BVH_BUILDER=1, driving route), compared againstmain1152b9con the same machine and route:./build.sh, 0 warnings/errors in build; run exited with code 0 and 0ERRORlog entries).main(1152b9c, 299.5 s)#393(26b70f7, 296.5 s)pool::STAGINGblocks — p50 / p90 / max (MiB)FPSp50#279side, this matches the staging/GTT reduction seen with #279 alone on the same host (p50 320 MiB / max 576 MiB, GTT max7437 MiB).@fsrajner on GitHub · 2026-12-04 08:14 UTC · original
Tested on top of main together with the other PRs listed below. In this scene (the intro, about 2 minutes, 16 GB card) we see no measurable change. A longer run with more texture streaming might show it better.
Setup: RX 9070 XT 16 GB, Ryzen 7 7800X3D, CachyOS, RADV from this repo's
setup.sh. Series X, 3840x2160 output, FSR 4 Quality (4.1.2), RT at defaults, headless gamescope. Same save (the intro); the game stops 120 s after the first press. The figures come from the 5 sstats: framewindows after loading. 2 runs per variant; main =0fd7614. The PR build is main + #382 + #392 + #393 + #408 + #445 + #369 together. #398 was left out because it conflicts with #369 in the residency planning. The #369 merge conflicted only with local counters.VICTORY_TEXTURE_BARRIERS=1VICTORY_CARD_KEPT_MB=9216The first run of main and of the PR build each began by re-preparing shaders after a translator change. That is likely where the 48 ms run and the 82.9 ms worst window come from. Otherwise the spread between runs is about ±1 ms/frame, so all of these are within noise. In this scene the card is the limit (about 21-24 ms of GPU wait per frame).
@Luxuride on GitHub · 2026-12-04 11:28 UTC · original
The fence path reproduces
host::buryexactly —submissions().0 + queue::queued()isnewest_submission()(pool.rs:521-524vshost.rs:384-386), andfinished >= begun + 128is the same testbury()applies (host.rs:388-392) — so reuse is at least as safe as what retirement already drops. Theleast/rested_nowbookkeeping keeps the deque ordered, and the growth/fence arms now hand blocks back tohost::retireinstead of dropping them in place (pool.rs:345-352, thereturn (None, dropped)arms).One ask: say where the 250 ms gets its safety.
pool.rs:95-101asserts "a staging piece comes back with the last list that names it, which has finished by then", and that is only true becauseStagingis dropped throughhost::retirewith_piece(texture.rs:43-49,host.rs:364-367). A future path that drops a list before it finishes turns 250 ms into a use-after-read; naming the dependency (or pinning it with a test) is cheap.Also worth a sentence: 5 s -> 250 ms is a 20x shortening with no switch back, and if you add one it needs both
docs/SETTINGS.mdandrun.conf.defaultor it will not appear in the menu.26b70f7fadto79ee1c2960@cerealfordinner on GitHub · 2026-12-04 22:39 UTC · original
Rebased onto current
mainand applied the two doc tweaks from the review (softened "finished by then" wording and the module-doc staging reference). Branch is up to date.@cerealfordinner on GitHub · 2026-12-04 23:15 UTC · original
Added the dependency you asked for to the
STAGING_RESTdoc: the 250 ms rest is only sound because aStagingis dropped throughhost::retirewith its_piece(texture.rs:43-49,host.rs:364-367), so the last list naming the piece has finished before the block is reused — a path that drops a list before it finishes would turn 250 ms into a use-after-read.cargo check -p victory-gpu --lib --target x86_64-pc-windows-gnuis clean (one pre-existing dead-code warning).View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.