Repository navigation
Conversation
…s a texture only when a barrier is owed Every draw called `list::ensure_state` for each render target and the depth target, and each call took the host copy, cloned its texture, checked the twin, legalised the wanted state and hashed an entry in `states` before finding out the state was already right. A world frame makes ~8,000 draws, most binding the same targets. `HostList` now carries a `states_generation`, bumped whenever `states` gains or changes an entry (and when it is cleared at a reset), and `State::bind` remembers the targets and depth it last ensured together with that generation: while nothing the list named has moved, the loop is skipped. `HostList::transition` also clones the texture only when `track` says a barrier is actually owed, instead of on every call. Verification: `cargo clippy -p victory-gpu --all-targets --locked -- -D warnings` and `--all-features` both clean; `cargo test -p victory-gpu --lib --locked --no-fail-fast` 230 passed, 2 failed — both the known Intel baseline failures pristine main also fails (Marvisak#1744/Marvisak#1829), including the draw tests that exercise barriers through `ensure_state`. `rustfmt --edition 2024 --check` hunks against main: draw.rs 84/84, host.rs 85/85. Synthetic tests only; no game data.
|
Verified head
Not tested: live title workload / draw-loop performance under gameplay. AI-assisted test run and summary. |
Dukestar69
left a comment
There was a problem hiding this comment.
Reviewed the diff and ran local verification on Windows 11 x64 (cargo test -p victory-gpu --lib draw:: -- --test-threads=1: 20/20 passed; cargo clippy -p victory-gpu --all-targets -- -D warnings: clean; cargo xtask policy: 191 files ok).
Deferring copy.texture.clone() in HostList::transition until self.track() actually returns a barrier looks great, but the self.ensured fast path in draw.rs currently never hits whenever at least one target/depth is bound:
- let generation = list.states_generation(); is read before the ensure_state loop, and self.ensured = Some((self.targets.clone(), self.depth, generation)); stores that pre-loop generation.
- Inside HostList::track, self.states_generation.fetch_add(1, Ordering::Relaxed); runs unconditionally on every call (even when the entry already exists and current == wanted).
- As a result, draw 1 reads gen = 0, calls ensure_state (which bumps states_generation to >= 1), and stores �t = 0. Draw 2 then sees list.states_generation() != 0, treats ensured as stale, calls ensure_state again (bumping states_generation again), and clones self.targets on every single draw.
To make the cache actually hit, self.ensured should store list.states_generation() after the ensure_state calls (and HostList::track should only bump states_generation when an entry is inserted or its state actually changes, matching the doc comment). Also consider whether a HostList cut/replacement in State::bind or a depth win::route switch can occur without bumping states_generation.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
…loop, bumped only on a real move Reviewer on Marvisak#3249: two things kept the fast path from ever firing. `track` bumped `states_generation` on every call, even when the entry already held the wanted state, and `State::bind` stored the generation read *before* the ensure loop, so the loop's own bump made the next draw see it as stale. `track` now bumps only when an entry is inserted or its state actually changes, `transition` bumps when a twin route moves the texture's side, and `bind` stores the generation read after the loop. A draw that binds the same targets with nothing moved now skips the loop entirely. Synthetic tests only; no game data.
|
Fixed at |
…:tests::marked_pages_go_back_by_the_bytes_the_gpu_changed under a parallel suite (FIND-20); it passes single-threaded locally on the B580 Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
|
I reproduced a remaining segment-cut cache issue at Two host lists can have identical state-generation counters despite having different state maps. After A focused WARP test reproduced this. The subsequent transition to COPY_SOURCE reported no previous state. Adding I have a focused reproduction and can provide the correction and regression test if useful. |
The memo stored the old host list's states generation; a fresh list after State::cut can read the same counter with different state maps, so a draw could skip ensure_state and the new segment's map never enrolled the targets (a later transition then reported no previous state). Clear it in cut, with a regression test for the equal-counters case. Reported by @TheGrayOrange on Marvisak#3249. Synthetic test only; no game data. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
|
Thanks @TheGrayOrange — reproduced and fixed at Local verification on Windows 11 x64, Intel Arc B580, head
Synthetic tests only; no game data used. |
|
@borosf confirmed the fix at |
|
Confirmed independently on WARP at One cross-reference worth having on this PR: @KainanP's stack in #2586 names #3249 as the place that answers the target transitions' texture clones on the 5-thread path, which is what Also noting @Bj0rnis's RTX 5070 Ti run above (244 passed / 2 failed = the #1744 heap-cap baseline, WARP 246/0, clippy clean) so the three reports sit together. Head unchanged at |
… epoch or the depth state it wants moved since the last draw (VIctory Marvisak#3249 by borosf)
|
List-call numbers for this PR (head
Method. Bases. Reading it. This bench binds no render or depth targets, so it does not exercise the Correctness. Not measured. The targets memo itself (needs a bench row that binds targets), and any game frame. AI use: Claude Code (Claude Opus 5.5). |
The skip rested on claims nothing checked: that a list's states only move in `track`/`reset`, that the memo holds the generation read *after* the ensure loop, and that a bump brings the transitions back. The one test near it set `State::ensured` by hand and returned early without a host GPU, so on CI it asserted nothing at all. Take the ensure loop out of `State::prepare_for` as `State::ensure_targets`, with the transition passed in, and give the generation a real mutator: `host::Generation::bump`, the one `track`, `reset` and the twin route call. The transitions a draw asks for are then counted off the loop itself, headless: two draws with the same targets and depth ask for none the second time, a third target or another depth asks for them all again, and a bump asks for them again until the next pass records the new generation. Reverting either half of the predicate, or storing the generation read before the loop, fails these tests. `Generation` also records why Relaxed carries it: every bump is made by the code recording into the list, and a draw reads it holding the title list's state mutex. Synthetic tests only; no game data. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
… epoch or the depth state it wants moved since the last draw (VIctory Marvisak#3249 by borosf)
… epoch or the depth state it wants moved since the last draw (VIctory Marvisak#3249 by borosf)
Every draw called
list::ensure_statefor each of its render targets and its depth target, and each call paid for the answer "nothing changed" in full.What one call cost
HostList::transitiondid, unconditionally:host_copy(a lock and anArcclone),copy.texture.clone(), a twin check,legal_state(twoGetDescs on some hosts), and astateslock plus hash entry — then returnedNonebecause the state was already right. A world frame makes ~8,000 draws, most binding the same targets.What changes
HostListcarries astates_generation: AtomicU64, bumped wheneverstatesgains or changes an entry, and when it is cleared at a reset.State::bindremembers the targets and depth it last ensured along with that generation, and skips the whole loop while the generation, the depth and the target list are all unchanged.transitionclones the texture only whentrackreports a barrier is owed, instead of on every call.The generation is the soundness argument: any transition the list itself records (targets, or a texture view in
readable) bumps it, so a draw re-ensures exactly when something it named could have moved. A texture released and re-made is a newArcpointer, hence a newstatesentry, hence a bump.Verification
cargo clippy -p victory-gpu --all-targets --locked -- -D warnings— clean;--all-featurestoo.cargo test -p victory-gpu --lib --locked --no-fail-fast— 230 passed, 2 failed, both the known Intel baseline failures pristinemainalso fails (descriptor::host::tests::dynamic_slots_are_held_until_released,memory::tests::lists_share_a_table_and_copies_keep_their_views, Test report: RTX 5070 (Blackwell), Windows 11, 70564ae: 471 passed, 5 failed, 7 ignored (4 from the 1,000,000 view heap cap) #1744/Test report: Intel UHD (Raptor Lake Xe-LP), 70564ae: victory-shader 201 passed, 8 failed (3 missing-feature skips, 5 different results) #1829). The draw tests that drive barriers throughensure_statepass.rustfmt --edition 2024 --checkhunk counts againstmain:draw.rs84/84,host.rs85/85.Per-call cost is arithmetic from the code (one lock + one Arc clone + two
GetDescs + one hash entry ≈ 145–200 ns per call, 40k–130k calls a frame), not a title measurement; the frame line's existing counters are the way to see the delta in a run.Synthetic tests only; no game data.
Part of the fifteen gaps claimed for this sweep on #1633. AI-assisted.