Try GPU upload heaps for descriptor stride tables #887
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/fxceless--victory-fork!887
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-887"
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?
@Lkxex on GitHub · 2026-11-25 11:53 UTC · original
Lkxex:exp/gpu-upload-descriptor-strides→main· +107 −16 · 3 files · 1 commits · draftExperiment
Try placing the descriptor-stride table in CPU-visible VRAM on a supported discrete GPU. The table is 8 MiB per view heap and lives with that heap. Descriptor updates write it from the CPU, and shaders read it through a root SRV. The experiment moves GPU reads of this table to local memory. CPU updates still cross PCIe.
VICTORY_GPU_UPLOAD_STRIDES=1enables the trial for stride tables. It checks the D3D12 architecture and GPU upload capability, leaves 10% local-budget headroom at allocation time, and falls back to the ordinary upload heap when support, room, or allocation is unavailable. The experiment is off by default.Validation and measurement
cargo check --locked -p victoryandgit diff --checkpassed. Validation used synthetic tests.descriptor stride table in CPU-visible video memorylog. Compare the same scene after shader warm-up with and withoutVICTORY_GPU_UPLOAD_STRIDES. Record frame time, GPU time, and local memory use. KeepVICTORY_QUEUE2and the copy-back settings fixed between runs. The PCIe read/write trade-off and frame-time effect remain unmeasured.Microsoft GPU upload heap specification · NVIDIA GPU upload heap guidance
AI-assisted change.
@eazyves on GitHub · 2026-11-25 12:36 UTC · original · edited 2026-11-25 13:06 UTC
The GPU upload path works on an RX 9070 XT (RDNA4): here the table lands in a GPU upload heap.
fbecee4, driver 32.0.32029.2010, Windows 11 26200, Ryzen 7 5800X3D.descriptor_stride_upload_maps_and_keeps_the_standard_fallbackprints heap type 2 withprefer_localoff and 5 (GPU_UPLOAD) with it on, and passes, also withVICTORY_D3D12_DEBUG=1in a diagnostics build.A temporary test (not committed, release build) on an 8 MiB table, the heaps alternating, 6 measurements each:
So filling in order costs about half as much again, and single slot writes cost the same here. These are CPU write times only. I did not measure shader reads, and I did not run the title, so nothing here says what it does to the frame time.
With
VICTORY_GPU_UPLOAD_STRIDES=1, all 28descriptor::tests pass with the debug layer on. In 10 serial runs of the diagnosticsvictory-gpulib tests with the switch and 10 without, the only test that failed waswarp_budget_saturates_..., which fails onmaintoo (#849).From the diff: I found no CPU read of the table, only the zeroing and the slot write in
descriptor/host.rs(around line 1603). And the description asks for supported NVIDIA hardware; AMD qualifies here as well.Edit: other GPU tests and a large file copy from another session of mine may have been running on this machine at the time, so treat the write times as rough. The heap type and the data check don't depend on that.
No game data. AI-assisted (Claude Code); run on my machine.
@sawetco on GitHub · 2026-11-25 21:35 UTC · original
I tested the two GPU source changes from
fbecee4on an RTX 5070 (12 GB, 621.24), Ryzen 5 7600X, Windows 11 build 26300. The driver accepted both allocation types. The unit test reported heap type 2 with placement off and 5 with it on. Each enabled game run logged one 8,388,608-byte descriptor-stride table in CPU-visible video memory.Shader reads after a CPU update were substantially faster on the GPU upload heap in an isolated D3D12 test. The compute shader reads each dword of an 8 MiB table once and produces 32,768 hashes. These are median GPU timestamps in microseconds over six measurements per cell, alternating heap order. The static warm-up uses the same shader. The update changes one dword per 256 bytes, in permuted order, with fresh values each time.
The CPU update itself took a median of 247–252 µs across these cases. All 2,359,296 result hashes across 72 timed dispatches matched the CPU reference, including a third precondition that wrote a separate 128 MiB GPU buffer. The synthetic access pattern deliberately touches the entire table. Actual shaders can use a much smaller subset.
Gameplay on this downstream build gave mixed results. I applied the PR's two source-file hunks without edits to a local build based on
vitutu1/victory-perf@97c3aa2with the water and face fixes. Both settings used the same binary, a fresh copy of the same house save, 4,068 warm shader files, two pipeline-cache files, Series S at 0.5 render scale, andVICTORY_REBAR=0for guest-memory windows.These are 127 complete host Present intervals per run between frames 1920 and 2048, with Jason viewed side-on at the same porch in all eight endpoint images. I chose that window after checking the captures. The originally planned start at frame 1632 was still a loading transition in two runs. Idle animation, streaming and shadows varied. The direction of the gameplay difference reversed across pairs. This supports keeping the option available for targeted A/B tests.
A separate instrumented build also found redundant CPU stores while loading. The stride table starts at zero, and the heap already tracks which slots hold buffers. Omitting the zero store only when both the previous and new slot are non-buffers skipped 317,153 of 737,632 eligible store calls in one loading window (43.0%). A later black-screen-to-porch window skipped 466,915 of 959,757 (48.6%). Buffer-to-texture transitions still explicitly cleared the slot. The local slot-reuse test passed. A separate porch timing pair showed 5.49 vs 5.09 presents/s with suppression, so the counts alone do not justify enabling this change.
Standalone shader-read probe (C++, Windows SDK 10.0.26100, no game files)
Build in a Visual Studio x64 developer prompt using the command in the file header. The program prints CSV, checks both actual heap types and compares each GPU result with the CPU reference.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.