[PR #2129] [MERGED] d3d12: a window's GPU writes go back to the title's pages (RT-TITLE-WINDOW-WRITE-BACK) #2134

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

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/2129
Author: @star41905453-coder
Created: 11/25/2026
Status: ✅ Merged
Merged: 11/26/2026
Merged by: @aslan2142

Base: main ← Head: rt-title-window-write-back


📝 Commits (4)

  • 04290dd d3d12: a window's GPU writes go back to the title's pages (RT-TITLE-WINDOW-WRITE-BACK)
  • c5359a4 d3d12: the window write-back waits for the submission that wrote (RT-TITLE-WINDOW-WRITE-BACK)
  • fc1593e d3d12: the same write back covers a slot-133 shadow (RT-TITLE-WINDOW-WRITE-BACK)
  • 5fa864e d3d12: bound the write-back queue and say when a batch goes back unfenced (RT-TITLE-WINDOW-WRITE-BACK)

📊 Changes

6 files changed (+400 additions, -2 deletions)

View changed files

📝 docs/d3d12_vulkan.md (+12 -0)
📝 docs/linux_proton.md (+4 -0)
📝 runtime/CMakeLists.txt (+7 -0)
📝 runtime/shims/d3d12_vulkan_device.cpp (+144 -1)
📝 runtime/src/title_va_alias.h (+24 -0)
📝 runtime/test/d3d12_title_va_test.cpp (+209 -1)

📄 Description

Closes the world-start stop of #1537 (QemmHD's WRITE_INVALID, about 160 s into the load): a title window is a read-side mirror, so a UAV or raw write into one landed in the copy and the title never saw it.

What it does

  • Every title range a submission's bindings resolve to is kept (the resolve path, so root views, table V#s and created views are all covered — a V# has no read/write bit, so a read-only view costs a copy and a write is never missed).
  • A batch is fenced: it carries the retire ticket of the submission that will use it, and the ranges are copied back to the title's pages only once the context reports that ticket retired — at a later refresh, before that refresh's forward copy. A range another submission is still writing is never read half done.
  • A page the title wrote in between keeps the title's newer bytes and its GPU result is dropped (the tracker knows those pages: not guarded and not asked-about-and-clean, or not committed).
  • Caps: 8,192 ranges and 64 MiB per submission, refused ranges logged once. LEONIDA_TITLE_WRITEBACK=0 turns it off.

It also covers the slot-133 case: a placed buffer whose pages the driver will not import is a shadow too, and a write through it landed in the copy exactly the same way. The pages there are title memory, the buffer's alias resolves through the same noter and the tracker carries the range, so the mechanism needed nothing new — only proof, d3d12_placed_write_back.

Test — d3d12_title_window_write_back (new ctest entry, --window-writeback): a dispatch through a root UAV at the title's own pages. The pages stay untouched until the next submission, then hold exactly the words the shader wrote, across two submissions, and a title write survives the next forward copy. No game files.

Run — Linux, Wine 10, Mesa llvmpipe (no GPU on this box). The 21 failures of a full 448-test run are environmental and were confirmed by running the same list on unmodified main (9f9a7c5f3): every one fails there too, most with WARP reference unavailable, and the title tests pass there. Nothing in this diff causes a failure that main does not already have.

  • d3d12_title_va, d3d12_title_va_shadow, d3d12_geometry_views, d3d12_title_window_cap, d3d12_title_window_write_back, d3d12_placed_write_back: pass.
  • ctest -R 'write_back|title|shadow|alias|arena|stream': 20/20 pass.
  • Full suite: 448 run, 21 failed, 15 skipped — the same 21 fail on main (baseline above); 7 of them xmem/file_system/bcrypt_rng/root_sig are Wine gaps, the rest say WARP reference unavailable.
  • gta6rt --run of tiny_async through the rebuilt loader: PASS, exit 0.

What is still wanted: a retail --run past the cap on a GPU (the package is 208 GiB and this box has 36), with LEONIDA_DEVICE_FAULT=1 if it still dies.

Item: RT-TITLE-WINDOW-WRITE-BACK, claimed in #1608.


🔄 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/2129 **Author:** [@star41905453-coder](https://github.com/star41905453-coder) **Created:** 11/25/2026 **Status:** ✅ Merged **Merged:** 11/26/2026 **Merged by:** [@aslan2142](https://github.com/aslan2142) **Base:** `main` ← **Head:** `rt-title-window-write-back` --- ### 📝 Commits (4) - [`04290dd`](https://github.com/ubiquitarianism/leonida/commit/04290dd2d12e027ddfbd82ea6e482999610f279f) d3d12: a window's GPU writes go back to the title's pages (RT-TITLE-WINDOW-WRITE-BACK) - [`c5359a4`](https://github.com/ubiquitarianism/leonida/commit/c5359a4644767aa2780aec18576ae6b5c4d67826) d3d12: the window write-back waits for the submission that wrote (RT-TITLE-WINDOW-WRITE-BACK) - [`fc1593e`](https://github.com/ubiquitarianism/leonida/commit/fc1593e0088596268e41873963b137022cc1180a) d3d12: the same write back covers a slot-133 shadow (RT-TITLE-WINDOW-WRITE-BACK) - [`5fa864e`](https://github.com/ubiquitarianism/leonida/commit/5fa864e539a27150cacb18034d6a4fe3a812afcf) d3d12: bound the write-back queue and say when a batch goes back unfenced (RT-TITLE-WINDOW-WRITE-BACK) ### 📊 Changes **6 files changed** (+400 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `docs/d3d12_vulkan.md` (+12 -0) 📝 `docs/linux_proton.md` (+4 -0) 📝 `runtime/CMakeLists.txt` (+7 -0) 📝 `runtime/shims/d3d12_vulkan_device.cpp` (+144 -1) 📝 `runtime/src/title_va_alias.h` (+24 -0) 📝 `runtime/test/d3d12_title_va_test.cpp` (+209 -1) </details> ### 📄 Description Closes the world-start stop of #1537 (QemmHD's WRITE_INVALID, about 160 s into the load): a title window is a read-side mirror, so a UAV or raw write into one landed in the copy and the title never saw it. **What it does** - Every title range a submission's bindings resolve to is kept (the resolve path, so root views, table V#s and created views are all covered — a V# has no read/write bit, so a read-only view costs a copy and a write is never missed). - A batch is **fenced**: it carries the retire ticket of the submission that will use it, and the ranges are copied back to the title's pages only once the context reports that ticket retired — at a later refresh, before that refresh's forward copy. A range another submission is still writing is never read half done. - A page the title wrote in between keeps the title's newer bytes and its GPU result is dropped (the tracker knows those pages: not guarded and not asked-about-and-clean, or not committed). - Caps: 8,192 ranges and 64 MiB per submission, refused ranges logged once. `LEONIDA_TITLE_WRITEBACK=0` turns it off. It also covers the slot-133 case: a placed buffer whose pages the driver will not import is a shadow too, and a write through it landed in the copy exactly the same way. The pages there are title memory, the buffer's alias resolves through the same noter and the tracker carries the range, so the mechanism needed nothing new — only proof, `d3d12_placed_write_back`. **Test** — `d3d12_title_window_write_back` (new ctest entry, `--window-writeback`): a dispatch through a root UAV at the title's own pages. The pages stay untouched until the next submission, then hold exactly the words the shader wrote, across two submissions, and a title write survives the next forward copy. No game files. **Run** — Linux, Wine 10, Mesa llvmpipe (no GPU on this box). The 21 failures of a full 448-test run are environmental and were confirmed by running the same list on unmodified `main` (`9f9a7c5f3`): every one fails there too, most with `WARP reference unavailable`, and the title tests pass there. Nothing in this diff causes a failure that `main` does not already have. - `d3d12_title_va`, `d3d12_title_va_shadow`, `d3d12_geometry_views`, `d3d12_title_window_cap`, `d3d12_title_window_write_back`, `d3d12_placed_write_back`: pass. - `ctest -R 'write_back|title|shadow|alias|arena|stream'`: 20/20 pass. - Full suite: 448 run, 21 failed, 15 skipped — the same 21 fail on `main` (baseline above); 7 of them `xmem`/`file_system`/`bcrypt_rng`/`root_sig` are Wine gaps, the rest say `WARP reference unavailable`. - `gta6rt --run` of `tiny_async` through the rebuilt loader: `PASS`, exit 0. **What is still wanted**: a retail `--run` past the cap on a GPU (the package is 208 GiB and this box has 36), with `LEONIDA_DEVICE_FAULT=1` if it still dies. Item: RT-TITLE-WINDOW-WRITE-BACK, claimed in #1608. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 21:20:09 +01:00
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#2134
No description provided.