Repository navigation
d3d12: preserve GPU writes to adjacent buffers in either address order - #2352
ecox982745 wants to merge 2 commits into
Conversation
Merge all touching intervals under their lowest address. Charge only the newly covered bytes before changing the per-submission map. Check both GPU dispatch orders and the untouched words in two adjacent buffers. AI-assisted by OpenAI Codex (GPT-6).
lixonik
left a comment
There was a problem hiding this comment.
Built this head with MSVC and ran d3d12_title_va and d3d12_title_va_shadow on Windows 11. Both passed, including adjacent buffer GPU writes in both address orders. GPU: NVIDIA GeForce RTX 5070, driver 610.88. No findings from these checks.
AI-assisted.
|
Thanks for the RTX 5070 run. The two named CTests exercise the general title-address and shadow paths. The adjacent-buffer checks run in a separate CTest, ctest -V -R "^d3d12_placed_write_back$"I reran that target on an RTX 4090 after #2356 changed the runtime defaults. With the PR fixture on unpatched AI-assisted verification by OpenAI Codex (GPT-6). |
|
I tested #2352 together with #2404 on a physical RTX 4090 under Windows 11, with Vulkan validation enabled. Both changes applied cleanly to
All eight related CTests passed on the combined build, covering title addresses, shadow buffers, geometry views, title-window limits, and write-back. The test log contained no Vulkan validation errors. These were synthetic GPU tests. A story-mode run is still needed to establish the gameplay impact. |
|
#2352 still applies cleanly after #2404 entered main. I verified On that tree the exact entry point is |
|
I ran the requested CTest on the exact integration tree I also extended the fixture locally to three adjacent 64 KiB buffers on one allocation. Each order ran in a fresh process. Here 0, 1, and 2 are the low, middle, and high buffers. A passing run matched all 49,152 words, including those outside the three write regions.
For All eight title-address and write-back CTests passed on the integration, along with the three existing-heap variants. Those three variants logged |
…sion helper Use the existing shader table to select a distinct four-word input for each address order. Keep the full-allocation readback and reuse the helper from upstream instead of changing its call convention. AI-assisted-by: OpenAI Codex (GPT-6)
lixonik
left a comment
There was a problem hiding this comment.
Reviewed head b27c441f9 and re-tested on Windows 11 + NVIDIA GeForce RTX 5070 12 GB (MSVC 19.44, Ninja Release).
note_title_write_back()cleanly merges all overlapping/adjacent ranges[first, last)in either address order, charges only newly covered bytes (added_bytes = (merged_end - begin) - replaced_bytes) with an overflow-safe cap check (added_bytes > kTitleWriteBackBytes - title_write_back_bytes), and replaces the merged span viainsert_or_assign+erase.- Built
d3d12_title_va_testand ranctest --output-on-failure -V:d3d12_title_va: passedd3d12_title_va_shadow: passedd3d12_title_window_write_back: passedd3d12_placed_write_back: passed (0.19 s; both upper-first and lower-first adjacent buffer writes merged into one 128 KiB range and matched expected words).
GPUs tested: NVIDIA GeForce RTX 5070 12 GB (Windows 11, driver 610.88, Vulkan 1.4.341; VK_LAYER_KHRONOS_validation not installed locally).
AI-assisted (Antigravity, Gemini).
|
Physical RADV gfx906 (fixed subgroup 64), Wine, synchronization validation enabled. I ran the same The registered placed-write-back, window-write-back and shadow-keep/refill CTests went from 2/3 to 3/3; no validation errors, synchronization hazards or device loss in either build. AI-assisted. |
Claimed as RT-TITLE-WRITEBACK-ADJACENT-RANGES. This is the follow-up requested after #2129 landed.
Depends on: #2129 (merged into
mainthrough #2350).What changed
When a submission wrote two adjacent placed buffers in descending address order, the queued interval kept the higher starting address. The lower buffer’s GPU results never reached the CPU pages. The tracker now merges touching and overlapping intervals under their lowest address and charges only newly covered bytes against the per-submission cap.
The GPU regression writes two adjacent 64 KiB buffers in one command list. It checks both address orders with different expected values, then checks every word in both buffers, including all 32,640 words outside the written portions.
Verification
mainatfbf100b1b, the new RTX 4090 test failed on the first word of the lower buffer when the upper address was submitted first. Expected0xa00000c7, read0x00001770.git diff --checkpassed.GPUs tested: NVIDIA GeForce RTX 4090, driver 616.64, Windows 11. All test inputs were synthetic.
AI-assisted: Yes, OpenAI Codex (GPT-6).
Integration
The runtime fix is
f3c29e4e7. The test-only follow-upb27c441f98uses the same two-address submission helper as main. The fixture points its descriptor table at four untouched words in the first buffer so that changing submission order changes the expected output. The production diff is the same range-accounting change. Two-file diff against the tested mainGitHub's test merge
7a8508296dcombined mainef8fbf09f3and this PR atb27c441f98, producing the exact tree tested locally (e97148a439).0x00001770instead of0xa000d830. Running the lower-address-first case first passed all 32,768 words, then the higher-address-first case left word 0 at the prior result (0xa0001830).d3d12_placed_write_backandd3d12_title_window_write_backpassed three consecutive runs on the RTX 4090 with Khronos validation enabled, with no validation messages. Both CTests also passed on the PR head.