gpu: store through two raw UAV address windows #1018
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1025"
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 zohaiblazuli on 2026-11-23T21:58:32Z.
Change
Refs #874. This is the open slice "a raw UAV store through two distinct logical address windows", which I claimed in #874. It builds on #1017, which must land first: the first commit here is #1017's, rebased onto current
main, with a docs conflict resolved by keeping both entries. Review only the second commit,d9c3609.src/raw_buffer_uav.haddsresolve_raw_uav_store, next tomake_raw_buffer_srv. It maps a logical address to the window that contains it and returns a rawR32_TYPELESSUAV covering exactly that window, plus the store's byte offset inside it.D3D12_RAW_UAV_SRV_BYTE_ALIGNMENT), and be a whole number of DWORDs.E_INVALIDARGbefore a descriptor is created.vm_copy_queue_check raw_uav_{warp,hardware}and the CTestsvm_raw_uav_warpandvm_raw_uav_hardware:Storegoes into the last DWORD of window 0 and aStore4lands 24 bytes before the end of window 1, through descriptor-table bindings. Readback of both full buffers must differ from the sentinels in exactly those five words.docs/experiments.mdhas a reproduction entry after the raw SRV entry.No existing behavior changes. The other
vm_copy_queue_checkmodes are untouched.Verification
Branch head
d9c3609onmainat6a09e87. Windows 11 build 26300.10075, MSVC 19.50.35728 x64, Windows SDK DXC. Debug layer off, as in #1017 (the harness doesn't enable it).9/9 passed with
dev, and again withrelease(/O2). Direct runs from the build directory:raw_uav_*raw_srv_hardware10de:2504)8086:a780), selected withXBOX2WINDOWS_ADAPTER=Intelraw_srv_warp) sameThe Intel
raw_srv_hardwarerow is also the independent Intel result requested for #1017 in #874.Mutation check: forcing
FirstElement = 0in the resolver, so the window offset is ignored, failedraw_uav_warpwith 10 mismatching words in each pass. Restoring it passed again.Evidence and follow-up
The shader (
tests/vm_raw_uav.hlsl), resolver and test are original, under the MIT license, and use only synthetic sentinel data. The windows are explicit test inputs and don't come from any title data.Assumptions that need separate evidence:
Store4itself only requires 4-byte alignment.Follow-ups:
Checklist
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T03:15:37Z.
Review: COMMENTED
Audited diff (
a6399891, stacked on#1017) and ran platform-independent checks on Linux (Windows D3D12/DXC build andvm_raw_uav_warp/vm_raw_uav_hardwarewere not executed locally).Linux checks run on
a6399891:python3 -B tests/docs_links_check.py: passed (Checked 13 Markdown files and 221 links.)python3 -B tests/bidi_controls_check.py: passed (Checked 871 tracked source, script and build/CI files: no bidirectional controls.)python3 -B tests/rdna2_tools_check.py: passed (Ran 90 tests in 2.107s,OK (skipped=5))python3 -B tests/resource_root_check.py: passed (Ran 4 tests in 0.255s,OK)python3 -B tests/resource_ranges_check.py: passed (Ran 20 tests in 2.120s,OK)Code audit (
src/raw_buffer_uav.h,tests/vm_copy_queue_check.cpp,tests/vm_raw_uav.hlsl):resolve_raw_uav_storevalidates every window in the array (alignment oflogical_baseandresource_offsettoD3D12_RAW_UAV_SRV_BYTE_ALIGNMENT, DWORD-multiple non-zerobytesfitting inUINTelements and withinresource_width, no 64-bit wrap), rejects partial overlap belowlogical_base, rejects ambiguous/overlapping matches across windows, enforcesoffset <= UINT_MAXandstore_bytescontainment, and leavesresultuntouched onE_INVALIDARG.raw_uavintests/vm_copy_queue_check.cppcovers 7 request refusals, 4 window-control refusals, independent full-buffer sentinel verification for bound stores, and a swapped-bindings negative control.resource_offset/resource_widtherror branches inresolve_raw_uav_store(resource_offset % 16,resource_offset > resource_width,bytes > resource_width - resource_offset) do not have negative test cases inraw_uav, and no GPU dispatch exercises an out-of-window offset atwindow_bytesto verifyNumElementsclipping on the GPU descriptor.AGENTS.mdcompliance: title-neutral wording,docs/experiments.mdupdated.Windows D3D12/WARP/hardware execution remains unverified locally.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T22:09:13Z.
I pushed
a6399891. The resolver now refuses a too-wide shader offset, a misaligned logical base, a wrapping range and an ambiguous window without changing its output. The full-buffer expectation uses positions fixed by the request fixture rather than the resolver's offset. Forcing the dispatch 16 bytes early gave ten wrong words in each pass, then the restored Windows Release run passed 8/8 across the raw UAV/SRV, COPY and provenance checks. Both raw UAV backends reported eleven refusals and exactly five changed words in each pass. This PR still follows #1017.Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-24T00:22:50Z.
Merged the stack onto current
mainand ran the two entries on an RX 9070 XT, since the_hardwareones never run in CI (-E '_hardware$'on both Windows jobs).Merge.
a639989ontod33845b: no conflict (CMakeLists.txtanddocs/experiments.mdauto-merged). The merged tree is3d9e0982, two parents, so any clean merge of those two should reproduce it. Note the API reportsmergeable_stateasunknownfor #1017 right now; that state is about #1017 alone, not about this stack.Result: 4/4 passed, three consecutive runs, build
dev, same numbers each time.On the hardware entry (
device adapter 1002:7550 AMD Radeon RX 9070 XT, driver32.0.32029.2010, DXC1.9.2602.17, Windows 11 26200, MSVC 19.44.35230.0):refused=11is 7 request refusals (d9c3609) plus 4 window controls (a639989), and both areE_INVALIDARGreturns on the CPU side, before any descriptor exists — they are not GPU measurements. Thesevenin thed9c3609message is accurate for that commit, which did not yet contain the four controls.What this does not cover. No dispatch uses an offset at or beyond 2040, so nothing here documents the descriptor's upper bound.
NumElementsisbytes / 4(510), so a store at 2040 is out of the descriptor and dropped — but the test would not notice if that number were too large: the same store would land in the buffer tail that is left at its sentinel (1800 bytes past the window in buffer 0, 1544 in buffer 1), and a widerNumElementswould be accepted just as well. One extra dispatch at offset 2040, or a CPU assertion onFirstElement/NumElements, closes that. Three validity branches inresolve_raw_uav_storealso have no case at all:resource_offset % 4,resource_offset > resource_width, andbytes > resource_width - resource_offset.Scope notes. One physical GPU:
_warpis the WARP software adapter, not a wave-width variation. No production caller yet — both headers are included only bytests/vm_copy_queue_check.cpp. And the PR body says to review onlyd9c3609, buta639989rewroteresolve_raw_uav_store(base alignment, ambiguity, overflow, 32-bit offset) and 45 lines of the test, so what I measured is the final tree; anyone reading the body alone would validate code the PR no longer contains.Revision scope: the harness and
resolve_raw_uav_storewere read; the rest of the suite and the device code were not. 604 entries inctest --preset dev -N, the fourvm_raw_*are 597, 598, 601, 602;git status --porcelainshows only the run logs.AI-assisted.