GPU: let card-buffer readback flag 4 or 16 KiB at a time #1164
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!1164
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1164"
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?
@UwUCammie on GitHub · 2026-11-25 22:15 UTC · original
UwUCammie:pr/card-hash-piece→main· +139 −82 · 3 files · 3 commits · openChanging a few bytes in a card-resident buffer flags a whole 64 KiB piece for readback.
VICTORY_CARD_PIECE_KB=4|16|64lets the compare, hash table and fetch plan use smaller pieces. The default is still 64. The CPU snapshot and write-watch pages keep their original size. In-flight fetch slots still have room for the maximum piece.On an RX 7900 XT (RADV 26.3.1, Wine 11.22), all seven card-span and ticket tests passed at each size. I also ran the compare and in-flight fetch tests at all three sizes with a local harness selecting the physical D3D12 adapter. All six runs passed, including the writes that changed back and the fetch with an unaligned buffer base.
I ran the same integration binary at all three sizes on the RX 7900 XT. The only setting I changed was the piece size. All three runs finished the 230-second session. These are the complete measurement intervals between 150 and 225 seconds in the first room.
This integration build used the parallel compare. A second run of the same executable and route measured 538 presents in 73.74 s at 16 KiB (7.30 FPS, 4,867 draws/frame) and 610 in 74.02 s at 64 KiB (8.24 FPS, 4,870 draws/frame). Pooling the two runs for each size gives 8.71 and 8.60 FPS respectively. The switch reduced readback volume in the first comparison. These frame-rate measurements do not establish a reliable winner. The same-scene image comparison is still open.
Updated against
6d20eedafter #1014 merged. Both the one-thread and 64-thread hashes now use the chosen piece size. On the physical RX 7900 XT, all three D3D12 fixtures passed for both hashes at all three sizes (18 cases). They cover changes that are restored, shifted buffer bases and ranges that begin at a later piece, and fetching changed pieces through the ticketed readback slots. The 30 shadow tests passed under Wine.@alpz1000 on GitHub · 2026-11-25 22:24 UTC · original · edited 2026-11-25 22:45 UTC
Windows / RTX 3060 follow-up. I combined the piece-size change from
d3b2bb9with the group-per-piece shader from #253 and verified both sizing and shader behavior. The wide shader uses the same piece-size constant as the scalar shader and fetch plan, and dispatches are split at the D3D12 group limit.All three settings (4, 16 and 64 KiB) passed the WARP compare and fetch cases, the wide-shader change-detection case, and the seven card-span and ticket tests.
I also timed the group shader on an RTX 3060 12 GB, driver 610.88, using generated data in a D3D12 DEFAULT-heap buffer. Medians of nine batches per setting, 16 hash dispatches per batch, with a UAV barrier between dispatches:
The table isolates GPU hashing. It does not measure readback volume or frame time.
Full renderer follow-up on the same Windows and RTX 3060 setup. A warmed 16 KiB run averaged 4.80 FPS over 564 frames at a stationary checkpoint, with a median 30.9 MiB copied back per frame. An earlier 64 KiB run with #253 averaged 4.90 FPS over 449 frames and 35.9 MiB copied back per frame. The 16 KiB build also included the placeholder/guard patch and reduced texture preload limits, so these numbers are a directional comparison across configurations. Visual rendering reached the checkpoint in the 16 KiB run.
AI-assisted with OpenAI Codex.
@Proudnoob4 on GitHub · 2026-11-25 23:17 UTC · original · edited 2026-11-25 23:26 UTC
AI-assisted (Claude Opus 5.5 in OpenCode), measured on my own machine. This replaces two overlapping AI-written reports I posted here earlier; on re-auditing the logs, some of their numbers were single samples or misattributed, and one said there were no visual artifacts, which was wrong.
Setup: RTX 4080 16 GB, Windows 10 22H2, Series X build, diagnostics release, prison-cell scene (~4,800 draws/frame). Three single 360 s runs, so this is a bundle comparison, not an isolated A/B:
Marvisak/VIctory#2825native f16#1168+#1147+#1164(VICTORY_CARD_PIECE_KB=16) +#1171+#1172+ a local commit (skip cleancard_dirtycopies; chunk wide compare dispatches to ≤ 65,535 groups)all other lists), 2nd-half mediancardmeter, 256-frame mean, steadycardmeterunchanged). Which of C's additions gave the 8 ms is not isolated.For this PR: with 16 KiB pieces, copy-back bytes fell ~19% (60.9 → 49.4 MB). But pieces fetched and writes back both tripled (~1,388 → ~4,138), and copy-back time rose 22.4 → 28.4 ms. On this CPU-bound setup that is a net loss. A suggestion I haven't tested: coalescing adjacent dirty pieces into one fetch or write-back might keep the byte saving without the per-piece cost. C was the only run with 16 KiB pieces, so this PR is a suspect for the artifacts above, not proven. The ≤ 65,535-group chunking in our local commit came from reading the code: 16 KiB pieces over a buffer larger than 1 GiB would pass the D3D12 per-dimension dispatch limit with
VICTORY_CARD_HASH_WIDE=1. We did not hit it in game, and HASH_WIDE was off in these runs.@UwUCammie on GitHub · 2026-11-26 13:53 UTC · original
@Proudnoob4 Fixed the group-count limit you flagged in
a8306950. Both the initial hash and the later comparison split at 65,535 X groups. Each chunk advances the hash index and the output flag address. The boundary regression passed under Wine in both shader layouts, including one piece beyond the limit and a span covering three dispatches.Your 16 KiB result also matches the tradeoff we saw: fewer readback bytes can still cost more when there are more pieces to land. I’m keeping that setting opt-in. Your artifact run had the wide hash off, so the dispatch fix doesn’t explain those tiles.
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.