GPU: opt-in exact conventional table CBV upload reuse #1455

Closed
spk-c wants to merge 5 commits from upstream-pr/1455 into main
spk-c commented 2026-11-27 10:18:40 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by spk-c on 2026-11-27T10:18:40Z.


Summary

Add an opt-in list-local cache for conventional table CBV uploads (VICTORY_CBV_REUSE_UPLOAD=1). Only exact source and size matches reuse a prior scratch fill; every recorded step other than Fill invalidates the cache. Limit reuse to non-null, non-overflowing sources and nonzero 256-byte-multiple sizes up to 64 KiB. No card-fill changes, direct memory binding or UMA dependencies. Original fallback preserved for other sizes.

This is independent of root-view reuse (VICTORY_LIST_REUSE). Coordinate with #1403, which changes the adjacent scratch bounds path; neither change is required to compile this branch.

Validation

Based directly on 9a9091d. Local Windows package all-target/all-feature check completed and 2 targeted CPU regression tests passed (exact keys, copy/callback/reset barriers and size eligibility). Diff check passed. No gameplay FPS gain claimed. The standalone port now has explicit hardware coverage (below).

AI-assisted, adapted from spk-c/victory-fork 81b46a9.

Shared CI baseline repair

The original CI failure is inherited from upstream 9a9091d. This branch now includes the original shader lint fix from #1440 (7238c55, original authorship retained) and a shared current-main adaptation of the module-splitting approach in #1357 (584efbb). No policy limits or security checks changed. The shared baseline passes both full workspace Clippy configurations with warnings denied and the 248-file asset policy; this exact feature head passes local package Clippy in both configurations and asset policy. The upstream full CI is being rerun. These are shared prerequisites rather than part of the feature; they will disappear from the diff when merged into main. No hardware/gameplay claim.

RTX 4090 hardware validation (2026-11-27)

The added opt-in ignored test hardware_exact_table_cbv_upload_replay passed in separate processes with VICTORY_CBV_REUSE_UPLOAD=0 and 1 on a real NVIDIA GeForce RTX 4090 (not WARP). Three ordinary scratch uploads became two; the computed shader output matched for duplicate inputs, a CPU write/callback barrier, the final vector and two executions of the same recording. No device removal. The added test compiles with all features and passes strict package Clippy and asset policy. This is a functional hardware A/B, not a gameplay throughput claim. The new test-only commit reruns CI.

