Repository navigation
d3d12: test that a view past the title-window cap is never the raw VA (RT-TITLE-WINDOW-OVERFLOW) - #1631
Conversation
… (RT-TITLE-WINDOW-OVERFLOW) Past LEONIDA_TITLE_WINDOWS_MB, or with no arena room for a window, resolve_title_memory handed the GPU the title's raw VA. That names nothing of the device's, and one read of it lost the device at the world start (ProjectLeonida#1537). Reserve 16 MiB + 64 KiB of zero-filled arena with the first window and point such addresses into it instead: the cost is a wrong result, not the device. The raw VA is kept only when even the scratch did not fit (logged once). d3d12_title_window_cap runs d3d12_title_va_test --window-cap with a cap of 0: two views of the title's memory name the arena, share the scratch, and a dispatch through one reads zeros. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Real-boot A/B of this PR (head 6d66718) on Windows 11, RTX 4070 SUPER (NVIDIA 621.24), with the default window cap (no
So this does what it says on a real boot. The write fault is a separate issue. AI-assisted (Claude Code, Claude Opus 5.5). |
|
Independent check on native Windows 11, RTX 5070 Ti, NVIDIA 610.74. I applied the runtime and test changes from The window-cap test and seven related tests passed (8/8, Khronos validation enabled). In the cap test both views used the arena and the GPU read 64/64 zero words. With the same test linked against our baseline runtime library, both views retained the raw address and the assertion stopped the test before dispatch. One ordinary offline boot per build, same shader set, settings, default title-window cap, native depth mode and four scheduled menu inputs. Both reached the intro and then reported device loss.
Neither run reached a verified world frame or the runner time limit. Reviewing both launch configurations afterward confirmed that opt-in Vulkan fault collection was off in both. Neither run collected a typed address record. Windows recorded NVIDIA event 153 in both intervals. This verifies the scratch path on Blackwell, but these runs cannot distinguish an invalid read from an invalid write or establish a timing regression. No game files or logs attached. AI-assisted (OpenAI Codex). |
The only conflict was runtime/test/d3d12_title_va_test.cpp: keep the --window-cap branch (returns early) and main's declined-import and import-over-shadow checks after it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Brought up to date with Tested on Windows 11 (RelWithDebInfo), runtime tests only, no game boot:
AI-assisted (Claude Code). |
kawaii-shakal
left a comment
There was a problem hiding this comment.
Review (read-only, not run). The zeroed scratch in place of the raw VA is the right direction, and the test covers both the naming and the read. Three points:
- The scratch is writable and shared. A UAV or buffer store through an overflowed address writes into it, so later readers through any other overflowed address read that data, not zeros. The docs say "or what another such shader wrote", which is honest. But it can turn a wrong frame into data-dependent behaviour, for example an index read from scratch that a previous dispatch wrote. If that matters, mapping stores to a separate write-only sink, or re-zeroing the scratch when the title-window refresh runs, would keep reads at zero. If not, a sentence on why it is acceptable would help.
- 16 MiB + 64 KiB of arena is reserved with the first window, whether or not the cap is ever reached. With the default 256 MiB arena that is about 6 % taken up front, which can push something else into "GPU address arena full" earlier on small configurations. Reserving early is the reason it works when the arena later fills, so this is a trade-off; maybe note it in the docs next to
LEONIDA_ARENA_MB. std::memset(arena.mapped + scratch, ...)assumes the arena is host-mapped. That holds today, because the arena isHOST_VISIBLE. If the M4+ plan in section 3.3 (a device-local arena with staged writes) lands, this becomes a null dereference. A one-line assert or comment would mark the dependency.
AI-assisted review (Claude Code, Claude Opus 5.5).
|
Independent verification (native Windows; RTX 4070 SUPER + AMD gfx1036 iGPU, |
Main's ba62682 already handles a title address past LEONIDA_TITLE_WINDOWS_MB: the persistent geometry copy backs it, or else every view writer emits a zero-size V# (loads 0, stores dropped), so the raw VA never reaches the GPU (ubiquitarianism#1537). That replaces this branch's zeroed scratch window, so the runtime and docs side take main's version. The d3d12_title_window_cap test stays, rewritten for main's behaviour: with a cap of 0, two CBVs of private title memory are written zero-size (no base, no records, never the raw VA), no window is made, and a dispatch through one reads zeros. Main had no test that dispatches through an over-cap title address. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Brought up to date with Thanks @whoalin1, @QemmHD and @sodove for the verification runs on the earlier version. Tested on Windows 11 (RelWithDebInfo, RTX 4070 SUPER), runtime tests only, no game boot: the 20 title-window, title-VA, geometry-view and unmapped-V# tests pass, AI-assisted (Claude Code). |
|
Thanks, @Tyrannys, and thanks to @QemmHD for the boot A/B. Closing this, because #1723 (merged today) replaced the same fallback on
If you find a case AI-assisted (Claude Code, Claude Opus 5.5). |
|
Reopened. Sorry, @Tyrannys: my comment above was based on the head before your 13:41 update, and that update already does what it suggests. The branch is AI-assisted (Claude Code, Claude Opus 5.5). |
|
Merged, as the test-only version. Thank you, @Tyrannys, for cutting it down to what
AI-assisted (Claude Code, Claude Opus 5.5). |
Claimed in the coordination issue as: RT-TITLE-WINDOW-OVERFLOW (#1608 (comment))
Now test-only
This PR first added a zeroed scratch window for title memory past
LEONIDA_TITLE_WINDOWS_MB, so the GPU would never get the title's raw VA (#1537: one read of it loses the device). Main has since fixed the runtime side another way, in ba62682: past the cap (or with the arena full) a title address is backed by the persistent geometry copy, or else every view writer writes a zero-size V# (no base, no records: loads 0, stores dropped). The raw VA never comes out. That also covers the review points about a shared, writable scratch and the 16 MiB arena reserve, so the scratch window is dropped and the runtime and docs followmain.What is left is the test, because main had none that dispatches through an over-cap title address:
d3d12_title_window_caprunsd3d12_title_va_test --window-capwithLEONIDA_TITLE_WINDOWS_MB=0. Two CBVs of different pages of private title memory are written zero-size (base 0, 0 records, never the raw VA), no window is made, and a dispatch through one reads 64/64 zero words with no validation errors. No game files.Tested
Windows 11, RTX 4070 SUPER, RelWithDebInfo, on
main384abe5 merged in:d3d12_title_window_cap,d3d12_title_va,d3d12_title_va_shadow,d3d12_geometry_views,d3d12_unmapped_vsharp,d3d12_title_index_window,d3d12_title_vertex_window,d3d12_api_descriptor_copy(_off),d3d12_rebound_*,title_va_alias,title_window_plan,title_window,geometry_views: 20/20 pass.The real-boot results earlier in this thread (QemmHD, sodove, whoalin1) were for the scratch-window version, not for main's route.
AI-assisted (Claude Code, Claude Opus 5.5).
🤖 Generated with Claude Code