gpu: add a range provenance fixture for bound-range writers #1984
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1991"
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?
Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-24T22:40:04Z.
Adds the source-only example #870 asks for: which producer last wrote the range a draw binds, and whether that write was visible once its submission fence had completed.
Shape. One committed buffer of four 64-element
RGBA32Franges and one bound window. Range A[0, 64)is red, written byCopyBufferRegion; range B[64, 128)is green, written by a draw whose pixel shader stores it through a structured UAV; range C[128, 192)is never written;[192, 256)lies outside every window. The bound range is aStructuredBufferSRV whoseFirstElementandNumElementsselect one range — a buffer SRV is the desktop view that carries an explicit offset and scope, where a 2D SRV has no texel offset at all — and a neighbouring window is the next range along the same buffer.Each producer is submitted and waited on its own fence before the consumer list is recorded, and the completed value is checked at that point. The consumer draws 64×1 pixels, one element of its window each, and copies its target to a readback on the same list; the whole buffer goes to a second readback after the last submission, so the log reports what the producers wrote as well as what the draw sampled. Each case prints one line with the write class, the relation of the bound window to that write, the submission order with its fence values, and the sampled colour.
[0, 64)[64, 128)[0, 64)[128, 192)[128, 192)Result. On an AMD Radeon RX 9070 XT (
1002:7550, driver32.0.32029.2010) and on in-box WARP (10.0.26100.9818) both tests pass: 0 sampled mismatches of 64 and 0 store mismatches of 256 in every case. The stale case is the one that separates the readings — after the blue rewrite is submitted and its fence completes, the whole-buffer readback holds blue in range A while the consumer's readback still holds the red it sampled. Both mutants mismatch 64 of 64: the exact case bound to the neighbouring range samples green instead of red, and the stale case with the rewrite moved before the consumer samples blue.What it says about the reported zero. The cleared and empty cases sample the same colour. A readback alone therefore cannot separate a zero fill from a range no producer wrote, which is exactly the ambiguity the issue raises; the writer class and the submission order are what classify it. This fixture supplies both, per case, so the same two lines can be read off a title run.
What it does not do. No title data, no addresses, no dump: every resource is created by the code. It does not reproduce the RX 590 result and does not, by itself, classify that zero — it makes the classification available from the run that observes it.
Notes.
ps_writeis the first pixel shader in this tree that stores through a UAV (the existing UAV writers are compute and raytracing), so it is the one D3D12 shape here without precedent; it compiles and runs on both backends. The stale case assumes only that the fences are waited on the CPU between submissions, which the fixture does explicitly. Two ranges and one extra window would extend it to a producer that writes the neighbouring range after the consumer, if that case is wanted.AI-assisted.