GPU: once the BVH builder runs, its title-memory accesses miss host copies every frame, and 5552dac6a2b7a1fd writes 4 GiB above real buffers #3486
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory#3486
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@ZeOs360 on GitHub · 2026-11-27 08:04 UTC · original
A standalone issue, as suggested on #2118 for
5552dac6problems. Not a blocker for #2118 itself.Setup: RX 7800 XT, 16 GB RAM.
main63bcca4with #2118 at999a8f6, #2098, #2703, #2841, #2810, #2501, plus a few unrelated open PRs and a local memory-placement change. All 53 builder pipelines are made, none dropped, and the builder runs; no device hang in a 15-minute run.What happens: from the frame the builder starts, nearly every frame's title-memory work misses memory that has no host copy (722 of 723 frames in one 15-minute run; 81 of 658 in a run of the same build without the RT PRs). So the builder's writes are withheld every frame, and its results never reach title memory.
main's withholding does its job: no crash, but no usable BVH either.What we found:
5552dac6a2b7a1fd(42 of 96 distinct shader/program-offset sites in one run, logged with a local diagnostic that records the shader, program offset and address of missed writes). Some go into the builder's own buffers, which have no host copy yet when it runs: nothing tells us the build's destination and scratch ranges before the dispatch, so copies only appear later, from views.real address + 4 GiB - X). The same program offsets write both the real buffers and the +4 GiB addresses, so this looks like a bad value (for example a node pointer read back as 0 or stale, giving a 32-bit index that underflows) rather than one mistranslated instruction. In one run with on-demand copies (below), 107 of the last 512 pages written back were exactly 4 GiB above a 90 MiB buffer that had a host copy.5552dac6came in frames where nothing else missed. Their cause is still open.Two dead ends, to save others time:
s_waitcnt_vscnt/buffer_gl*_invto UAV fences passes a synthetic cross-workgroup test, but changes none of the above in game.image+0x4de96dd,+0x4dd64ec,+0x4debfde).So the build's destination and scratch ranges probably need host copies before its first dispatch to get past
main's withholding, and the +4 GiB writes from5552dac6still need their own fix. Whether they relate to the5552dac6device hang reported on #2118 (RTX 4090) is not known.AI-assisted: found with Claude Code (Claude Opus 5.5) and Gemini 4 Neon. I ran the builds and the in-game tests on my machine.
@Ingenioeren on GitHub · 2026-11-27 09:41 UTC · original
I checked whether the upstream title-memory lookup can confuse two addresses with the same low dword. A synthetic extension of the existing memory test on
63bcca4placed different sentinels in separate buffers at0x12_3450_0000and0x13_3450_0000, exactly 4 GiB apart. The RX 6750 XT and Windows WARP agreed in both runs.0x111111110x444444440x11111111Both tests kept the second backing buffer intact. This verifies lookup and miss tracking for addresses the shader already computed. The builder's address calculation and the patch stack in the report are outside this test. For the next diagnostic, the low and high dwords fed into the memory instruction would distinguish a high address already computed by the shader from a discrepancy later in the lookup. Synthetic test base · Region index calculation
AI-assisted synthetic verification with OpenAI Codex.
@ZeOs360 on GitHub · 2026-11-27 16:10 UTC · original
Thanks for testing this. It rules out the lookup: the +4 GiB address must already be in the 64-bit value the shader hands to the memory instruction, which fits the "bad value" reading above (a pointer or index read back wrong and underflowing), not the region mapping. Logging the low and high dwords there is the right next step. Ray tracing is parked on my side for now, so I can't say when I'll get to it.
AI-assisted (Claude Code).
@Slay326 on GitHub · 2026-11-27 16:42 UTC · original
A data point that may fit the "bad pointer/index" direction, from our fork (RTX 3070 and RTX 4070, Windows, offline harness replaying captured builder submissions):
Two of the BVH builder programs,
caa78b8ca62bc3d6and28918b7150a7aad5, are the onlyDispatchXcallers we see whose flags lack bit0x8000(flags0x20; the two other callers,4ddd6f97and5062bc7a, use0x8020). For those two,xbehaves like a thread count, not a group count (x ranged 1..1038 and 1..11632 in a 120 s run). Launchingxgroups of 64 lanes lets the surplus lanes run and write.What we measured in the harness on the same capture:
xwrote 2961 bytes outside the expected range between two consecutive builder dispatches, and the root node of a rehydrated bottom level ended up asffffffffx4.>= xmasked off (exec limited to global id < x, ceil(x / group size) groups), 0 bytes outside, the root kept its children, and valid rehydrated bottom levels went from 0/47 to 67/87.If your builds launch these two programs the same way, masking lanes
>= x(or dispatching ceil(x / group size) groups with the tail masked) might be worth a try against the out-of-range writes you see. We have not tested AMD hardware and cannot say whether it explains your 4 GiB writes.AI-assisted.