d3d12: test that a view past the title-window cap is never the raw VA (RT-TITLE-WINDOW-OVERFLOW) #1631
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!1631
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1631/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Tyrannys on GitHub · 2026-11-25 06:22 UTC · original
Tyrannys:title-window-overflow→main· +110 −0 · 2 files · 3 commits · merged 2026-11-25 14:52 UTCClaimed in the coordination issue as: RT-TITLE-WINDOW-OVERFLOW (#1608)
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, inba626820e: 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
main384abe5b0merged 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
@QemmHD on GitHub · 2026-11-25 06:42 UTC · original
Real-boot A/B of this PR (head
6d66718f3) on Windows 11, RTX 4070 SUPER (NVIDIA 621.24), with the default window cap (noLEONIDA_TITLE_WINDOWS_MB). The tree also had #1558 for the separate NVIDIA landing stop; the shaders were the same in both runs.c7e82e26e+ #1558): the device is lost about 110 s into the load, with VK_EXT_device_fault READ_INVALID and the checkpoint in the first group of pipeline-library compute dispatches. 4 of 4 runs.LEONIDA_TITLE_WINDOWS_MB=1024) leads to, a device loss with WRITE_INVALID in a later compute dispatch (reported on #1608). Here it comes about 55 s into the load, versus about 160 s with the 1024 MiB cap, because the scratch route skips mirroring 800+ MiB per submission.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).
@sodove on GitHub · 2026-11-25 07:32 UTC · original · edited 2026-11-25 07:39 UTC
Independent check on native Windows 11, RTX 5070 Ti, NVIDIA 610.74. I applied the runtime and test changes from
6d66718f3toc7e82e26eto match our existing baseline. The device implementation's Git blob matches the PR head.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).
@Tyrannys on GitHub · 2026-11-25 09:12 UTC · original
Brought up to date with
mainat604ddff0bby a merge (2c7440fed); the branch history is unchanged, no force-push. The only conflict wasruntime/test/d3d12_title_va_test.cpp: the--window-capbranch (returns early) is kept, and main's declined-import and import-over-shadow checks follow it. The shim's scratch-window fallback merged cleanly alongside main's external stream windows.Tested on Windows 11 (RelWithDebInfo), runtime tests only, no game boot:
d3d12_title_window_cap,d3d12_title_va,d3d12_geometry_views,d3d12_title_index_window,d3d12_title_vertex_window,d3d12_api_descriptor_copy(_off),d3d12_rebound_tables(_off),d3d12_rebound_second_device,title_va_alias: all passctest: 404/404 passed (22 skipped: they need the game package or tools not installed here)AI-assisted (Claude Code).
@kawaii-shakal on GitHub · 2026-11-25 09:45 UTC · original · reviewed
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:
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).
@whoalin1 on GitHub · 2026-11-25 11:12 UTC · original
Independent verification (native Windows; RTX 4070 SUPER + AMD gfx1036 iGPU,
LEONIDA_VK_VALIDATION=1): builds clean (382 targets). Diff reviewed — 16MiB+64KiB zeroed scratch reserved in arena on first window, shared by over-cap addresses viatitle_scratch_va; newd3d12_title_window_capctest + docs. NVIDIA: all 11 related tests PASS incl.d3d12_title_window_cap, title_va/index/vertex windows, rebound tables, api_descriptor_copy; direct run confirms "a dispatch through the scratch window read 64/64 zero words". AMD iGPU: 10/11 fail but pre-existing platform limit — every d3d12_title_* test needs a compute PSO and the iGPU reports maxPushConstantsSize=128 < 144, so push_constants_fit() refuses pipeline creation before any PR code runs (#224, documented);title_va_alias(no compute) passes. This directly implements the fix #1537 suggested (zeroed range instead of device loss); caveat per issue author: removes READ_INVALID loss but the cap itself still needs raising for world start (WRITE_INVALID remains, tracked separately). AI-assisted verification.@Tyrannys on GitHub · 2026-11-25 14:02 UTC · original
Brought up to date with
mainat384abe5b0by a merge (02d719cda); no force-push. Main'sba626820ealready fixes the runtime side of this: a title address pastLEONIDA_TITLE_WINDOWS_MBis backed by the geometry copy, or else written as a zero-size V# (loads 0, stores dropped), never the raw VA. So the scratch window is dropped in favour of main, and this PR now only adds thed3d12_title_window_captest, rewritten to check main's behaviour (both views zero-size, a dispatch reads 64/64 zeros). Title and description updated.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,
d3d12_title_window_capincluded.AI-assisted (Claude Code).
@aslan2142 on GitHub · 2026-11-25 14:42 UTC · original
Thanks, @Tyrannys, and thanks to @QemmHD for the boot A/B. Closing this, because #1723 (merged today) replaced the same fallback on
main:mainind3d12_vulkan_device.cppandd3d12_title_va_test.cpp.If you find a case
mainstill misses (for example a root view that still gets a raw address), a new PR on top of #1723'smake_title_window/note_unbackedpath is welcome, and so is the--window-captest reworked to expect a zero-size view.AI-assisted (Claude Code, Claude Opus 5.5).
@aslan2142 on GitHub · 2026-11-25 14:43 UTC · original
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
mainplus only the window-cap test now. We'll review the test-only version on its own.AI-assisted (Claude Code, Claude Opus 5.5).
@aslan2142 on GitHub · 2026-11-25 14:52 UTC · original
Merged, as the test-only version. Thank you, @Tyrannys, for cutting it down to what
mainwas missing, and thanks to @QemmHD, @sodove and @whoalin1 for the runs on the earlier version.d3d12_title_window_cappinsmain's behaviour from #1723: pastLEONIDA_TITLE_WINDOWS_MB, a view of title memory is written zero-size and never names the raw VA, which is what lost the device in #1537. It would catch that fallback coming back.mainplus the test and its CMake registration.main+ this branch: the five title-VA tests pass on both devices,d3d12_title_window_capincluded.main3d4f66123+02d719cda: it merges cleanly; the semantic suite passes (489 files, 6,288 tests, 0 files failed); the 14 docs and writer tests pass;check_no_game_data.pyis clean on the 2 changed files.AI-assisted (Claude Code, Claude Opus 5.5).