GPU: keep the view-stride table once per list, not per draw stage #1823
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1825"
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?
Imported from Marvisak/VIctory. Originally posted by slatefield on 2026-11-24T23:03:01Z.
Closing on the strength of KainanP's measurement, with thanks. Their
list_bench(#2586,perf/list-call-benchbranch) puts this PR within noise at 1 thread (main 2506/2557 ns per draw vs 2520/2547 here) and unresolvable at 5 threads, which is what the change is worth: oneQueryInterface, oneAddRefand one push per stage that the list usually already holds. Their point that #3379 covers the same ground more generally is right:HostList::keepskipping objects a list already holds removes the same work for the marks table and everything else, and measured -3 to -6% on the stack where this one cannot be separated from zero.The correctness work in here is worth keeping in the record: the
State::cuthazard the triage caught (a cut list keeps the sameStateand records into a freshHostList) was real, and clearingstride_tableinhost_state_lostplusa_lost_host_state_forgets_the_kept_stride_tablecovers it, as KainanP re-checked (230 passed, the two #1744 failures). If #3379 ever needs a hand or the cut path loses its reset, that test is a decent starting point.Branch
slatefield:gpu/keep-stride-table-oncestays up for reference.Imported from Marvisak/VIctory. Originally posted by Melow-code on 2026-11-24T23:05:35Z.
Review: APPROVED
The dedup with a pointer check matches how the pipeline and root signature are already cached in State. One QueryInterface + lock + Vec push per draw is real overhead for titles that set views often. +9/−1, clean.
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T23:47:33Z.
Review: COMMENTED
Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.
View-stride table kept once per list instead of per draw: allocation/cache hygiene in host.rs path. Windows-only.
Imported from Marvisak/VIctory. Originally posted by DesertGamer on 2026-11-24T23:06:33Z.
VIctory V2: community PRs, merged and tested
Open PRs sitting in the queue? V2 pulls them into one build, screens each one (binaries, build scripts, hooks, new deps) and runs tests after every batch.
Where it stands today: launches, runs the menu at 30 fps, plays the intro video, reaches the start screen and loads the world (~50 s). Entering the world is the current blocker: rendering fails with a GPU "device removed" error (tracked in issue #1).
⚠️ Entering the world on a real GPU can hang it and make Windows reset the driver. Try it at your own risk.
Not playable yet, but every batch of merged fixes moves it closer. If you have a PR that's stuck, or a GPU to test on, I'd love your help:
https://DesertGamer/VIctory-V2
Unofficial community fork of Marvisak/VIctory, GPL-3.0.
Imported from Marvisak/VIctory. Originally posted by upipibi on 2026-11-24T23:12:34Z.
NVIDIA run: RTX 3070 8 GB, driver 616.56, Windows 11, debug,
3a3f9a2(onmain70564ae).cargo test -p victory-gpu --locked: 76 passed, 2 failed, 1 ignored. The 2 are the capped-heap failuresmainhas on NVIDIA (#1744:dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_views), so there are no new failures.AI-assisted (Claude Code). Synthetic tests only.
Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-25T05:41:14Z.
Review: APPROVED
Tested
3a3f9a2on Windows 11, RTX 5070, MSVC: builds, clippy-D warningsclean with and without--all-features,cargo test --workspace --no-fail-fast730 passed on our fork main; the 9 failures are the ones that fail on that main without this PR (host validator and environment). I didn't measure the frame-time effect.Reset, andResetXthrough it) runshost.reset(), which drops the kept objects, together withstate.reset(), which restoresState::default(). Sostride_tableempties exactly when the list's holds do.list.reset()calls are internal host lists that carry no titleState.keepcan't leave a bound table unheld.Merged into our fork's main.
AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T06:31:46Z.
Automated triage for the maintainers.
Needs work. This makes
State::bind(crates/victory-gpu/src/draw.rs) calllist.keep(table)for the view-stride table only when the table pointer differs fromState::stride_table.Reply to the author: putting the reset in
host_state_lostis the right place, but the pushed headc65f14bdoes not contain it. Its only changes are the newstride_tablefield and the compare-then-keep inbind.host_state_loststill resets onlyhost_pipeline,host_rootsandhost_heaps, and there is noa_lost_host_state_forgets_the_kept_stride_tabletest on the branch. So the problem from the last review is still there. AfterState::cutstarts a newHostList, the next draw sees the same pointer and skipskeep, and the table can be released while that segment is in flight. Please push the commit that has thehost_state_lostchange and the test. With that, this can be reviewed as a merge candidate.CI: no check runs on the head commit.
Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by slatefield on 2026-11-25T17:17:41Z.
Rebased onto current
main(13f91ca) and force-pushed, sincemainmoved under it indraw.rs: the conflict was only thatStategrew afixed: Fixedfield for the list-cut work, so both fields are kept (stride_tablefrom here, thenfixed). No other change.Windows-target clippy
--all-targets --all-featuresand without: clean. The rebased head merges cleanly, so the triage can re-run. The earlier merge-candidate verdict still describes the change itself.Imported from Marvisak/VIctory. Originally posted by slatefield on 2026-11-25T18:29:07Z.
Right on the cut path, and it is fixed in
c65f14b.host_state_lost()now clearsstride_tableas well, so both thecutpath and the other recorders that call it forget it, and the next draw keeps the table again in the fresh list. I put it there rather than incutbecause that is the one both callers go through, and added a unit test for it (a_lost_host_state_forgets_the_kept_stride_table, no device needed).Windows-target clippy
--all-targets --all-featuresclean. The branch is rebased on13f91ca, one commit, force-pushed.Imported from Marvisak/VIctory. Originally posted by slatefield on 2026-11-26T11:04:20Z.
You are right and the fault was mine: I amended the commit message without staging the file, so
c65f14bonly carried the original change. The real one is now pushed asfdf1ef9(same message, force-pushed):host_state_lost()clearsstride_table, anda_lost_host_state_forgets_the_kept_stride_tableis in the test module.git showon it now has 18 insertions instead of 9, which is how you can tell it is there.Windows-target clippy
--all-targets --all-featuresclean on that tree. Sorry for the noise.Imported from Marvisak/VIctory. Originally posted by Desamodeth on 2026-11-26T21:42:30Z.
Review: COMMENTED
Verified
fdf1ef9merged locally ontomain@63bcca43. The cut path callshost_state_lost()and clearsstride_table. Removing just that assignment made the PR's regression test fail (4096 vs 0). Restoring it passed. Strict Clippy passed forvictory-gpu --all-targetswith default features and diagnostics.CPU-only A/B on a Ryzen 7 9800X3D using two Windows COM memory streams and the same pointer check, QueryInterface, mutex and kept-vector operations. For 8,192 consecutive binds of one table, retained references fell from 8,192 to 1, vector capacity from 64 KiB to 32 B, record time from 116.1 to 2.2 µs and reset time from 35.1 to 0.04 µs per segment. Alternating tables every bind retained 8,192 in both versions (115.3 vs 116.1 µs to record). With two overlapping segments holding the same table, retiring the first preserved the second's reference.
Release build, medians of 12 batches of 48 segments per variant, alternating A/B order. These timings cover CPU reference management only. AI-assisted with Codex Astra 6.2 High.
Imported from Marvisak/VIctory. Originally posted by KainanP on 2026-11-27T12:02:15Z.
List-call numbers for this PR (head
fdf1ef9), ns per draw:Method.
pipeline::list_benchfrom #2586 (fork branchperf/list-call-bench) withVICTORY_LIST_BENCH_SCALING=1: the draw sequence (root CBV, 4 root constants, index buffer, indexed draw that reads 6 textures through a table and 3 root CBVs). Each thread records its own list, best of 5 × 20,000 draws. Each row is the median of 7 interleaved runs, and there were two separate batches of 7 in opposite config order (shown as batch 1 / batch 2). Release--libtest build, RTX 4060 Laptop, Windows 11. Nothing else heavy was running (an editor and a browser, CPU 7–41 % between rounds, no game). The 5-thread row onmainis noisy (single runs from 7.4 to 12.8 µs), so deltas under ~5 % there are not resolvable.Bases.
main=63bcca4+ bench commits. Stack =main+ #1978 + #2821 + #3258 + #3274 + #3275 + rebased #1356 + #3405 (the stack in #2586).Reading it. Within noise in both batches, on both bases. A
keepthe list already has costs aQueryInterface, anAddRefand a push, which is too small to separate from this bench's noise at one per stage. #3379 makesHostList::keepskip any object the list already holds, which covers this table and the marks table. With #3379 alone on the stack, both rows go down (−3 to −6 %), so the two PRs overlap and #3379 is the more general one.Correctness.
cargo test -p victory-gpu --lib(release) on the RTX: 230 passed, 2 failed. The failures are the #1744 heap-cap pair, also failing onmainhere.a_lost_host_state_forgets_the_kept_stride_tablepasses. On the stack: 238 passed, 3 failed, the same 3 as the stack without this PR (the stack itself fails 3: the #1744 pair, plusa_list_lends_a_read_copy_only_while_it_is_the_texturesin the stack's port of #3405. That test passes on #3405's own head, 232/2 here). Clearingstride_tableinhost_state_lostcoverscutandexternal::record, and a titleResetgoes throughState::reset.Not measured. Any game frame.
AI use: Claude Code (Claude Opus 5.5).
Pull request closed