Repository navigation
D3D12.X: XCL_TEXTURE_LEVEL_PAGES=1 gives a sampled texture's levels their pages with their texels - #2306
D3D12.X: XCL_TEXTURE_LEVEL_PAGES=1 gives a sampled texture's levels their pages with their texels#2306imnicho wants to merge 1 commit into
Conversation
…heir pages with their texels A retail title places its streamed textures at full size and has memory behind their levels only as it loads them, the small ones first. vram::place_pages gives a sampled texture a 64 KiB page of video memory for every tile at once: when that title's world is set up about 92 % of those pages have nothing behind them (80 690 pages, 6 809 committed, on one card). With the switch (off by default) a sampled 2D texture of one slice is placed with no tile mapped. Its tiling is kept as groups of tiles, one for each level with tiles of its own and one for the packed levels, and a group gets its pages before the first upload that has texels for it - the same pages by address as before, so textures placed at one address still share them. A texture the GPU writes gets all its pages. Part of xcl-dev#1773. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Independent Windows check of 3ea5edc. Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti / 621.35, Rust 1.99.1 MSVC, DXC 1.8.2502.11.
Synthetic fixtures only. Retail world-load timing and visual output were outside these runs. AI-assisted. Codex (GPT-6, exact variant unavailable) added the temporary test instrumentation, ran the tests, and drafted this report. |
|
Linux/RADV (RDNA3) verification over Wine: green with the switch on and off, one single-shot flake to note. Tested:
So on this rig the change is clean: no deterministic failure with the switch on. The one Not tested: Windows hosts; the streamed-texture retail measurements in the PR body (no title data run here, counts only). AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting. |
|
Independent native Windows Radeon iGPU check of Tested
Not tested A forced eager-page GPU control, retail gameplay, memory savings in a title, and the full workspace suite. AI use OpenAI Codex (GPT-6.2 Sol) adapted the adapter selection for the test, ran the checks and wrote this report. |
|
RTX 4090, clean PR head
The matched images were frames 1247 at 86.623 s (off) and 1223 at 86.963 s (on). Memory comes from the nearest XCL activity samples at 86.054 and 86.037 s. Their artwork looks consistent in both readbacks. With the switch on, XCL explicitly logged 17,299 textures representing 2,135 MiB with 940 MiB backed at 65.389 s. End of run. Both reached the configured cutoff with exit code 0, a null crash field and no logged D3D12 device removal. After the last interval with any presents, the logs recorded 52 large compute PSO builds finishing with the switch off, and 63 compute plus 2 graphics builds with it on. Pipeline builds were still progressing near cutoff. The logs do not identify which build, if any, held up the presenter. Setup. RTX 4090 24 GB, NVIDIA 621.40, Ryzen 7 5800X3D, 32 GB RAM, Windows 11 build 26300. Retail 1.0.2.1, Series X. Built once with Not tested: post-HUD stability, texture correctness in the rendered world, or behavior after 300 s. One run per setting. AI use: OpenAI Codex (GPT-6) built the PR, ran the pair, inspected the frame captures and logs, and drafted this report. |
With
XCL_TEXTURE_LEVEL_PAGES=1(off by default) a sampled texture's levels get their video memory pages when an upload first has texels for them, not all at once when the title places the texture. Part of #1773 (point 2 there, the sampled textures' half of the "target pages").A retail title places its streamed textures at full size and has memory behind their levels only as it loads them, the small ones first.
vram::place_pagesgives a sampled texture a 64 KiB page of video memory for every tile at once, so most of those pages hold nothing: when that title's world is set up, 80 690 pages lie under such textures and 6 809 of them (8 %) are committed, on my card. @shortside measured the same on a Mac and has a branch for native hosts, where each texture is a reserved resource of its own (#1773 (comment)); this is the idea for the shared-pages path Windows uses, which that comment left open. Measurements and the plan: #1773 (comment).What is in it
crates/xcl/src/hle/d3d12x/vram.rs: with the switch on,place_pagesplaces a sampled 2D texture of one slice with no tile mapped.Levelskeeps its tiling (GetResourceTiling) as groups of tiles: one for each level with tiles of its own, one for the packed levels.map_levelsgives a group its pages - the same pages by address as before (bind_range, whatbinddoes for a range of the tiles;maptakes the subresource the range starts at), so textures placed at one address still share them. A texture unmapped as a whole (unmap_superseded) starts again with no level mapped. A tiling that does not add up to the resource's tiles, arrays, volumes, multisampled and GPU-owned textures are placed as before.crates/xcl/src/hle/d3d12x/title_textures.rs: before an upload's copies, the levels of the texture that have texels (a byte that is not zero in what goes up) get their pages; the upload queue waits for the mapping (vram::before_execute, already called there). A level of zeros keeps none: it reads as zeros either way, and its copy goes to tiles that are not mapped, which drops it (tiled resources tier 2, the tier the shared pages already need). A texture the GPU writes (note_gpu_write:CopyTextureRegion,CopyResource, the resolves) gets all its pages at that call, and so does one of those when it is uncovered again.the_tiles_of_a_texture_are_grouped_by_its_levels(the grouping; tilings that do not add up), anda_placed_texture_gets_the_pages_of_a_level_with_its_texelson the GPU: a 1024x1024 texture of 11 levels whose memory has every level but the largest - no page before the first upload, then pages for those levels only (counted against the driver's tiling), their texels right, zeros read from the level without pages; with memory under the largest level a texture placed there again gets that level's pages, the others shared, and holds all of it; a texture the GPU writes gets the pages of all its levels.Tested
stable-x86_64-pc-windows-msvc; debug for the tests, release for the title.cargo build --workspace && cargo test --workspace -- --test-threads=4on3ea5edc: 1252 passed, 0 failed, 46 ignored. SKIPPED (27 notices): the wave64 cases ofgpu::recomp::lower::tests(4 tests) andgpu::recomp::lower_dxil::tests(14 cases), 3 per-lane cases the per-lane form refuses,gpu_wave32_program_in_wave64_hardwareandgpu_geometry_wave32_prefix_count_over_a_mask(no wave64),heap_window_out_of_memory_falls_back_to_the_switch_form(its switch is off),pso_measurement_compiles_an_exact_synthetic_record(Windows Developer Mode is off),uploads_start_from_each_subresources_stateandtest_title_draws_with_a_root_signature_under_the_debug_layer(no D3D12 debug layer on this PC).XCL_TEXTURE_LEVEL_PAGES=1 XCL_ACTIVITY=1, default settings otherwise): one run of 150 s through its menus and first loading screens, 1 958 frames shown, no device removal, no crash, no failed upload; the logo and the loading artwork are right in the frame captures. By 93 s 17 591 placed textures standing for 2 422 MB had pages for 940 MB (the linemap_levelslogs).XCL_NETWORK=0, scripted pad; the same for the run above), on a local tree that is not this head: D3D12.X: integration branch that reaches the in-world HUD on NVIDIA (reference, not for merge) #2057 at4df1e6e+mainat0f13d2a+ Recompiler: emit per-instruction globallycoherent on compute flat memory (stacked on #1850) #2067, XG: fix CopyFromSubresource 7-argument ABI and guard destination span #684, Rect lists: the CPU expansion finds the rect's corner, not always v1 #266, Activity: the local video memory budget, and a warning within XCL_VRAM_HEADROOM_MB of it #1515, kernelx: XMemMapPhysicalPagesScatter with no page array unmaps #495, DirectStorage: read a physical-page list again when its request runs #1405, D3D12.X: title texture reads outside the coherent window use the safe copy #751, D3D12.X: execute two-pass mesh shaders on DispatchMesh and ExecuteIndirect (supersedes #724) #2092, D3D12.X: shaders that index the heaps themselves get the heaps' addresses #1803, D3D12.X: the console's DispatchMesh indirect argument (107) is a PC DispatchMesh #1887, D3D12.X: a console MS in the AS slot is translated as the mesh shader it is #541, D3D12.X: XCL_DUMP_TARGETS dumps the most-drawn render targets of a frame #2050 and the samevram.rschange. There the uploads are D3D12.X: integration branch that reaches the in-world HUD on NVIDIA (reference, not for merge) #2057's, which send parts of a texture: the hook is in its plan of an upload, a level counts as there when memory is committed behind it, and a level that gets its pages goes up whole.XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_UMA_SHADOW=1, Series X profile, two pairs of runs of 300 s, alternating:target pages) at the end0x887a0006136 s after the set-up0x887a000558 s after it0x887a0006160 s after itRegression run (default settings: the switch is off)
main:
PR (this PR's head commit):
A second round of the same two binaries:
main1134 frames, PR 1323.Not tested
AI use
🤖 Generated with Claude Code