<!-- greyfinch-sync:fxceless/victory-fork:issue:5524950045 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1455). Originally posted by [spk-c](https://github.com/spk-c) on 2026-11-27T10:18:40Z. --- ## Summary Add an opt-in list-local cache for conventional table CBV uploads (`VICTORY_CBV_REUSE_UPLOAD=1`). Only exact source and size matches reuse a prior scratch fill; every recorded step other than Fill invalidates the cache. Limit reuse to non-null, non-overflowing sources and nonzero 256-byte-multiple sizes up to 64 KiB. No card-fill changes, direct memory binding or UMA dependencies. Original fallback preserved for other sizes. This is independent of root-view reuse (`VICTORY_LIST_REUSE`). Coordinate with #1403, which changes the adjacent scratch bounds path; neither change is required to compile this branch. ## Validation Based directly on `9a9091d`. Local Windows package all-target/all-feature check completed and 2 targeted CPU regression tests passed (exact keys, copy/callback/reset barriers and size eligibility). Diff check passed. No gameplay FPS gain claimed. The standalone port now has explicit hardware coverage (below). AI-assisted, adapted from spk-c/victory-fork `81b46a9`. ## Shared CI baseline repair The original CI failure is inherited from upstream `9a9091d`. This branch now includes the original shader lint fix from #1440 (`7238c55`, original authorship retained) and a shared current-main adaptation of the module-splitting approach in #1357 (`584efbb`). No policy limits or security checks changed. The shared baseline passes both full workspace Clippy configurations with warnings denied and the 248-file asset policy; this exact feature head passes local package Clippy in both configurations and asset policy. The upstream full CI is being rerun. These are shared prerequisites rather than part of the feature; they will disappear from the diff when merged into main. No hardware/gameplay claim. ## RTX 4090 hardware validation (2026-11-27) The added opt-in ignored test `hardware_exact_table_cbv_upload_replay` passed in separate processes with `VICTORY_CBV_REUSE_UPLOAD=0` and `1` on a real NVIDIA GeForce RTX 4090 (not WARP). Three ordinary scratch uploads became two; the computed shader output matched for duplicate inputs, a CPU write/callback barrier, the final vector and two executions of the same recording. No device removal. The added test compiles with all features and passes strict package Clippy and asset policy. This is a functional hardware A/B, not a gameplay throughput claim. The new test-only commit reruns CI.
KainanP commented 2026-11-27 15:13:47 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by KainanP on 2026-11-27T15:13:47Z.


Independent A/B of this PR on the RTX 4060 Laptop, against main 9a9091d (its base).

Bench: pipeline::list_bench::table_bench (KainanP/victory-fork bench/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.

build 1 thread 5 threads (per thread)
main 9a9091d 10,244 14,332
PR c966ddc, VICTORY_CBV_REUSE_UPLOAD=1 10,216 15,257

An earlier run of 7 agrees: main 11,990 / 22,095, PR off 12,563 / 24,454, on 11,733 / 23,929. Single runs spread by ±30 % on this machine.

So the recording threads see no difference beyond noise. Your saving is the scratch fills at submission, which this bench does not time. In the bench's tables (1 constant view and 5 textures), the constant view is about 0.6 µs of a table, while the texture views are about 10 µs and making the entries readable about 6 µs (diagnostics build).

Correctness. With VICTORY_CBV_REUSE_UPLOAD=1:

  • our tables_show_their_views passes (every texture slot of the tables made for 64 draws, over three lists, holds the descriptor the host makes of its view, and its host texture);
  • exact_table_cbv_cache_stops_at_non_fill_steps and table_cbv_reuse_only_accepts_bounded_aligned_sizes pass;
  • hardware_exact_table_cbv_upload_replay passes with =0 and with =1 on the RTX 4060 Laptop.

For the texture-view part: #1484.

AI use: Claude Code (Claude Opus 5.5).

<!-- greyfinch-sync:fxceless/victory-fork:comment:7221792856 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1455#issuecomment-7221792856). Originally posted by [KainanP](https://github.com/KainanP) on 2026-11-27T15:13:47Z. --- Independent A/B of this PR on the RTX 4060 Laptop, against `main` 9a9091d (its base). **Bench:** `pipeline::list_bench::table_bench` ([KainanP/victory-fork `bench/desc-tables`](https://github.com/KainanP/victory-fork/commit/8099f728afae8ed80ac4deff2f471ae3683aa589), `#[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. | build | 1 thread | 5 threads (per thread) | |---|---|---| | `main` 9a9091d | 10,244 | 14,332 | | PR `c966ddc`, `VICTORY_CBV_REUSE_UPLOAD=1` | 10,216 | 15,257 | An earlier run of 7 agrees: `main` 11,990 / 22,095, PR off 12,563 / 24,454, on 11,733 / 23,929. Single runs spread by ±30 % on this machine. So the recording threads see no difference beyond noise. Your saving is the scratch fills at submission, which this bench does not time. In the bench's tables (1 constant view and 5 textures), the constant view is about 0.6 µs of a table, while the texture views are about 10 µs and making the entries readable about 6 µs (diagnostics build). **Correctness.** With `VICTORY_CBV_REUSE_UPLOAD=1`: - our `tables_show_their_views` passes (every texture slot of the tables made for 64 draws, over three lists, holds the descriptor the host makes of its view, and its host texture); - `exact_table_cbv_cache_stops_at_non_fill_steps` and `table_cbv_reuse_only_accepts_bounded_aligned_sizes` pass; - `hardware_exact_table_cbv_upload_replay` passes with `=0` and with `=1` on the RTX 4060 Laptop. For the texture-view part: #1484. _AI use: Claude Code (Claude Opus 5.5)._

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
fxceless/victory-fork!1455
No description provided.