Repository navigation
Conversation
…thout video memory Opt-in, off by default: with XCL_TEXTURE_LEVEL_PAGES=1, a sampled texture with lazy levels of XCL_TEXTURE_DROP_MIN texels or more on a side (1024 by default) gives its n largest levels no pages (n = 1 to 4): map_levels skips them unless a GPU write asks for all of them, and has_unmapped_levels does not count them as levels still to map. Its 2D and 2D-array views clamp their level of detail to level n (ResourceMinLODClamp), so it is sampled from the next level down: softer up close, for about three quarters of such a texture's memory a level. Default views are counted, not clamped. Measured in a retail title's world on an 8 GB card (420 s runs, same settings otherwise): local video memory 9,365 MB against 10,229 MB at ~400 s with n = 1 (level pages 2,286 against 3,224 MB), and a peak of about 9.0 GB with n = 2; no view was left unclamped, no crash. Tests: a_view_of_a_texture_without_its_largest_level_samples_from_the_next (the clamp), and the level-pages GPU test places a texture with one level dropped: the smaller levels get pages with their texels, the largest none, it has no level still to map, and a GPU write gives it all of them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
luckyteagirl
left a comment
There was a problem hiding this comment.
An explicit 2D SRV can contain only a mip this option drops. For a valid view with MostDetailedMip=0 and MipLevels=1, the exact clamp_view_to_level helper returns the same one-mip view with ResourceMinLODClamp=1. Mip 1 is outside that view, so this cannot make sampling fall back to the next resident mip as described. The existing clamp test exposes the full chain and misses this case. Could the implementation keep the necessary level resident when the requested view has no intersection with the retained levels, or define and test an explicit fallback for that view? View clamp · D3D12 view fields
AI use: OpenAI Codex (GPT-6.2 Sol) reviewed the source, ran an isolated CPU harness around the exact descriptor helper, and drafted this comment. Shader sampling and retail impact were not measured.
|
AMD data point for the "Not tested" side: on an RX 6800 (RDNA2, driver 32.0.21045.5002, Windows 11 Pro 26200, Rust 1.100.0, debug), this head adds no failure in the texture / vram / view tests.
The one failure is the same on both, Not tested: the switch on the title; RDNA3/4; 8 GB AMD cards. AI use: Claude Code (Claude Opus 5.5) ran the tests through a local runner and wrote this comment. |
|
I checked the previously untested For 1024×1024 RGBA8 textures, mip 0 had red value 25 and mip 1 had red value 48. Each shader wrote one half of a 64×64 output:
Each value above was observed in all 2,048 pixels of its half; the focused test passed without skips. This supports the stated risk that direct loads can see zero even though sampled reads use the next mip. It covers explicit 2D SRVs and this synthetic fixture; console descriptor dispatch, retail image quality, and actual memory savings were not tested. AI use: OpenAI Codex with GPT-6.2 Astra built and ran the fixture; Codex reviewed and prepared this report. |
RTX 3070 8 GB retail loading test of #2968On the clean NVIDIA PR head Tested. RTX 3070 8 GB, NVIDIA 621.40, i9-10900KF, 32 GB RAM, Windows 11 build 26200, Rust 1.100.0 MSVC. Release build with I used the same executable, frozen save, scripted A-button schedule and byte-identical copies of a 1,861-file cache from a 60-second warm-up on this head. The Windows driver cache was retained. Each measured run used the PR’s Each row uses the first complete two-second activity interval past 32,000 cumulative DirectStorage requests. All memory values are MiB. XCL counts a shared page for each owner in its per-owner columns.
At 34,692 and 34,720 requests the one-level and full-detail runs both used 8,143 MiB locally. The sampled-texture counter was 66 MiB lower with one level dropped. At 32,422 and 32,222 requests it was 49 MiB lower, and local use was 128 MiB lower. The textures with all their pages accounted for roughly 3.2 GiB throughout this checkpoint. That group merits allocation-by-use profiling during loading. The last complete intervals were at 124, 138, 170 and 160 seconds, with 58,791, 49,851, 87,979 and 76,108 cumulative requests and zero reported storage failures. The first pair stopped below 2 GiB of available system commit. The repeat pair stopped below 2 GiB of available physical RAM. Sampled frames showed startup and loading artwork in all four runs. The logs recorded zero unhandled exceptions and zero device removals through the stops. Not tested. World-frame rate, world texture quality, longer unguarded runs, other profiles or GPUs, later branch commits, or the additional PRs used in the author's Series S run. The full workspace suite was outside this hardware comparison. AI use. OpenAI Codex (GPT-6, exact serving variant unavailable) built the PR, ran the tests and wrote the analysis and report. |
|
I found two boundary cases for
On Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti (621.35), Rust 1.99.1 MSVC, I ran Failing focused assertion for the restricted SRVdiff --git a/crates/xcl/src/hle/d3d12x/real.rs b/crates/xcl/src/hle/d3d12x/real.rs
index 92c81048..8e91bff4 100644
--- a/crates/xcl/src/hle/d3d12x/real.rs
+++ b/crates/xcl/src/hle/d3d12x/real.rs
@@ -8063,6 +8063,11 @@ mod pso_blend_and_tsharp_tests {
v.Anonymous.Texture2D.ResourceMinLODClamp = 3.0;
assert_eq!(clamp_view_to_level(Some(&v), 1).unwrap().Anonymous.Texture2D.ResourceMinLODClamp, 3.0);
+ // A mip-0-only SRV must still have a level to sample after substitution.
+ v.Anonymous.Texture2D.ResourceMinLODClamp = 0.0;
+ v.Anonymous.Texture2D.MipLevels = 1;
+ let one = clamp_view_to_level(Some(&v), 1).unwrap().Anonymous.Texture2D;
+ assert!(one.ResourceMinLODClamp < one.MipLevels as f32, "the clamp leaves this view no accessible mip");
let a = D3D12_SHADER_RESOURCE_VIEW_DESC { ViewDimension: D3D12_SRV_DIMENSION_TEXTURE2DARRAY, ..Default::default() };AI use: Codex (GPT-6.2 Sol) inspected the production paths and ran the focused assertion; Codex (GPT-6.2 Astra) independently checked the mip-group and descriptor cases. |
|
Tested PR #2968 ( Environment
Unit test
|
| Run | Exit | Crashes / Removals | Frames (PresentX) |
Heavy world start | Peak target pages |
Peak Local VRAM | Peak Non-Local | Peak Commit |
|---|---|---|---|---|---|---|---|---|
Base a5e2d851 (180 s, unset) |
0x0 |
0 / 0 |
1861 |
151.36 s |
3880 MB (pools 3968 MB) |
8974 MB |
4677 MB |
25770 MB |
Base a5e2d851 (240 s, unset) |
0xc0000005 (188.46 s) |
2 / 0 |
— | 126.29 s |
3864 MB (pools 3904 MB) |
9351 MB |
4768 MB |
25909 MB |
#2968 DROP_LEVELS=1 (240 s) |
0xc0000005 (240.48 s) |
2 / 0 |
— | 119.74 s |
3607 MB (3569 MB at crash; pools 3712 MB) |
9478 MB |
5048 MB |
27718 MB |
#2968 DROP_LEVELS=2 (240 s) |
0x0 |
0 / 0 |
1937 (1 1 1 last 3/2s) |
122.15 s |
3337 MB (pools 3392 MB) |
9319 MB |
5165 MB |
28274 MB |
Summary
- Both
DROP_LEVELS=1andDROP_LEVELS=2logged activation cleanly (sampled textures of 1024 texels or more on a side leave their 1/2 largest level(s) without video memory and are sampled from the next one). - Peak
target pagesdropped from3,864–3,880 MBona5e2d851to3,607 MB(DROP_LEVELS=1) and3,337 MB(DROP_LEVELS=2), saving~540 MBin target texture pages at=2. - On this 8 GB card,
DROP_LEVELS=1still hit an unhandled guest exception (0xc0000005at240.483 sexecuting0x1ffffffff), similar to the240 sa5e2d851baseline crash at188.459 s, whereasDROP_LEVELS=2completed the full 240 s open-world run withexit: 0x0,0crashes, and0device removals.
|
Another 8 GB NVIDIA data point, this time stacked with #2987 (sparse tiles in system memory): Setup: RTX 2060 SUPER 8 GB (driver 617.14, no ReBAR), i5-9400F, 16 GB RAM, Windows 11 26300, release. Why the total: dxdiag on this PC shows 8,006 MB dedicated + 8,160 MB shared (half of 16 GB RAM). In my runs of this stack, a Close returns E_OUTOFMEMORY once local + non-local reaches ~14.9–15.0 GB, whichever side the memory is on. So with #2987 moving sparse tiles to non-local, savings like this PR's are the ones that move the end.
AI use: build, run and log analysis by a Claude Code agent (Claude Sonnet 5.5), this note by Claude Code (Claude Opus 5.5). |
Requested by Prime · project thread
With
XCL_TEXTURE_DROP_LEVELS=n(1 to 4; off by default) andXCL_TEXTURE_LEVEL_PAGES=1, a sampled texture with lazy levels whose largest level isXCL_TEXTURE_DROP_MINtexels or more on a side (1024 by default) leaves itsnlargest levels without video memory, and its views sample from the next level down (ResourceMinLODClamp). Textures look softer up close; each dropped level is about three quarters of such a texture's memory. Meant for cards whose video memory a title's world overruns, where the budget overrun costs more than the detail.Part of #2688.
Why
In a retail title's world on an 8 GB card the title's textures held 3.2 GB of level pages and local video memory reached 10.2 GB on a 7.1 GB budget (Series S profile). In runs of the same length with the same settings,
n = 1brought the level pages to 2,286 MB and local video memory to 9,365 MB against 10,229 MB at about 400 s;n = 2(withXCL_TWO_PASS_INDIRECT_MB=8, a local switch) peaked at about 9.0 GB. No view of such a texture was left unclamped, no crash (local branch ofnvidia-devwith #1182, #2921 and #2815 merged in).What is in it
crates/xcl/src/hle/d3d12x/vram.rs:drop_setting/dropped_levels_for(the switch and which textures it takes),Target::droppedset at placement,map_levelsskips the dropped levels unless a GPU write asks for all of them,has_unmapped_levelsignores them,dropped_levelsfor the views.crates/xcl/src/hle/d3d12x/real.rs:dev_create_srv_xclamps a 2D or 2D-array view of such a texture (clamp_view_to_level); default views are counted, not clamped.a_view_of_a_texture_without_its_largest_level_samples_from_the_next(the clamp), and the level-pages GPU test places a texture with one level dropped: the smaller levels get pages with their texels, the largest none, it has no level still to map, and a GPU write gives it all of them.Tested
cargo test --locked --workspace --no-fail-fast -- --test-threads=4withXCL_DXC_DIRset to DXC 1.9.2609.5: 1825 passed, 8 failed, 48 ignored. The 8 failures are the same tests that fail onnvidia-deva5e2d851itself (1820passed,12failed,48ignored there, same command):async_compute_pso_registers_real_pso_and_not_standin,console_ms_in_as_slot_and_ms_with_as_are_refused_cleanly,hle::d3d12x::texture_upload::tests::gpu_parts_of_a_texture_go_up_and_the_rest_stays,hle::d3d12x::texture_upload::tests::pieces_hold_the_texels_of_their_levels,split_compute_prefers_the_offline_whole_pipeline,two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs.Build and test (Windows, no GPU)has failed on other pull requests againstnvidia-dev(kernelx: physical page homes in window 0 first, from the top, keeping 64 MB free (#2867) #2905, for one) onhle::d3d12x::sparse::tests::a_gpu_write_into_a_gpu_view_lands_in_its_cpu_view(the WARP device is removed, 0x887a0005). That test passes on the card above, on this branch and ona5e2d851.Regression run
A commit of
main(b49be183, the last one before the shader preparation screen of #2555, which prepares every record before the title and so does not fit a 60 s run):The base of this PR,
nvidia-deva5e2d851:This PR's head:
Not tested
Load(no level of detail) reads zeros there; sampling is clamped.AI use
Claude Code (Claude Opus 5.5) wrote the code, ran the suite and the regression runs on the hardware above, and wrote this description; Prime asked for it and owns the account. We coordinate the 8 GB work on the XCL Discord too: https://discord.gg/6B4TykyC4W
🤖 Generated with Claude Code