feat(vk): observe completed GPU write-back differences #2131
No reviewers
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
No milestone
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot!2131
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/wb-diff-observations"
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?
Summary
There is no measurement of how much copied GPU data actually changed, so it is hard to judge whether skipping copies would be safe. This adds optional observations of completed write-backs. It changes no copy decisions and claims no performance improvement.
Coordinated with blessedplummer in #2099; their dirty-origin, urgent/bulk and sparse-mirror work remains separate. Dev-work claim.
Technical changes
RX_VK_WB_OBSERVE=1; regenerate SPIR-V with the pinned glslang 16.6.0.Validation
Current tested head
da2747e1, rebased onto main940eb9ef. The tested-configurations conflict preserves the new main evidence rows and this PR’s earlier benchmark. Production/test blobs are unchanged fromfb8d0c55; focused checks pass again on both systems. Review follow-up uses the sharedenv_onrule, soonandtrueenable observations and off spellings disable them. Production lifetime checks pass for ten unset/off/on forms; all five causal mutations are rejected. Shared C/C++/Python switch and menu-switch checks pass on Windows and Linux. The worklist entry is in Fixed, waiting for a release. Shader source and generated SPIR-V are identical to the GPU-tested7ee371f8; no new game/runtime or overhead result is claimed. Fresh hosted checks are separate exact-head evidence.Earlier validation evidence and limits
At
7ee371f8on6c8c1bfb, four CPU/page checks, lifetime/four mutations and all five actual RTX shader scenarios passed; the main shader passed off parity and rejected missing feedback. Both tested-configuration rows were retained during rebase.Head
6d53c2a7on main4a53c897passed the same focused Windows CPU/lifetime and actual RTX shader checks before this documentation-only rebase.Earlier tested head
bb9944f2, rebased onto main6df80a8d. Both production/test patches are unchanged by range-diff; the documentation conflict preserves both evidence rows.Earlier authored shader execution passed on Linux llvmpipe; lifetime tests and four mutations passed on both platforms. At earlier head
2fe9e4c0, full Linux was 352 / 0 failed / 23 skipped, Windows 341 / 4 failed / 30 skipped: three failures reproduced on the exact base, and one unchanged compiler fixture timed out then passed isolated. Fourteen release-script cases subsequently passed with jq; the aggregate's earlier skipped internal cases are not counted as executed.Six earlier native processes used the
fab8cb37host with candidate edits, clean/off/on/on/off/clean, Kokiri balcony at 4K, FG off and cap 144. Mean source FPS: clean 75.25, off 75.52, on 74.24. On was 1.70% below off; two windows per mode do not establish equivalence or precise overhead. Reports found differences in about 15% of chunks, covering about 13% of compared volume, with zero unavailable chunks. All six exited normally and preserved the checkpoint. These are earlier-host results, not validation of the current rebase.No AMD hardware, physical noncoherent-memory or campaign coverage is claimed. No game-derived files are included.
All current-head checks are green at
d67505a4. The follow-up fixes the Windows fixture's CRT declarations, and the rebase includes main's shared release-fixture race fix (#2130). The GPU/host production patch is unchanged; full previous-head local results and the earlier-host six-run comparison remain labeled separately in the description.This is careful work, and it stays inside what it claims: with
RX_VK_WB_OBSERVEunset, the only changes on the hot path are a uniform branch in the shader, an 8-byte-larger push constant and an early return inwbd_table_get. I checked the parts that could hurt players:gpu/vk/shaders/wb_diff.comp):observecomes from a push constant, and the earlyreturndepends only on the workgroup ID. Bothbarrier()calls are therefore in uniform control flow. Every invocation reaches the final barrier, because both loops run to their bounds. glslang emits them asOpControlBarrier Workgroup Workgroup AcquireRelease|WorkgroupMemory, so the sharedatomicOrresults are visible to invocation 0. On the vector path, the flag followsdiffersper vector, which matches what the vote writes.wb_diff_comp_spv.hwith glslang 16.6.0 using the command in the shader, and it is identical to the committed one.gpu/vk/vk_memory.cpp): results are read only inwbd_table_getoncet.value <= mem_completed, which is the same gate the ring already uses for reuse. They are read before the slot can grow, be freed or be overwritten. The compute→host barrier plusinvalidatecover non-coherent memory. The0xffsentinel makes a missing store invalidate the whole batch instead of reading it as clean. The growth-failure fallback keeps the old behaviour: retry at the ordinary size, or returnnullptrand do whole copies.test_wb_*,test_env_onandtest_menu_env_onpass. CI is green.minor
gpu/vk/vk_memory.cpp:3422:RX_VK_WB_OBSERVEis read asatoi(s) != 0. Since #2042, on/off switches go throughenv_on(this file already includeshookshot_env.hand uses it forRX_VK_LOG_ADDR,RX_VK_TABLE_NOWand others), so as writtenRX_VK_WB_OBSERVE=onor=truewould quietly do nothing.static const bool on = env_on("RX_VK_WB_OBSERVE");fixes it.minor
docs/worklist.md:36: the row is added to Open with you as owner, which fits "put your name in Owner in the same PR that starts the work". But this PR also finishes that work, and the worklist says a merged PR's row moves to Fixed, waiting for a release. Put it there with this PR's link, or nobody will clear it.minor: the branch conflicts with main in
docs/tested-configurations.md(rows added on top). The description could also open with a sentence a player could follow, per CONTRIBUTING (for example, "Nobody knows how much of each write-back actually changed, so we can't tell whether skipping some would be safe"). The current summary gets there, but in its second sentence and in renderer terms.Thanks for the detailed review. Addressed in
fb8d0c55on mainbebb0c64:RX_VK_WB_OBSERVEusesenv_on, the worklist row is under Fixed, and the summary opens with the measurement problem in plain language. The tested-configuration conflict is resolved with both rows kept.The lifetime fixture covers ten off/on forms and five rejected mutations, including restoring the numeric-only parser; shared switch and menu-switch checks pass on Windows and Linux. Shader source and SPIR-V are unchanged from the RTX-tested
7ee371f8. Fresh CI is queued; no new gameplay or overhead result is claimed.All three earlier points are fixed in the head:
env_on("RX_VK_WB_OBSERVE")atvk_memory.cpp:3428, the worklist row moved to Fixed, and the description opens with why. With the switch off, the hot path only gains a uniform branch, 8 bytes of push constant and an early return. Good once the queued CI is green.github-sync referenced this pull request2026-11-12 06:22:54 +00:00