Repository navigation
Shaders, GPU: a buffer picked from the view heap where the slot holds no buffer view reads a null view of its class (the _Prev meshlet-cull page faults) - #1195
Conversation
|
In game since this opened, on an RX 9070 XT (driver 32.0.32029.2010), relay on, both
Before this, every run here that sent work ahead with both culls running lost the device within about 10 minutes, as did all 15 of GamingRipperDoc's on #3. 1208282 came after those runs: a buffer's own view (made without a description) now keeps the table's entry 0, element size unknown, instead of SKIP, which made heap picks of it read zeros. Not run in game yet. #1216 (@GamingRipperDoc) fixes the same
Either landing is fine with me: I can rebase this onto #1216's marking, or close it and send those two parts as a follow-up to #1216. |
…pler.rs (#1195) (cherry picked from commit 25b1bf3b5fa5f27998b3b3bcfaad58c79fef7423)
1208282 to
7d30344
Compare
…ost's stride table says the slot holds no buffer view The meshlet culls read their records through descriptors they pick from the whole view heap (an s_buffer_load through a V# loaded at an index the program computes). The host's table of strides by slot (t255 space1) told a buffer view (its stride) from anything else (0), and anything else was read as a constant buffer: a slot that holds a texture too. On AMD a constant buffer view is a buffer descriptor, and a texture's descriptor read as one points at its image address shifted right by 8: 13 of the 16 page faults recorded for CS_BatchCullMeshlets_Prev and CS_BatchCullPreSkinnedMeshlets_Prev, with work sent ahead, are such addresses. The table gets a third value, SLOT_STRIDES_SKIP (all bits set), for a slot that holds no buffer view and no constant buffer view. A scalar read through such a slot runs neither load (the buffer load now takes a positive stride) and gives 0. Every other buffer access through a descriptor picked from the heap (typed, raw, structured, constant; loads, stores, atomics) reads the null view of its class the host keeps just below the heap's null slot instead: a raw buffer SRV for reads, a raw buffer UAV for writes, a constant buffer view (NULL_BUFFER_SRV_BELOW, NULL_BUFFER_UAV_BELOW, NULL_CBV_BELOW). The null slot's own view is a 2D texture's, and a 2D view read or written as a buffer is a mismatch not every GPU survives. Textures, samplers and descriptors with no table entry are left as they were. The host writes no SKIP yet and keeps no such views yet (next commit), so nothing changes until then. New heap_tests, on the hardware GPU and on WARP: a scalar read through a slot marked SKIP gives 0, even with data in the slots below the null slot; a vector read there reads the buffer view one slot below the null slot (0 from a null one), and a store there lands in the UAV two slots below it (dropped by a null one); a buffer slot and a constant buffer slot still give their data, and a store through a buffer slot lands.
…extures and empty slots read as nothing The table of strides by view heap slot, which shaders that pick buffers from the heap read (previous commit), said 0 for anything that was not a buffer view, a texture's slot too, and those shaders read 0 as a constant buffer. A slot's entry is now its buffer view's stride, 0 for a constant buffer view, and SLOT_STRIDES_SKIP for anything else (a texture's view, nothing, the dynamic slots), which they read as nothing. The table starts all SKIP. The entry also changed before the slot did: note_buffer wrote the new stride before mirror wrote the slot (made, or null for a buffer view left for its draw), and for that while the new stride sat beside the slot's old descriptor. note_buffer now writes SKIP, and mirror writes the entry once the slot holds its view or a null view of its kind, each behind a full fence (the table's upload memory is write-combined). A buffer view left for a draw still reads its own null buffer view, as before. A record that names no view any more is skipped before its slot is made null. A view heap keeps the null views those shaders read for a SKIP slot (previous commit) just below its null slot: a raw buffer SRV, a raw buffer UAV and a constant buffer view. The title's slots and the dynamic ones end below them, also on a host that caps the heap. Tests: a new heap's table is all SKIP; a slot mirrored with a stride of 16 and then noted with another view reads SKIP until mirror writes it; mirror publishes 16 for a placed structured buffer, 0 for a constant buffer view, SKIP for a placed texture and for a record that names no view; the title's slots end below the null buffer views, capped heap or not.
…nown), not "no buffer view" A shader or unordered view made without a description of a buffer object (the buffer's own view) told the table of strides SLOT_STRIDES_SKIP, "no buffer view", so a shader that picked it from the heap read nothing there. Before this pull request such slots had 0, like every buffer view whose element size the host does not know; they have 0 again. Test: a buffer's own shader view and unordered view give the entry 0 (they gave SKIP).
7d30344 to
daf70f6
Compare
Refs #3: the device removals in
CS_BatchCullMeshlets_Prev(fc5e66f8f873d3bb) andCS_BatchCullPreSkinnedMeshlets_Prev(0452fc2d2e2fc4c3) when work is sent ahead.Cause
t255 space1) said 0 for anything that was not a buffer view, a texture's slot included, and the scalar path reads 0 as a constant buffer._Prevfault addresses decode that way (table in Works on AMD RX 9070 XT (lit opening cutscene) with three AMD-specific pipeline skips #3).Change
SLOT_STRIDES_SKIP(all bits set) for anything else.note_bufferwrites SKIP, andmirrorwrites the real entry only once the slot holds its view, behind a fence.Tests
heap_tests: GFX10 programs lowered, validated, and run on the hardware GPU and on WARP.9a9091d: victory-gpu clippy is clean; victory-shader clippy stops on 7 lints invalu_tests.rsandwave64_after_loop.rs, which this change does not touch, andmainreports the same 7 at the same lines. victory-shader 263 passed. The victory-gpu tests end in an access violation intiles::tests::card_wrote_failure_does_not_poison_card_mask, on this branch and onmainalike.xtask'srepository_passes_policyfails as it does onmain:lower.rsis 527,045 bytes onmain, over the 524,288-byte limit, and this change adds 1,477;host.rs(571,758 bytes, untouched here) is over it on both.In game (RX 9070 XT, both
_Prevculls bound, relay on)amdxc64.dll+0x861b9f) on computef16876929fa64f9f(bvh_skinning:CSComputeSkinningTreeAnimVelocity). That crash is unrelated to this change:victory translate --pipelinesreproduces it onmainwithout this change, with anyVICTORY_SHADER_OPT.Relation to #1095
guard + heap_guard(kind)instead.