Repository navigation
d3d12: slot-133 shadows guard aliased title pages at every address instead of copying them each submission (RT-SHADOW-ALIAS-GUARD) - #1867
Conversation
Independent verification — Turing and Blackwell
Environment
NVIDIA 621.14, Vulkan SDK 1.4.363.0, Three repetitions per GPU, revision and validation mode. Results
192 executions: 192 passed, 0 failed, 0 skipped. Findings
No regressions observed. The new alias-guard mechanism Retail workloads and comparative performance Synthetic tests only. No game files used. |
|
@azsekazvamdimitar thank you. I have the same numbers from a local version of the same idea: 1.1 GB aliased before every submission down to 15 MB, shadow phase 173 ms to 6 to 40 ms, 17,939 of 18,226 tiles settled (RTX 5080, Windows 11, 4 GiB window cap). Yours is claimed, so I will not open mine. Some points from building and reviewing it that may help #1867, from reading your diff (not run):
I can't say which of these matter on your machine. If a retail run of #1867 on this card would help, say so. AI-assisted (Claude Code). |
Independent test run: Windows 11, RTX 4060Head Setup
Results
The failures on head are
So: no regression in the 30 other tests, MutationThe The new test does fail without the change. The mutation was against the merge base, not current main, whose copy of the test file has moved on. In game (measured by OreoFR in game, not by me)RTX 4070 Laptop 8 GB, driver 621.40, main + #1849 + a local texture pass. At 140 s:
The wall at about 222 s is still there. I did not run the game and have not reproduced these numbers. AI-assisted: yes (Claude Code built and ran the tests) |
|
Measured on Windows 11 with an NVIDIA RTX 5090 (driver 32.0.16.2124), retail boot, runtime at the #1723 integration point with and without this PR, same settings and the same scripted input for both runs, read from the
No device loss or new fault in either run. AI-assisted: yes. |
|
I tested the alias guard patch on an Intel Xeon E5-2670 v3 with Fedora Linux 45, Wine 11.21 Staging and Lavapipe. The control was In the four late startup samples (63–78 seconds), the runtime reported:
Both runs reached PresentX and ended at the test time limit. The figures cover startup, with hardware rendering disabled. Tested-on: Intel Xeon E5-2670 v3, Fedora Linux 45, Wine 11.21 Staging, Lavapipe. Retest on the current main branchI repeated the comparison on 61732ac with the same Wine and Lavapipe setup, a fresh overlay for each build and a 95-second limit. The tested rebase keeps the upstream stray read-only page diagnostics; the overlap was in the comment preceding that helper.
These are startup samples from the final 26 seconds. Both runs reached PresentX and ended at the time limit. Tested-on: Intel Xeon E5-2670 v3, Fedora Linux 45, Wine 11.21 Staging, Mesa Lavapipe 26.2.7. |
|
Native Windows result with the game (the earlier numbers here were Wine). RTX 5060 Ti 16 GB, NVIDIA 621.01, Windows 10 19045, 32 GB RAM, own 1.0.2.1. Base: #2098 at 9f98dcc + #1592 merged with From the slot-133 refresh line, averaged over the submissions after the 4,000th (the world start):
I turned the D3D12 trace off in the same step, so the time column is not a clean A/B; the copied bytes are. n44 reached the opening cutscene's prompts and ran 585 s with no device loss. Two things I can't attribute and am not claiming are from this PR:
If you want a log line or a switch checked on this machine, say which. AI-assisted (Claude Code). |
3124ca8 to
ae0a95d
Compare
…stead of copying them each submission (RT-SHADOW-ALIAS-GUARD) A page xmem maps at two addresses was copied whole at every refresh, since a guard on one view doesn't fault a write through the other: about 1 GB a submission after the story load on a retail boot. ShadowPages now arms the geometry watch's cells of each aliased 64 KiB block at every address it is mapped and copies a block only when a cell's version moved. xmem tells the cells of a mapping change after updating the peers, and of list value writes made through the section. AI-assisted; tested under WineHQ 11.22 and GE-Proton11-14 on an RTX 3090 (NVIDIA 590.48.01).
ae0a95d to
49a0b69
Compare
One conflict, runtime/README.md: this branch rewrote the LEONIDA_SHADOW_ALIAS_MS row, main (ProjectLeonida#2163) added the LEONIDA_SHADOW_KEEP row after it. Both rows kept; the keep row's "aliased" now reads "aliased while they can't be guarded at every address", since aliased pages are no longer copied without a sign of a write. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…oo (RT-SHADOW-ALIAS-GUARD) check_aliased_guard covers the addresses known when the cells are first armed. This covers the later case: the page is guarded at A and B, then reported at C as well, with the cells' mapping moved at every address as xmem's note_mapping does once the peers are updated. The next submission must ask for the other addresses again and guard C, so a write through C faults and is copied at the submission after it. Without the re-ask in ShadowPages::update_aliased, C stays writable and the write through it is never copied. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Merging.
Thanks @azsekazvamdimitar, and @Timon360SB, @MoonEyes, @x2Tweek, @gmankab, @Snooozs and @DadaCap for the runs and reviews. AI-assisted (Claude Code, Claude Opus 5.5 and Claude Fable 5.2) |
Claimed in the coordination issue as: RT-SHADOW-ALIAS-GUARD (#1608 (comment))
What and why
The slot-133 shadows and title windows (
ShadowPages,runtime/shims/d3d12_vulkan_device.cpp) never guarded a page xmem maps at more than one address (title_page_aliases): a guard on one view doesn't fault a write through the other, so every refresh copied those pages whole. After the story load the stream pools make that the bulk of each submission. On my retail boot (main 0d80bc5, RTX 3090, GE-Proton,LEONIDA_TITLE_WATCHDOG=0) the by-cause line read about 987 MB aliased, 7 MB guarded and 2.4 MB pinned a submission, about 300 ms of each one, and the title presented about 0.3 frames a second.LEONIDA_SHADOW_ALIAS_MScan only make those copies older.This guards the aliased blocks at every address instead, with the geometry watch's cells (
runtime/src/title_geometry_watch.h), which the geometry views already use for the same problem:ShadowPages::update_aliased, at the start ofrefresh()and outside the tracker's lock, acquires a cell for each aliased 64 KiB block the copies read, at its own address and at each other addressgeometry_aliasesnames, and arms them (read-only at every address). A block whose cells kept their versions since they were armed is skipped by the walk; any other is armed again before the walk copies it, so a write after the arming is copied at the next refresh. A write through any address faults intoshadow_write_fault, which already notifies the geometry watch first; a remap, commit or protection change moves a cell's version too.armrefuses it), and in the refreshesLEONIDA_SHADOW_ALIAS_MSthrottles.note_mappingnow tells the cells of a mapping change after it updated the peers, so a watcher that sees the new mapping gets the new addresses;write_title_bytes(list value writes, through the section rather than the title's views) notifies the geometry watch, since no fault tells a guard of those writes.The same retail boot, after the story load:
LEONIDA_SHADOW_ALIAS_MS=3600000(aliased pages copied once: stale, an upper bound)All three runs end in the same world-start device loss, about 180-220 s after the story load starts (queue waits on memory nothing wrote, indirect draws not emitted, then
VK_ERROR_DEVICE_LOST). This pull request doesn't change that; it makes the loading screen run at a usable rate up to that point. No frames were captured that show a visible difference.Tested
d3d12_existing_heap_testgainscheck_aliased_guard: one page mapped at A and B (the test answersgeometry_writes::aliases) is read-only at both addresses between submissions, a write through an unreported third view stays stale (nothing was copied), a write through B faults and arrives with it, and both addresses are writable again after the shadow is released. The existingcheck_aliased_write, which has no other address to arm, still copies every time and passes.d3d12_existing_heap,d3d12_existing_heap_no_write_watch,d3d12_existing_heap_write_watch,d3d12_xmem_placed,d3d12_title_va,d3d12_title_va_shadowandxs_proxy_mockpass under both.xmemfails one check, "writing to 512 of them charges about those 512 pages", under Wine; it fails the same way on main without this change.GPUs tested: NVIDIA GeForce RTX 3090, driver 590.48.01, Debian 13 (Linux 6.12), Wine/Proton as above.
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed.