GPU: reuse submit-time snapshots for repeated table CBVs #1313
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1316"
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 fxceless/victory-fork. Originally posted by ByFxbian on 2026-11-26T14:06:36Z.
Summary
Reuse submit-time constant-buffer snapshots when multiple descriptor table
bindings reference the same source range within a recording epoch.
Opt-in via
VICTORY_CBV_SNAPSHOT_REUSE=1(off by default).The existing copied snapshot semantics, shader ABI and shader cache
compatibility are preserved.
Changes
avoided bytes and invalidations.
Performance
Windows, Ryzen 5 5600X, RTX 3070 8 GB, 32 GB RAM, ReBAR enabled.
22,000 synthetic constant-buffer bindings through the production
descriptor-table path.
Median CPU preparation and enqueue time:
With 64 distinct sources:
With entirely unique sources, median recording time increases from
36.288 to 40.761 ms. The benefit depends on the actual reuse rate,
which is why the optimization remains opt-in.
Validation
event-log permission failure.
Gameplay testing
No gameplay FPS improvement is claimed.
An A/B test with
VICTORY_CBV_SNAPSHOT_REUSE=0and1wouldestablish the actual reuse rate and whether the reduction in submission
work outweighs the recording overhead.
Related work
Imported from fxceless/victory-fork. Originally posted by grosterr on 2026-11-26T21:45:13Z.
A heads-up for whoever merges this together with #860: the two do not conflict textually, but the result does not compile its tests. #860 changes
fill_ahead::on()tofill_ahead::on(src, len)(whether a fill oflenbytes atsrcmay read ahead). This PR'scopy_join_title_work_reset_and_pending_gpu_write_preserve_cbv_snapshotsstill callsfill_ahead::on():With #860 in, the test should ask about the same fill that
blocked_bylooks at, the 256 bytes ataddress:With that one change, all 290
victory-gpulib tests pass on our tree (fork main52ac4ec+ #1316 + #860 + others, Windows, RTX 3060). The release build is not affected, since only the test calls it that way.Imported from fxceless/victory-fork. Originally posted by akimfomin on 2026-11-26T22:15:37Z.
A source check against Zignixx’s current
nvidia-wip(90fe3144a4c5fe8ca4e6ce1b5f0e42f4fb28696b) found that it does not containVICTORY_CBV_SNAPSHOT_REUSE. Applying this PR’s58de9bf..c5b0898delta in a three-way check conflicts incopystat.rs,draw.rs,host.rsandlist.rs. This is separate from grosterr’s #860 test helper note.For the gameplay comparison mentioned in the description, I prepared a matched six-run checklist and tested the aggregate script on fixed inputs. It reports frame times and 1% lows plus the fraction of eligible lookups that hit. It flags missing ON diagnostics. I shared the optional check in #1379 with one person who already ran the scene. No scene result yet. Checklist and reproduction
AI-assisted source comparison and test tooling (Codex).
Update: I built the pinned diagnostic head and independently ran the same synthetic regression with reuse OFF and ON on RTX 4070 Ti SUPER (617.14). Both passed. Exact build, per-case measurements and analyzer controls. The game-scene A/B remains open.
Imported from fxceless/victory-fork. Originally posted by KainanP on 2026-11-27T15:13:45Z.
Independent A/B of this PR on the RTX 4060 Laptop, against its own merge base
58de9bf(the PR is 43 commits behindmainand conflicts).Bench:
pipeline::list_bench::table_bench(KainanP/victory-forkbench/desc-tables,#[ignore]) ports the draw sequence of our VIctory list bench to the fork. Each draw binds a material table (one constant buffer view and five textures the title placed in memory), and each table sits at its own place in the title's heap. A list has 2,000 tables, and half of them repeat the contents of an earlier one, as in #1379. A list is closed (timed) and reset every 2,000 draws. Cells are ns per draw for the whole sequence (table, root CBV, 4 constants, index buffer, draw), each the median of 7 interleaved processes, each process the best of 5. RTX 4060 Laptop, i7-14650HX. A headless Chrome from other work used about 2 cores. This bench times recording only: lists are not submitted, so fills done at submission do not show here.58de9bfc5b0898, switch offVICTORY_CBV_SNAPSHOT_REUSE=1An earlier run of 7 gave the same picture: base 11,919 / 24,308, on 12,107 / 26,944. The PR with the switch off was 20,439 / 29,379 in that run, but its single runs ranged from 11.5 to 34 µs, so that cell is noise.
So on the recording threads it is neutral within noise. That is expected: the saving is the snapshot fills at submission (your 22,000 → 64 fills), which this bench does not time. It does not touch the part #1379 measured as most of the 18-21 µs. In a diagnostics build here, of a 6-slot table, the five texture views take about 10 µs, making the entries readable about 6 µs, and the constant view 0.6 µs.
Correctness. With
VICTORY_CBV_SNAPSHOT_REUSE=1:tables_show_their_viewspasses: every texture slot of the tables made for 64 draws, in three lists, holds the descriptor the host makes of its view, and holds its host texture;a_cut_records_a_new_snapshot_even_with_the_same_table,constant_snapshots_observe_copy_epochs_and_fall_back_for_partial_viewsandcopy_join_title_work_reset_and_pending_gpu_write_preserve_cbv_snapshotspass;bench_cbv_snapshot_bindingsstops at its precondition here (it needs SM 6.6dxil.dllandVICTORY_LATE_WAIT=3), so I did not run it.For the texture-view part, #1484 copies views from a cache with exact invalidation: −20 % table time at 1 thread, −27 % at 5.
AI use: Claude Code (Claude Opus 5.5).
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.