[PR #2352] d3d12: preserve GPU writes to adjacent buffers in either address order #2353

Open
opened 2026-11-26 21:20:56 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/2352
Author: @ecox982745
Created: 11/26/2026
Status: 🔄 Open

Base: main ← Head: fix-adjacent-writeback-ranges


📝 Commits (1)

  • f3c29e4 d3d12: keep adjacent write-back ranges in either submission order

📊 Changes

2 files changed (+63 additions, -31 deletions)

View changed files

📝 runtime/shims/d3d12_vulkan_device.cpp (+19 -15)
📝 runtime/test/d3d12_title_va_test.cpp (+44 -16)

📄 Description

Claimed as RT-TITLE-WRITEBACK-ADJACENT-RANGES. This is the follow-up requested after #2129 landed.

Depends on: #2129 (merged into main through #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

  • Before the fix. On main at fbf100b1b, the new RTX 4090 test failed on the first word of the lower buffer when the upper address was submitted first. Expected 0xa00000c7, read 0x00001770.
  • After the fix. Both address orders passed. The placed-buffer and window write-back tests each passed three times with Vulkan validation enabled and three times with it disabled on the integrated tree. All six related CTests passed with validation enabled on both the submitted commit and its integration with main.
  • CPU range accounting. A separate harness compared the production insertion code against a byte-set model over all 46,656 ordered triples of intervals in an eight-byte address space, with caps of five bytes and two ranges. The parent disagreed on 37,831 sequences. The fix matched at every insertion, including refused insertions.
  • The integrated tree passed the CPU translator suite (500 files, 6,365 tests, zero failed files). The changed-file game-data check and git diff --check passed.

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 branch starts at the already-merged #2129 head 5fa864e53. The PR adds one commit, f3c29e4e7, touching two files. Its clean merge with main at fbf100b1b produced the exact tree used for integration testing (7dc0a1aec).


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/2352 **Author:** [@ecox982745](https://github.com/ecox982745) **Created:** 11/26/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix-adjacent-writeback-ranges` --- ### 📝 Commits (1) - [`f3c29e4`](https://github.com/ubiquitarianism/leonida/commit/f3c29e4e7380a3851d1c54ce671e84e0eecb26da) d3d12: keep adjacent write-back ranges in either submission order ### 📊 Changes **2 files changed** (+63 additions, -31 deletions) <details> <summary>View changed files</summary> 📝 `runtime/shims/d3d12_vulkan_device.cpp` (+19 -15) 📝 `runtime/test/d3d12_title_va_test.cpp` (+44 -16) </details> ### 📄 Description Claimed as [RT-TITLE-WRITEBACK-ADJACENT-RANGES](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7195278154). This is the [follow-up requested after #2129 landed](https://github.com/ubiquitarianism/leonida/pull/2129#issuecomment-7195197576). Depends on: #2129 (merged into `main` through #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 - **Before the fix.** On `main` at `fbf100b1b`, the new RTX 4090 test failed on the first word of the lower buffer when the upper address was submitted first. Expected `0xa00000c7`, read `0x00001770`. - **After the fix.** Both address orders passed. The placed-buffer and window write-back tests each passed three times with Vulkan validation enabled and three times with it disabled on the integrated tree. All six related CTests passed with validation enabled on both the submitted commit and its integration with main. - **CPU range accounting.** A separate harness compared the production insertion code against a byte-set model over all 46,656 ordered triples of intervals in an eight-byte address space, with caps of five bytes and two ranges. The parent disagreed on 37,831 sequences. The fix matched at every insertion, including refused insertions. - The integrated tree passed the CPU translator suite (500 files, 6,365 tests, zero failed files). The changed-file game-data check and `git diff --check` passed. 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 branch starts at the already-merged #2129 head `5fa864e53`. The PR adds one commit, `f3c29e4e7`, touching two files. Its clean merge with `main` at `fbf100b1b` produced the exact tree used for integration testing (`7dc0a1aec`). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#2353
No description provided.