Repository navigation
KernelX: GPU-visible title memory outside the windows is write-watched (retail menu text complete) - #252
Conversation
|
Review of 1. The test does not reach the new branch here. In 2. The per-submit scan grows with the textures in the new ranges, not with the 24 GB.
3. CPU writes into write-watched memory cost more than the scan.
4. Merges.
An aside, not from #252: in Tested:
Not tested:
🤖 Claude Opus 5.5 |
…the CPU view (retail intro video, no green screen) A retail game reserves 24 GB of 64 KiB pages twice in a row (VirtualAlloc flags 0x20402000): once PAGE_READWRITE, once PAGE_NOACCESS | PAGE_GRAPHICS_NOACCESS (0x801). It maps physical pages only into the first (XMemMapPhysicalPages), yet places GPU resources at the same offset in the second: its Bink video planes are decoded by the CPU into the first view (BinkRegisterFrameBuffers), and the video shader samples R8 textures at those addresses plus the reservation's size. On the console the second reservation is a GPU-only view of the first; here it was separate, empty memory, so the video drew zero luma and chroma: a green screen for ~15 s after the first A press, until the menus came. kernelx::mirrors pairs such a no-access graphics reservation of 64 KiB pages with the most recent CPU-readable one of the same size (forgotten when either is released). title_textures keeps a texture placed in the GPU view, where nothing is mapped, in step with the same offset in the CPU view: its bytes are read and its CPU writes watched there, while its title address (GetGPUVirtualAddress, GPU copies into it) stays the GPU view's. Needs the CPU view write-watched (the previous commit, PR ivall#252). The 4K planes are now uploaded each video frame: 12.4 fps during the video against 17 fps of green before (RTX 5070 Ti). Test: gpu_view_reservations_name_their_cpu_view. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… of PR ivall#252) gpu_visible_fallback_memory_is_write_watched went through VirtualAlloc, where these sizes land in a unified-memory window once any test has made the windows: it took its `continue` and passed without the fix. The fallback's condition and reservation are now functions (gpu_visible_fallback, reserve_watched) and the test calls them: the condition for the three GPU-visible flag combinations and three plain ones, the reservation for write-watching (GetWriteWatch reports the written page) and its bookkeeping. Without MEM_WRITE_WATCH the test fails. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the CPU view (retail intro video, no green screen) A retail game reserves 24 GB of 64 KiB pages twice in a row (VirtualAlloc flags 0x20402000): once PAGE_READWRITE, once PAGE_NOACCESS | PAGE_GRAPHICS_NOACCESS (0x801). It maps physical pages only into the first (XMemMapPhysicalPages), yet places GPU resources at the same offset in the second: its Bink video planes are decoded by the CPU into the first view (BinkRegisterFrameBuffers), and the video shader samples R8 textures at those addresses plus the reservation's size. On the console the second reservation is a GPU-only view of the first; here it was separate, empty memory, so the video drew zero luma and chroma: a green screen for ~15 s after the first A press, until the menus came. kernelx::mirrors pairs such a no-access graphics reservation of 64 KiB pages with the most recent CPU-readable one of the same size (forgotten when either is released). title_textures keeps a texture placed in the GPU view, where nothing is mapped, in step with the same offset in the CPU view: its bytes are read and its CPU writes watched there, while its title address (GetGPUVirtualAddress, GPU copies into it) stays the GPU view's. Needs the CPU view write-watched (the previous commit, PR ivall#252). The 4K planes are now uploaded each video frame: 12.4 fps during the video against 17 fps of green before (RTX 5070 Ti). Test: gpu_view_reservations_name_their_cpu_view. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for the careful review. Point by point: 1. Test not reaching the fallback: fixed in 065be41. The branch's condition and reservation are now functions ( 2. The game's real numbers.
That's about 0.5 ms a submit on I split the timed section with a temporary probe. Recomputing the ranges is negligible (58 ms over 2048 looks); 3. Write cost. The reservation holding the physical pages is this one. A follow-up trace (#283) shows 4. Merges: thanks, noted. Aside ( Tests: 🤖 Claude Opus 5.5 |
|
Tested on Linux (Wine, NVIDIA): the menu text is still incomplete. Tested commit: Tested
Not tested
AI use
|
…u text) A retail game reserves 24 GB of 64 KiB pages (VirtualAlloc flags 0x20402000) and commits 2.2 GB of large pages with a graphics protection (flags 0x20003000, protection 0x2404). Neither fits a sparse or the coherent window, so both fell through to plain memory without MEM_WRITE_WATCH. Textures the title places there are kept in step with the memory (d3d12x::title_textures), which relies on GetWriteWatch to see CPU writes: they were uploaded once, empty, and never again (128+ textures in the first 45 s). One of them is the game's 2048x2048 A8_UNORM glyph atlas, which the CPU fills as text is laid out. Its GPU copy stayed zero, so every glyph drawn from it (the x-height letters: a c e m n o r s u v w x z) was missing from the menus; letters drawn by the vector path (ascenders, descenders, capitals) were fine. Found by a GPU readback of the atlas (zero) against its CPU view (glyphs) while the menu was on screen. The fallback VirtualAlloc now reserves GPU-visible memory (gpu_visible_fallback: MEM_GRAPHICS, MEM_LARGE_PAGES / MEM_64K_PAGES, or a PAGE_GRAPHICS_* protection) with MEM_WRITE_WATCH and records it with the graphics reservations (reserve_watched), whose ranges title_textures watches. Cost, measured on the game (RTX 5070 Ti): the write-watch scan goes from ~0.5 ms to 2.0-2.7 ms a submit once the menus have loaded, ~5-6 GB of kept-in-step textures now being scanned; 1093 frames in 80 s against 1297. Test: gpu_visible_fallback_memory_is_write_watched calls the fallback directly (through VirtualAlloc the unified-memory windows take these sizes when they have room); it fails without MEM_WRITE_WATCH. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
065be41 to
e93dc9c
Compare
|
Tested on Linux (Wine, NVIDIA): the menu text is still incomplete, and the glyph caches are not in the memory #252 changes. Tested commit: Tested
Not tested
AI use
|
|
@simnJS thanks for testing on Wine, and for tracing where the allocations go there. One correction about which texture to look at: the menu's missing letters don't come from the 71 small two-plane targets ( What draws the missing x-height letters on Windows here:
So on Wine the useful checks are: where that 🤖 Claude Opus 5.5 |
Handle 16-byte constant-buffer records, upload intro textures from their CPU view, and decode BC1 BCPack streams. Share bounded texture pages, batch upload staging, and tolerate pages decommitted during streaming reads. Includes work from ivall/xcl ivall#208, ivall#244, ivall#252, ivall#254, ivall#269 and ivall#283. DirectStorage late destination pages are already in the base. Assisted-by: OpenAI Codex (gpt-6.2-sol)
The fork, rebuilt on current upstream main with only what upstream does not have: the launcher's folder picker, click-to-capture mouse handling with F8 and Page Up / Page Down, a heap per DXC compile thread, the limit on waits for pipelines still being built, the installer, build.ps1, BUILDING.md, the release workflow and the README. Everything else the fork carried is in upstream now (ivall#195 in parts, ivall#211, ivall#244, ivall#252, ivall#283, ivall#289) or was a diagnostic. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
What was wrong
In a retail game's menus the body text lost its x-height letters (a c e m n o r s u v w x z); letters with ascenders, descenders or dots and all capitals were fine.
XCL_DEBUG_MAGENTAwith a colour per UI pixel shader showed two text paths: the letters that drew come from a shader with no texture (vector glyphs), and every missing letter from one shader that samples a single texture, a 2048x2048A8_UNORMglyph atlas the CPU fills as text is laid out. That atlas is kept in step with the title's memory (d3d12x::title_textures). A GPU readback of it was all zeros while its CPU view held the glyphs.The atlas lies in a 24 GB reservation of 64 KiB pages (VirtualAlloc flags
0x20402000). It does not fit a sparse window, so it fell through to plain memory withoutMEM_WRITE_WATCH, whereGetWriteWatchsees nothing: the texture was uploaded once, empty, at its first submit and never again. A second allocation, 2.2 GB of large pages with a graphics protection (flags0x20003000, protection0x2404, too large for the coherent window), had the same problem. Together they held 128+ kept-in-step textures within the first 45 s.Change
kernelx::VirtualAlloc's last fallback addsMEM_WRITE_WATCHfor GPU-visible reservations (MEM_GRAPHICS,MEM_LARGE_PAGES/MEM_64K_PAGES, or aPAGE_GRAPHICS_*protection). It records them with the graphics reservations, whose rangestitle_texturesalready watches andVirtualFreealready forgets. Commits the title makes inside such a reservation later inherit the watch.Relation to open PRs: #203 moves large-page reservations into sparse windows when they fit. This change covers what still falls through (the 24 GB reservation does not fit), so the two are complementary. #211 (merged) covered glyph caches that are render targets; this atlas is a plain texture.
Testing
gpu_visible_fallback_memory_is_write_watched: the three flag combinations land in watched memory, and a write is reported byGetWriteWatch.cargo test --workspace: 652 passed, 0 failed, 40 ignored (RTX 5070 Ti, driver 32.0.16.1088).🤖 Generated with Claude Code