D3D12.X: sampled textures go without their top mips while video memory fills up #2375

Open
NWProgramming00 wants to merge 3 commits from upstream-pr/2385 into main
NWProgramming00 commented 2026-11-25 17:37:03 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by NWProgramming00 on 2026-11-25T17:37:03Z.


When the device's video memory fills up, new sampled title textures get no memory for their largest mips. Every view of such a texture is clamped to the first mip it has. A texture then gets less sharp up close instead of pushing the card past its budget. Part of #1773.

Rebased onto main 0fe06eb (heads 000235b, 6ceff57, acad90b). 005a442 had come into main with #3203 (a merge of a fork's branch), together with that fork's revert of it, so main holds none of it and GitHub showed a conflict. The rebase puts the three commits back on top. vram.rs had changed a lot since (reserved texture recycling, texel accounting, the allocation class of pool tiles): bind / bind_range now take both main's evictable and this PR's skip, and Target keeps both main's texels / recycle and this PR's skip_mips / skip. A recycled resource does not keep what an earlier texture left out: releasing it (forget_pages) drops the record, as before.

What it does

  • When it applies. Local video memory is read from QueryVideoMemoryInfo, at most every 100 ms. Past 75 % of the budget, a new sampled texture keeps a largest side of at most:
    • 2048 from 75 %,
    • 1024 from 85 %,
    • 512 from 92 %.
  • Which tiles go. The top mips' tiles are not taken from the pools and stay unmapped. With tiled resources tier 2 they read as zero.
    • The resource keeps its shape and mip numbering.
    • The title's uploads still go to it; the ones into those mips go nowhere.
    • Render targets, depth buffers and UAV textures always keep all their memory.
  • Views. Every SRV of such a texture gets ResourceMinLODClamp = the mips left out, so sampling never reaches them. The clamp counts from the resource's first mip, not the view's; the new GPU test checks this.
  • Switches.
    • XCL_TEXTURE_BUDGET=0 turns it off.
    • XCL_TEXTURE_MAX=<texels> caps every new sampled texture at that size, whatever the fill. It is meant for tests and measurements.
  • Log. XCL_ACTIVITY's memory: line gives the textures alive now without their top mips, and the MB of tiles they leave unmapped.

What is in it

  • crates/xcl/src/hle/d3d12x/vram.rs:
    • the fill check and the cap (texture_cap, cap_for_fill, mips_to_skip);
    • the tiles of the top mips (top_mip_tiles, top_mip_mask);
    • Pages::bind / bind_range map all tiles but the masked ones; the mask is kept for remap_if_unmapped;
    • with lazy levels (XCL_TEXTURE_LEVEL_PAGES=1, #1773) the left-out levels never get pages in map_levels (groups_to_map);
    • the per-resource record, dropped when the resource goes, and clamp_skipped_mips.
  • crates/xcl/src/hle/d3d12x/real.rs: dev_create_srv_x clamps the views of such a texture. When the title passes no description, it builds the default 2D view first.
  • crates/xcl/src/host.rs: the counts on the memory: line. The MB there count each left-out 64 KiB page once, and not while another texture at that address still has it (skipped_textures, skipped_pages; textures placed at one address share pages).
  • Tests in vram.rs:
    • the_cap_follows_how_full_video_memory_is and top_mips_go_until_the_largest_side_fits_and_one_tiled_mip_stays.
    • lazy_levels_never_map_the_top_mips_left_out: with lazy levels, the left-out levels never get pages, the others once.
    • left_out_tiles_name_the_pages_bind_would_give_them: left-out tiles are keyed as Pages::bind keys them, so two textures at one address name the same pages.
    • gpu_a_texture_without_its_top_mip_samples_the_first_it_has, a GPU test. It binds a 512×512 4-mip reserved texture without mip 0 through Pages::bind and uploads every mip. Then it samples through three views:
      • clamped to mip 1, it reads mip 1;
      • a view from mip 1 clamped to 2 reads mip 2, not mip 3;
      • unclamped, it reads zero from mip 0.
    • gpu_a_texture_without_its_top_mip_filters_like_the_clamp_alone, a GPU test of the filtered picture. It makes two copies of one 256×256 texture with nine mips, whose mip 0 holds a colour (red) that no other mip has. One copy has mip 0 left out through Pages::bind and its view clamped; the other has every mip in memory and the same clamp. It samples both into 64×64 pictures with trilinear and with 16× anisotropic filtering, over level of detail −3 to +3, anisotropy 1 to 16 and footprints turned 45°.
      • The two pictures are the same to the bit, and neither has any red: the left-out mip adds nothing to any pixel, not even a filter tap reading zero.
      • Without the clamp the same samples do show red, so the samples reach mip 0.

Tested

  • Windows 11, NVIDIA GeForce RTX 5070 Ti 16 GB and an AMD Radeon RDNA2 iGPU (gfx1036, XCL_ADAPTER=radeon), AMD Ryzen 7 9700X, drivers 32.0.16.2124 (NVIDIA) and 32.0.21042.62 (AMD), Rust 1.100 MSVC, release.
  • The whole suite, after the rebase (acad90b): cargo build --release --workspace, then cargo test --release --workspace --no-fail-fast -- --test-threads=4, with and without XCL_DIRECT_DXIL=all, against base main 0fe06eb on the same machine:
Adapter Mode base 0fe06eb this PR (acad90b)
RTX 5070 Ti default 2737 passed, 0 failed, 49 ignored 2743 passed, 0 failed, 49 ignored
RTX 5070 Ti XCL_DIRECT_DXIL=all 2736 passed, 1 failed, 49 ignored 2743 passed, 0 failed, 49 ignored
Radeon gfx1036 default 138 passed, 1 failed, 20 ignored 138 passed, 1 failed, 20 ignored
Radeon gfx1036 XCL_DIRECT_DXIL=all 138 passed, 1 failed, 20 ignored 138 passed, 1 failed, 20 ignored
  • The +6 are this PR's tests.

  • The one failure is two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs (gpu_two_pass_cache_e2e). It is not stable on this machine: base failed it in 3 of 3 reruns of that test alone.

  • On the Radeon, both base and PR stop in the same place: the xcl lib test process exits with 0x80004005 after hle::d3d12x::bind tests. So only 138 tests are counted there.

  • Because of that, I ran the vram tests alone on each adapter: cargo test --release -p xcl --lib d3d12x::vram -- --include-ignored --skip churn_update. They gave 75 passed, 0 failed on each, the GPU tests included.

  • After the rebase, with the mask ignored in bind_range, both GPU tests fail.

  • Before the rebase (on base e44af70, same machine), the suite gave the same failures on base and PR, +4 tests. Each of three deliberate mistakes made the new GPU test fail on both adapters: the clamp one mip too low, the mask ignored in bind, and mip 0 left out of the mask.

  • The picture test (4c4c577, a test only) passes on both adapters: 0 of 4,096 pixels differ with either filter, no red with the clamp, and red without it in 1,240 (trilinear) and 2,529 (anisotropic) pixels on the RTX 5070 Ti, 1,376 and 2,716 on the Radeon. With the clamp taken out of clamp_skipped_mips, it fails: 1,240 pixels differ, the zeros of the missing mip filtered in. cargo test -p xcl --lib vram::tests -- --test-threads=1: 25 passed, 0 failed, 1 ignored.

  • A retail title, 300 s runs that reach world loading (XCL_ACTIVITY=1, A pressed at 15–65 s, RTX 5070 Ti; made before the rebase onto e44af70, on base 06c9f55):

run video memory, end texture pages, end textures without top mips now frames
main 06c9f55 12,366 MB 7,843 MB – 4,055
this PR, default 12,824 MB 8,551 MB 126 (331 MB) 3,270
this PR, XCL_TEXTURE_MAX=1024 10,775 MB 6,331 MB 1,500 (3,709 MB) 6,751
  • On this 16 GB card the title stays near 80 % of the budget, so the default policy only starts late (137 s here).
  • The forced cap shows what a card whose budget fills early gets: 3.7 GB of texture tiles stay out of video memory, and the run went further into the world with the most frames.
  • Runs reach world loading at different times from run to run. A main run on the Radeon iGPU reached it too, and the frames then stop at the known wait after ListX #101 (#505). So I do not claim that this PR gets the title further.

Regression run
Both runs with XCL_PREPARE=0: it skips the startup shader preparation that #2555 added (about 5 hours from an empty cache here), so the title starts as it did before #2555. The two runs differ only in the commit.

Base (main 0fe06eb), NVIDIA GeForce RTX 5070 Ti:

xcl-smoke v1
commit: 0fe06eb0f05459007ebfffc67bb9983acb3a832d
gpu: NVIDIA GeForce RTX 5070 Ti
title: title-a
seconds: 60
exit: 0x0
frames shown: 1527 (PresentX 1527)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15504 MB

This PR (acad90b), same card, run right after:

xcl-smoke v1
commit: acad90b01b24a0ece58dc641f776bf820bd4adbe
gpu: NVIDIA GeForce RTX 5070 Ti
title: title-a
seconds: 60
exit: 0x0
frames shown: 1672 (PresentX 1672)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15131 MB

These 60 s runs end in the title's menus, before any texture is left without its top mips (video memory stays far under 75 % of the budget there). So they check that nothing else changed; the 300 s runs above are the ones that reach this code.

Not tested

  • A card with 8 GB, where this should matter most. Here it keeps 3.7 GB out of video memory when the cap applies, but I could not show a device removal avoided. @Royalflamejlh's runs on a 12 GB RTX 4070 (Linux, Wine, in the comments) had the budget switch on at 46–51 s and about 3 GB less spill into non-local memory, with no device removal with or without it. A run on an 8 GB card (#646, #1337, #320) would settle it.
  • How the title looks with textures capped. The picture test above shows a texture without its top mip looks exactly as the same texture with the view clamp alone, i.e. one mip less sharp; it does not show frames of a title.
  • 3D textures, 1D textures, MSAA and textures that are not tiled. These always keep all their mips.
  • Loads of the left-out mips (Load, mips queries). They are not clamped by a view, and read zero there.
  • The 300 s world-loading runs after the rebase.
  • The title's uploads into the left-out mips are still made and detiled. Leaving them out would save CPU time while the world streams; that is for a later PR.
  • RDNA3 / RDNA4, Intel.

AI use

  • Claude Code (Claude Opus 5.5) did the work: it wrote the code and the tests, did the rebase, ran the mutation checks, the suites and the title runs, and wrote this description.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5496153783 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2385). Originally posted by [NWProgramming00](https://github.com/NWProgramming00) on 2026-11-25T17:37:03Z. --- When the device's video memory fills up, new sampled title textures get no memory for their largest mips. Every view of such a texture is clamped to the first mip it has. A texture then gets less sharp up close instead of pushing the card past its budget. Part of #1773. **Rebased onto `main` `0fe06eb`** (heads `000235b`, `6ceff57`, `acad90b`). `005a442` had come into `main` with #3203 (a merge of a fork's branch), together with that fork's revert of it, so `main` holds none of it and GitHub showed a conflict. The rebase puts the three commits back on top. `vram.rs` had changed a lot since (reserved texture recycling, texel accounting, the allocation class of pool tiles): `bind` / `bind_range` now take both `main`'s `evictable` and this PR's `skip`, and `Target` keeps both `main`'s `texels` / `recycle` and this PR's `skip_mips` / `skip`. A recycled resource does not keep what an earlier texture left out: releasing it (`forget_pages`) drops the record, as before. **What it does** - **When it applies.** Local video memory is read from `QueryVideoMemoryInfo`, at most every 100 ms. Past 75 % of the budget, a new sampled texture keeps a largest side of at most: - 2048 from 75 %, - 1024 from 85 %, - 512 from 92 %. - **Which tiles go.** The top mips' tiles are not taken from the pools and stay unmapped. With tiled resources tier 2 they read as zero. - The resource keeps its shape and mip numbering. - The title's uploads still go to it; the ones into those mips go nowhere. - Render targets, depth buffers and UAV textures always keep all their memory. - **Views.** Every SRV of such a texture gets `ResourceMinLODClamp` = the mips left out, so sampling never reaches them. The clamp counts from the resource's first mip, not the view's; the new GPU test checks this. - **Switches.** - `XCL_TEXTURE_BUDGET=0` turns it off. - `XCL_TEXTURE_MAX=<texels>` caps every new sampled texture at that size, whatever the fill. It is meant for tests and measurements. - **Log.** `XCL_ACTIVITY`'s `memory:` line gives the textures alive now without their top mips, and the MB of tiles they leave unmapped. **What is in it** - `crates/xcl/src/hle/d3d12x/vram.rs`: - the fill check and the cap (`texture_cap`, `cap_for_fill`, `mips_to_skip`); - the tiles of the top mips (`top_mip_tiles`, `top_mip_mask`); - `Pages::bind` / `bind_range` map all tiles but the masked ones; the mask is kept for `remap_if_unmapped`; - with lazy levels (`XCL_TEXTURE_LEVEL_PAGES=1`, #1773) the left-out levels never get pages in `map_levels` (`groups_to_map`); - the per-resource record, dropped when the resource goes, and `clamp_skipped_mips`. - `crates/xcl/src/hle/d3d12x/real.rs`: `dev_create_srv_x` clamps the views of such a texture. When the title passes no description, it builds the default 2D view first. - `crates/xcl/src/host.rs`: the counts on the `memory:` line. The MB there count each left-out 64 KiB page once, and not while another texture at that address still has it (`skipped_textures`, `skipped_pages`; textures placed at one address share pages). - Tests in `vram.rs`: - `the_cap_follows_how_full_video_memory_is` and `top_mips_go_until_the_largest_side_fits_and_one_tiled_mip_stays`. - `lazy_levels_never_map_the_top_mips_left_out`: with lazy levels, the left-out levels never get pages, the others once. - `left_out_tiles_name_the_pages_bind_would_give_them`: left-out tiles are keyed as `Pages::bind` keys them, so two textures at one address name the same pages. - `gpu_a_texture_without_its_top_mip_samples_the_first_it_has`, a GPU test. It binds a 512×512 4-mip reserved texture without mip 0 through `Pages::bind` and uploads every mip. Then it samples through three views: - clamped to mip 1, it reads mip 1; - a view from mip 1 clamped to 2 reads mip 2, not mip 3; - unclamped, it reads zero from mip 0. - `gpu_a_texture_without_its_top_mip_filters_like_the_clamp_alone`, a GPU test of the filtered picture. It makes two copies of one 256×256 texture with nine mips, whose mip 0 holds a colour (red) that no other mip has. One copy has mip 0 left out through `Pages::bind` and its view clamped; the other has every mip in memory and the same clamp. It samples both into 64×64 pictures with trilinear and with 16× anisotropic filtering, over level of detail −3 to +3, anisotropy 1 to 16 and footprints turned 45°. - The two pictures are the same to the bit, and neither has any red: the left-out mip adds nothing to any pixel, not even a filter tap reading zero. - Without the clamp the same samples do show red, so the samples reach mip 0. **Tested** - Windows 11, NVIDIA GeForce RTX 5070 Ti 16 GB and an AMD Radeon RDNA2 iGPU (gfx1036, `XCL_ADAPTER=radeon`), AMD Ryzen 7 9700X, drivers 32.0.16.2124 (NVIDIA) and 32.0.21042.62 (AMD), Rust 1.100 MSVC, release. - **The whole suite, after the rebase** (`acad90b`): `cargo build --release --workspace`, then `cargo test --release --workspace --no-fail-fast -- --test-threads=4`, with and without `XCL_DIRECT_DXIL=all`, against base `main` `0fe06eb` on the same machine: | Adapter | Mode | base `0fe06eb` | this PR (`acad90b`) | |---|---|---|---| | RTX 5070 Ti | default | 2737 passed, 0 failed, 49 ignored | 2743 passed, 0 failed, 49 ignored | | RTX 5070 Ti | `XCL_DIRECT_DXIL=all` | 2736 passed, 1 failed, 49 ignored | 2743 passed, 0 failed, 49 ignored | | Radeon gfx1036 | default | 138 passed, 1 failed, 20 ignored | 138 passed, 1 failed, 20 ignored | | Radeon gfx1036 | `XCL_DIRECT_DXIL=all` | 138 passed, 1 failed, 20 ignored | 138 passed, 1 failed, 20 ignored | - The +6 are this PR's tests. - The one failure is `two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs` (`gpu_two_pass_cache_e2e`). It is not stable on this machine: base failed it in 3 of 3 reruns of that test alone. - On the Radeon, both base and PR stop in the same place: the `xcl` lib test process exits with `0x80004005` after `hle::d3d12x::bind` tests. So only 138 tests are counted there. - Because of that, I ran the `vram` tests alone on each adapter: `cargo test --release -p xcl --lib d3d12x::vram -- --include-ignored --skip churn_update`. They gave 75 passed, 0 failed on each, the GPU tests included. - After the rebase, with the mask ignored in `bind_range`, both GPU tests fail. - **Before the rebase** (on base `e44af70`, same machine), the suite gave the same failures on base and PR, +4 tests. Each of three deliberate mistakes made the new GPU test fail on both adapters: the clamp one mip too low, the mask ignored in `bind`, and mip 0 left out of the mask. - **The picture test** (`4c4c577`, a test only) passes on both adapters: 0 of 4,096 pixels differ with either filter, no red with the clamp, and red without it in 1,240 (trilinear) and 2,529 (anisotropic) pixels on the RTX 5070 Ti, 1,376 and 2,716 on the Radeon. With the clamp taken out of `clamp_skipped_mips`, it fails: 1,240 pixels differ, the zeros of the missing mip filtered in. `cargo test -p xcl --lib vram::tests -- --test-threads=1`: 25 passed, 0 failed, 1 ignored. - **A retail title, 300 s runs that reach world loading** (`XCL_ACTIVITY=1`, A pressed at 15–65 s, RTX 5070 Ti; made before the rebase onto `e44af70`, on base `06c9f55`): | run | video memory, end | texture pages, end | textures without top mips now | frames | |---|---|---|---|---| | `main` `06c9f55` | 12,366 MB | 7,843 MB | – | 4,055 | | this PR, default | 12,824 MB | 8,551 MB | 126 (331 MB) | 3,270 | | this PR, `XCL_TEXTURE_MAX=1024` | 10,775 MB | 6,331 MB | 1,500 (3,709 MB) | 6,751 | - On this 16 GB card the title stays near 80 % of the budget, so the default policy only starts late (137 s here). - The forced cap shows what a card whose budget fills early gets: 3.7 GB of texture tiles stay out of video memory, and the run went further into the world with the most frames. - Runs reach world loading at different times from run to run. A `main` run on the Radeon iGPU reached it too, and the frames then stop at the known wait after `ListX #101` (#505). So I do not claim that this PR gets the title further. **Regression run** Both runs with `XCL_PREPARE=0`: it skips the startup shader preparation that #2555 added (about 5 hours from an empty cache here), so the title starts as it did before #2555. The two runs differ only in the commit. Base (`main` `0fe06eb`), NVIDIA GeForce RTX 5070 Ti: ``` xcl-smoke v1 commit: 0fe06eb0f05459007ebfffc67bb9983acb3a832d gpu: NVIDIA GeForce RTX 5070 Ti title: title-a seconds: 60 exit: 0x0 frames shown: 1527 (PresentX 1527) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15504 MB ``` This PR (`acad90b`), same card, run right after: ``` xcl-smoke v1 commit: acad90b01b24a0ece58dc641f776bf820bd4adbe gpu: NVIDIA GeForce RTX 5070 Ti title: title-a seconds: 60 exit: 0x0 frames shown: 1672 (PresentX 1672) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15131 MB ``` These 60 s runs end in the title's menus, before any texture is left without its top mips (video memory stays far under 75 % of the budget there). So they check that nothing else changed; the 300 s runs above are the ones that reach this code. **Not tested** - **A card with 8 GB, where this should matter most.** Here it keeps 3.7 GB out of video memory when the cap applies, but I could not show a device removal avoided. @Royalflamejlh's runs on a 12 GB RTX 4070 (Linux, Wine, in the comments) had the budget switch on at 46–51 s and about 3 GB less spill into non-local memory, with no device removal with or without it. A run on an 8 GB card (#646, #1337, #320) would settle it. - **How the title looks** with textures capped. The picture test above shows a texture without its top mip looks exactly as the same texture with the view clamp alone, i.e. one mip less sharp; it does not show frames of a title. - **3D textures, 1D textures, MSAA and textures that are not tiled.** These always keep all their mips. - **Loads of the left-out mips** (`Load`, `mips` queries). They are not clamped by a view, and read zero there. - **The 300 s world-loading runs after the rebase.** - **The title's uploads into the left-out mips are still made and detiled.** Leaving them out would save CPU time while the world streams; that is for a later PR. - RDNA3 / RDNA4, Intel. **AI use** - Claude Code (Claude Opus 5.5) did the work: it wrote the code and the tests, did the rebase, ran the mutation checks, the suites and the title runs, and wrote this description. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
emirduran707 commented 2026-11-25 19:09:08 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by emirduran707 on 2026-11-25T18:34:41Z.


Independent AMD RDNA4 (native wave64) test report on exact head 61b2f2c8d5200eb2c8bd1f2506af89595e46d122 (clean detached checkout, no local changes).

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4, native wave64, driver 32.0.31044.16), Ryzen 5 5600, 32 GB RAM, Windows 11 Pro 26300, Rust 1.100.0 (stable-x86_64-pc-windows-msvc), DXC 1.9.2602.17; tests debug, smoke release.
  • cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4: 1266 passed, 2 failed, 46 ignored; 8 SKIPPED (6 in lower_dxil::tests::{f16,f32}_programs_on_the_gpu refused by per-lane form; heap_window_out_of_memory_falls_back_to_the_switch_form; pso_measurement_compiles_an_exact_synthetic_record). All native wave64 GPU tests ran and passed.
    • The PR's test passed: hle::d3d12x::vram::tests::the_cap_follows_how_full_video_memory_is.
    • The 2 failures (gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 seed 722 and fuzz_validate_and_gpu_3 seed 1599) are pre-existing on unmodified main on this GPU.

Regression run (60 s retail-title smoke, XCL_NETWORK=0, release; 16 GB VRAM so this run does not hit the high-fill mip-skipping threshold)

xcl-smoke v1
commit: 61b2f2c8d5200eb2c8bd1f2506af89595e46d122
gpu: AMD Radeon RX 9060 XT
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1569 (PresentX 1569)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15174 MB

(Matched main 68a284a baseline on the same machine today: 1573 frames, 14420 MB peak, 0 device removals, 0 crashes.)

Not tested

  • Low-VRAM (8 GB) pressure path in the retail title; D3D12 debug layer; Intel GPUs.

AI use

  • Antigravity with Gemini 4 Neon ran the build, test suite, and smoke run and drafted this report.
<!-- greyfinch-sync:ivall/xcl:comment:7171100526 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2385#issuecomment-7171100526). Originally posted by [emirduran707](https://github.com/emirduran707) on 2026-11-25T18:34:41Z. --- Independent AMD RDNA4 (native wave64) test report on exact head `61b2f2c8d5200eb2c8bd1f2506af89595e46d122` (clean detached checkout, no local changes). **Tested** - AMD Radeon RX 9060 XT 16 GB (RDNA4, native wave64, driver 32.0.31044.16), Ryzen 5 5600, 32 GB RAM, Windows 11 Pro 26300, Rust 1.100.0 (`stable-x86_64-pc-windows-msvc`), DXC 1.9.2602.17; tests debug, smoke release. - `cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4`: **1266 passed, 2 failed, 46 ignored; 8 SKIPPED** (6 in `lower_dxil::tests::{f16,f32}_programs_on_the_gpu` refused by per-lane form; `heap_window_out_of_memory_falls_back_to_the_switch_form`; `pso_measurement_compiles_an_exact_synthetic_record`). All native wave64 GPU tests ran and passed. - The PR's test passed: `hle::d3d12x::vram::tests::the_cap_follows_how_full_video_memory_is`. - The 2 failures (`gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1` seed 722 and `fuzz_validate_and_gpu_3` seed 1599) are pre-existing on unmodified `main` on this GPU. **Regression run** (60 s retail-title smoke, `XCL_NETWORK=0`, release; 16 GB VRAM so this run does not hit the high-fill mip-skipping threshold) ``` xcl-smoke v1 commit: 61b2f2c8d5200eb2c8bd1f2506af89595e46d122 gpu: AMD Radeon RX 9060 XT title: 21222967 seconds: 60 exit: 0x0 frames shown: 1569 (PresentX 1569) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15174 MB ``` (Matched `main` `68a284a` baseline on the same machine today: 1573 frames, 14420 MB peak, 0 device removals, 0 crashes.) **Not tested** - Low-VRAM (8 GB) pressure path in the retail title; D3D12 debug layer; Intel GPUs. **AI use** - Antigravity with Gemini 4 Neon ran the build, test suite, and smoke run and drafted this report.
DavidM1911 commented 2026-11-25 20:08:35 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T19:27:56Z.


Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: 1038 passed, 1 failed in one parallel run; the failing test passes on a single-threaded rerun (1039/0). Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7172333159 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2385#issuecomment-7172333159). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T19:27:56Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: 1038 passed, 1 failed in one parallel run; the failing test passes on a single-threaded rerun (1039/0). Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun. Thanks!
bmjask commented 2026-11-25 20:32:28 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-11-25T20:32:28Z.

Review: COMMENTED


No concrete code defect found, and the mapping/SRV clamping coverage is useful. Before merge, please provide low-VRAM (8-12 GB) title and visual/image validation, since this deliberately changes texture fidelity in the scenario it targets. The disclosed Load/mip-query zeros for skipped mips and discarded CPU detiling should remain explicit. Also reconcile intended coexistence with #640, which targets the same #1773 VRAM-pressure problem, to avoid competing strategies.

<!-- greyfinch-sync:ivall/xcl:review:6064561356 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2385#pullrequestreview-6064561356). Originally posted by [bmjask](https://github.com/bmjask) on 2026-11-25T20:32:28Z. **Review:** COMMENTED --- No concrete code defect found, and the mapping/SRV clamping coverage is useful. Before merge, please provide low-VRAM (8-12 GB) title and visual/image validation, since this deliberately changes texture fidelity in the scenario it targets. The disclosed Load/mip-query zeros for skipped mips and discarded CPU detiling should remain explicit. Also reconcile intended coexistence with #640, which targets the same #1773 VRAM-pressure problem, to avoid competing strategies.
throny commented 2026-11-25 21:05:16 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-25T20:28:28Z.


Two contributors checked independently and found that #640 solves the same problem (for #1773) in a different way: #1607, group D111. You may want to compare them with the other author and agree on one, or say in the PR why both are needed.

This is a hint from the community triage in #1607, not a maintainer decision.

AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.

<!-- greyfinch-sync:ivall/xcl:comment:7173723437 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2385#issuecomment-7173723437). Originally posted by [throny](https://github.com/throny) on 2026-11-25T20:28:28Z. --- <!-- xcl-1607-hint:D111 --> Two contributors checked independently and found that #640 solves the same problem (for #1773) in a different way: #1607, group D111. You may want to compare them with the other author and agree on one, or say in the PR why both are needed. This is a hint from the community triage in #1607, not a maintainer decision. AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
anes66 commented 2026-11-25 21:05:29 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by anes66 on 2026-11-25T21:02:39Z.


CPU coverage on exact head 005a442 on native Windows, with an optional test-only companion commit: bb26dd5.

Tested

  • Windows 10 22H2 (19045), Ryzen 7 9800X3D, Rust 1.100.0 MSVC, debug. CPU tests only; no adapter query, GPU device creation or dispatch.
  • Unmodified head, selected pure CPU tests the_cap_follows_how_full_video_memory_is, top_mips_go_until_the_largest_side_fits_and_one_tiled_mip_stays and lazy_levels_never_map_the_top_mips_left_out: 3 passed, 0 failed, 0 ignored, 0 skipped.
  • With bb26dd5, those three plus the three new cpu_* tests: 6 passed, 0 failed, 0 ignored, 0 skipped. Command: cargo test --locked -p xcl --lib -j2 -- --nocapture --test-threads=1 hle::d3d12x::vram::tests::cpu_ the_cap_follows_how_full_video_memory_is top_mips_go_until_the_largest_side_fits_and_one_tiled_mip_stays lazy_levels_never_map_the_top_mips_left_out.

The 97-line companion commit adds:

  • 270 tile-mask cases over 1/2/6 slices, different mip counts, gaps, reversed tile placement and packed tails. A separate tile-owner map defines the expected mask.
  • 1,040 checks that mip skipping is minimal, monotone in the cap and keeps the final standard mip.
  • 144 view-clamp cases over 2D, arrays, cubes and cube arrays. Existing stronger LOD clamps, view ranges, plane slices, format and component mapping are preserved.

Negative controls, restored before the final passing run: limiting the mask to the first slice fails the array cases; replacing the LOD clamp instead of taking its maximum fails the existing-clamp cases.

Not tested

  • Your GPU sampling regression, adapter budget queries, full workspace suite or a title with this PR on this machine. The tests establish CPU helper behavior, not visual correctness or a measured memory saving.

The companion commit is authored as anes66; please preserve its author if you carry the tests into your branch. The runtime change remains yours.


RTX 3060 12 GB manual title follow-up, 25 November

One manual run on Windows 10 22H2, release head f169760 (main 6d12f58 + XG ABI fix #1435 + your exact head 005a442 + test-only commits). XCL_TEXTURE_BUDGET=1, no forced XCL_TEXTURE_MAX, XCL_PSO_TRACE=1. Both huge-compile worker limits were set to 1; the earlier comparison run set only XCL_HUGE_PSO_CONCURRENCY=1, leaving the wanted limit at its default 2. Existing saves/caches were retained.

At approximately the same elapsed time (~764 s), XCL's memory lines report the following (MB as logged):

Metric 6d12f58 + #1435 (5cb01ab) With #2385 (f169760)
Process commit 29,048 26,222
Local video memory 12,606 10,658
Non-local video memory 4,946 4,983
Target pages 8,495 6,624
Pool heaps 8,768 6,912

The budget run was closed manually after about 50 min 25 s: exit 0, crash: null, no device-removal or 0x8007000E message. Final local video memory was 11,057 MB; the policy reported top mips omitted for 2,685 textures / 4,765 MB of tiles. The latter is the policy's tile counter, not a claim of that much net VRAM saved. Sampled peak private bytes were 28,367 MiB, peak working set 16,909 MiB, and minimum available physical memory 2,532 MiB.

The black screen remains. The last nonzero presents activity sample is at 501.816 s. Another 582 logged driver calls finish after it; a read-only, non-suspending stack snapshot finds pso_async::resolve_wait under list_x::record_deferred and another thread inside nvgpucomp64. Driver work continues, but no new frames arrive before closure at 3,021 s. Final report: 2,065 translated pipelines, 40 translation errors, 283 DXIL compilations / 0 compilation failures.

Limits: one run per profile, different cache warm-up and the wanted-limit change, so this does not isolate your patch's effect. No visual correctness or playability established; no image-quality comparison was possible. Raw title logs, stack dumps and proprietary files are not uploaded.

<!-- greyfinch-sync:ivall/xcl:comment:7174532792 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2385#issuecomment-7174532792). Originally posted by [anes66](https://github.com/anes66) on 2026-11-25T21:02:39Z. --- CPU coverage on exact head `005a442` on native Windows, with an optional test-only companion commit: [bb26dd5](https://github.com/anes66/xcl/commit/bb26dd5a78c84307880c437f72b558cc25e28a22). **Tested** - Windows 10 22H2 (19045), Ryzen 7 9800X3D, Rust 1.100.0 MSVC, debug. CPU tests only; no adapter query, GPU device creation or dispatch. - Unmodified head, selected pure CPU tests `the_cap_follows_how_full_video_memory_is`, `top_mips_go_until_the_largest_side_fits_and_one_tiled_mip_stays` and `lazy_levels_never_map_the_top_mips_left_out`: 3 passed, 0 failed, 0 ignored, 0 skipped. - With `bb26dd5`, those three plus the three new `cpu_*` tests: 6 passed, 0 failed, 0 ignored, 0 skipped. Command: `cargo test --locked -p xcl --lib -j2 -- --nocapture --test-threads=1 hle::d3d12x::vram::tests::cpu_ the_cap_follows_how_full_video_memory_is top_mips_go_until_the_largest_side_fits_and_one_tiled_mip_stays lazy_levels_never_map_the_top_mips_left_out`. The 97-line companion commit adds: - 270 tile-mask cases over 1/2/6 slices, different mip counts, gaps, reversed tile placement and packed tails. A separate tile-owner map defines the expected mask. - 1,040 checks that mip skipping is minimal, monotone in the cap and keeps the final standard mip. - 144 view-clamp cases over 2D, arrays, cubes and cube arrays. Existing stronger LOD clamps, view ranges, plane slices, format and component mapping are preserved. Negative controls, restored before the final passing run: limiting the mask to the first slice fails the array cases; replacing the LOD clamp instead of taking its maximum fails the existing-clamp cases. **Not tested** - Your GPU sampling regression, adapter budget queries, full workspace suite or a title with this PR on this machine. The tests establish CPU helper behavior, not visual correctness or a measured memory saving. The companion commit is authored as `anes66`; please preserve its author if you carry the tests into your branch. The runtime change remains yours. --- **RTX 3060 12 GB manual title follow-up, 25 November** One manual run on Windows 10 22H2, release head `f169760` (`main` `6d12f58` + XG ABI fix #1435 + your exact head `005a442` + test-only commits). `XCL_TEXTURE_BUDGET=1`, no forced `XCL_TEXTURE_MAX`, `XCL_PSO_TRACE=1`. Both huge-compile worker limits were set to 1; the earlier comparison run set only `XCL_HUGE_PSO_CONCURRENCY=1`, leaving the wanted limit at its default 2. Existing saves/caches were retained. At approximately the same elapsed time (~764 s), XCL's memory lines report the following (MB as logged): | Metric | `6d12f58` + #1435 (`5cb01ab`) | With #2385 (`f169760`) | |---|---:|---:| | Process commit | 29,048 | 26,222 | | Local video memory | 12,606 | 10,658 | | Non-local video memory | 4,946 | 4,983 | | Target pages | 8,495 | 6,624 | | Pool heaps | 8,768 | 6,912 | The budget run was closed manually after about 50 min 25 s: exit 0, `crash: null`, no device-removal or `0x8007000E` message. Final local video memory was 11,057 MB; the policy reported top mips omitted for 2,685 textures / 4,765 MB of tiles. The latter is the policy's tile counter, not a claim of that much net VRAM saved. Sampled peak private bytes were 28,367 MiB, peak working set 16,909 MiB, and minimum available physical memory 2,532 MiB. **The black screen remains.** The last nonzero presents activity sample is at 501.816 s. Another 582 logged driver calls finish after it; a read-only, non-suspending stack snapshot finds `pso_async::resolve_wait` under `list_x::record_deferred` and another thread inside `nvgpucomp64`. Driver work continues, but no new frames arrive before closure at 3,021 s. Final report: 2,065 translated pipelines, 40 translation errors, 283 DXIL compilations / 0 compilation failures. **Limits:** one run per profile, different cache warm-up and the wanted-limit change, so this does not isolate your patch's effect. No visual correctness or playability established; no image-quality comparison was possible. Raw title logs, stack dumps and proprietary files are not uploaded.
oni-swr commented 2026-11-25 22:06:37 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by oni-swr on 2026-11-25T21:11:20Z.


Tested

  • Windows 11 Pro build 26200; AMD Radeon RX 7800 XT 16 GB (driver 32.0.31035.1003); AMD Ryzen 7 5700X3D CPU; Rust 1.100.0 MSVC; DXC/DXIL 1.8.2502.11 from Windows SDK 10.0.26100.0. Debug profile. XCL_ADAPTER=radeon.
  • Tested exact PR head 005a4427d2926f29d96ea28bf6747dc70321806c. Baseline origin/main was 6d12f58a229bc73889878a448c64dc3af25eeba0.
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 1,342 passed, 2 failed, 46 ignored, 18 SKIPPED notices (exit 101). One failure, gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1, also failed on baseline. The other, gpu::recomp::lower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier, passed on baseline.
  • cargo test -p xcl --lib gpu_a_texture_without_its_top_mip_samples_the_first_it_has -- --test-threads=1: 1 passed, 0 failed, 0 ignored, 0 skipped; ran on the RX 7800 XT.
  • Current-main baseline cargo test --workspace --no-fail-fast -- --test-threads=4: 1,422 passed, 1 failed, 46 ignored, 25 SKIPPED notices (exit 101).

Not tested

  • A retail title or game data; no dumps were used.

AI use

  • Codex (gpt-6-luna) ran the tests and prepared this report.
<!-- greyfinch-sync:ivall/xcl:comment:7174730941 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2385#issuecomment-7174730941). Originally posted by [oni-swr](https://github.com/oni-swr) on 2026-11-25T21:11:20Z. --- **Tested** - Windows 11 Pro build 26200; AMD Radeon RX 7800 XT 16 GB (driver 32.0.31035.1003); AMD Ryzen 7 5700X3D CPU; Rust 1.100.0 MSVC; DXC/DXIL 1.8.2502.11 from Windows SDK 10.0.26100.0. Debug profile. `XCL_ADAPTER=radeon`. - Tested exact PR head `005a4427d2926f29d96ea28bf6747dc70321806c`. Baseline `origin/main` was `6d12f58a229bc73889878a448c64dc3af25eeba0`. - `cargo test --workspace --no-fail-fast -- --test-threads=4`: 1,342 passed, 2 failed, 46 ignored, 18 `SKIPPED` notices (exit 101). One failure, `gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1`, also failed on baseline. The other, `gpu::recomp::lower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier`, passed on baseline. - `cargo test -p xcl --lib gpu_a_texture_without_its_top_mip_samples_the_first_it_has -- --test-threads=1`: 1 passed, 0 failed, 0 ignored, 0 skipped; ran on the RX 7800 XT. - Current-main baseline `cargo test --workspace --no-fail-fast -- --test-threads=4`: 1,422 passed, 1 failed, 46 ignored, 25 `SKIPPED` notices (exit 101). **Not tested** - A retail title or game data; no dumps were used. **AI use** - Codex (gpt-6-luna) ran the tests and prepared this report.
upstream-sync closed this pull request 2026-11-25 23:08:19 +00:00
thehollowedone commented 2026-11-25 23:09:05 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-25T22:15:48Z.


Updated independent RTX 3080 Ti check for #2385 head 4c4c577, superseding my earlier 005a442 report. This run used a clean disposable clone of the author's branch; git rev-parse HEAD matched the linked commit.

Tested: RTX 3080 Ti / NVIDIA 621.35, Ryzen 7 9800X3D, Windows 11 build 26300, Rust 1.99.1 MSVC, DXC 1.8.2502.11; debug. XCL_DXIL_CACHE pointed to writable folders under that checkout's target.

  • cargo build --offline --locked --workspace: passed.
  • cargo test --offline --locked -p xcl --lib gpu_a_texture_without_its_top_mip_filters_like_the_clamp_alone -- --nocapture --test-threads=1: 1 passed, 0 failed, 0 ignored, 0 skipped on the named GPU. The omitted-mip and fully backed, equally clamped textures differed at 0/4,096 pixels for trilinear filtering and 0/4,096 for 16× anisotropic filtering. Unclamped poison-mip controls showed 1,240 and 2,529 red pixels respectively.
  • cargo test --offline --locked -p xcl --lib left_out_tiles_name_the_pages_bind_would_give_them -- --nocapture --test-threads=1: 1/0/0. The older gpu_a_texture_without_its_top_mip_samples_the_first_it_has GPU test also passed 1/0/0, with no skips.
  • cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4 --quiet: 1,345 passed, 1 failed, 46 ignored across 24 targets, with 25 GPU SKIPPED notices. The sole failure was a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier, reproduced alone at 0/1/0. This head still expects exactly one barrier in the entire DXIL program; current main already contains commit c828d8c, which checks only the divergent block after the entry branch.

I also applied the #2385 PR patch to current main b49be18 locally. That uncommitted integration tree built and its workspace suite reported 1,441 passed, 0 failed, 47 ignored across 37 targets, with 25 GPU skip notices. This is a merge-path check, not an exact-head or retail smoke result. Rebasing the PR onto current main would bring in the existing barrier assertion correction; the PR description now has smoke blocks naming 4c4c577.

Existing main-side correction for the stale barrier assertion
diff --git a/crates/xcl/src/gpu/recomp/lower_dxil.rs b/crates/xcl/src/gpu/recomp/lower_dxil.rs
index a3b942d..cec9257 100644
--- a/crates/xcl/src/gpu/recomp/lower_dxil.rs
+++ b/crates/xcl/src/gpu/recomp/lower_dxil.rs
@@ -1150,9 +1150,10 @@ mod tests {
             return runner::skip_test("no DXC");
         }
         let text = crate::gpu::dxil::validate::disassemble(&dxil).unwrap();
-        let barriers = text.lines().filter(|l| l.contains("call void @dx.op.barrier")).count();
-        // the one where the halves take their console lanes, at the start (every lane is there)
-        assert_eq!(barriers, 1, "group barriers in the program:\n{text}");
+        let (_, after_entry) = text.split_once("\n  br ").unwrap_or_else(|| panic!("expected branch in program:\n{text}"));
+        let divergent_barriers = after_entry.lines().filter(|l| l.contains("call void @dx.op.barrier")).count();
+        // after the entry whole-wave branch, only one half reaches the body so no group barrier may appear there
+        assert_eq!(divergent_barriers, 0, "group barriers after entry branch:\n{text}");
         if !gpu() {
             return;
         }

Not tested: a retail title under 8–12 GB memory pressure, visual quality in a title, AMD/Intel, or FPS and memory savings. The new GPU fixture calls mapping/clamp helpers and creates a PC SRV directly; it does not exercise XCL's title SRV hook or prove title draws and dispatches are preserved. Synthetic inputs only. AI use: Codex (GPT-6.2 Sol) reviewed the paths, ran the tests, and drafted this update.

<!-- greyfinch-sync:ivall/xcl:comment:7176141108 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2385#issuecomment-7176141108). Originally posted by [thehollowedone](https://github.com/thehollowedone) on 2026-11-25T22:15:48Z. --- Updated independent RTX 3080 Ti check for [#2385 head `4c4c577`](https://github.com/xcl-dev/xcl/commit/4c4c5772f74c4fbbea461d88b844a57dc6a640a5), superseding my earlier `005a442` report. This run used a clean disposable clone of the author's branch; `git rev-parse HEAD` matched the linked commit. **Tested:** RTX 3080 Ti / NVIDIA 621.35, Ryzen 7 9800X3D, Windows 11 build 26300, Rust 1.99.1 MSVC, DXC 1.8.2502.11; debug. `XCL_DXIL_CACHE` pointed to writable folders under that checkout's `target`. - `cargo build --offline --locked --workspace`: passed. - `cargo test --offline --locked -p xcl --lib gpu_a_texture_without_its_top_mip_filters_like_the_clamp_alone -- --nocapture --test-threads=1`: **1 passed, 0 failed, 0 ignored, 0 skipped** on the named GPU. The omitted-mip and fully backed, equally clamped textures differed at **0/4,096 pixels** for trilinear filtering and **0/4,096** for 16× anisotropic filtering. Unclamped poison-mip controls showed 1,240 and 2,529 red pixels respectively. - `cargo test --offline --locked -p xcl --lib left_out_tiles_name_the_pages_bind_would_give_them -- --nocapture --test-threads=1`: **1/0/0**. The older `gpu_a_texture_without_its_top_mip_samples_the_first_it_has` GPU test also passed **1/0/0**, with no skips. - `cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4 --quiet`: **1,345 passed, 1 failed, 46 ignored** across 24 targets, with **25 GPU `SKIPPED` notices**. The sole failure was `a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier`, reproduced alone at **0/1/0**. This head still expects exactly one barrier in the entire DXIL program; current `main` already contains [commit `c828d8c`](https://github.com/xcl-dev/xcl/commit/c828d8c091740c41a21fc1607d82c85bc9195cc6), which checks only the divergent block after the entry branch. I also applied the #2385 PR patch to current [main `b49be18`](https://github.com/xcl-dev/xcl/commit/b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7) locally. That uncommitted integration tree built and its workspace suite reported **1,441 passed, 0 failed, 47 ignored** across 37 targets, with 25 GPU skip notices. This is a merge-path check, not an exact-head or retail smoke result. Rebasing the PR onto current `main` would bring in the existing barrier assertion correction; the PR description now has smoke blocks naming `4c4c577`. <details><summary>Existing main-side correction for the stale barrier assertion</summary> ```diff diff --git a/crates/xcl/src/gpu/recomp/lower_dxil.rs b/crates/xcl/src/gpu/recomp/lower_dxil.rs index a3b942d..cec9257 100644 --- a/crates/xcl/src/gpu/recomp/lower_dxil.rs +++ b/crates/xcl/src/gpu/recomp/lower_dxil.rs @@ -1150,9 +1150,10 @@ mod tests { return runner::skip_test("no DXC"); } let text = crate::gpu::dxil::validate::disassemble(&dxil).unwrap(); - let barriers = text.lines().filter(|l| l.contains("call void @dx.op.barrier")).count(); - // the one where the halves take their console lanes, at the start (every lane is there) - assert_eq!(barriers, 1, "group barriers in the program:\n{text}"); + let (_, after_entry) = text.split_once("\n br ").unwrap_or_else(|| panic!("expected branch in program:\n{text}")); + let divergent_barriers = after_entry.lines().filter(|l| l.contains("call void @dx.op.barrier")).count(); + // after the entry whole-wave branch, only one half reaches the body so no group barrier may appear there + assert_eq!(divergent_barriers, 0, "group barriers after entry branch:\n{text}"); if !gpu() { return; } ``` </details> **Not tested:** a retail title under 8–12 GB memory pressure, visual quality in a title, AMD/Intel, or FPS and memory savings. The new GPU fixture calls mapping/clamp helpers and creates a PC SRV directly; it does not exercise XCL's title SRV hook or prove title draws and dispatches are preserved. Synthetic inputs only. AI use: Codex (GPT-6.2 Sol) reviewed the paths, ran the tests, and drafted this update.
CalvyPZ commented 2026-11-25 23:09:15 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by CalvyPZ on 2026-11-25T22:43:08Z.


This PR has been marked as a duplicate and closed after multiple agreeing checks in #1607. If you believe this is incorrect please re-open with why.

<!-- greyfinch-sync:ivall/xcl:comment:7176705574 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2385#issuecomment-7176705574). Originally posted by [CalvyPZ](https://github.com/CalvyPZ) on 2026-11-25T22:43:08Z. --- This PR has been marked as a duplicate and closed after multiple agreeing checks in #1607. If you believe this is incorrect please re-open with why.
upstream-sync reopened this pull request 2026-11-26 00:05:02 +00:00
Royalflamejlh commented 2026-11-26 02:08:26 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-11-26T01:56:55Z.


Linux (Wine + vkd3d-proton) + NVIDIA, the title, 3 runs with the budget (default) and 3 with XCL_TEXTURE_BUDGET=0, in turn: on this 12 GB card the budget switched on at 46 to 51 s, and no run in either tree had a device removal or a driver message. At 118 s, 11,651 to 12,155 live textures were without their top mips. Target pages were 6.2 to 6.5 GB against 9.6 GB without it, and non-local video memory 4.4 to 4.5 GB against 7.5 to 7.6 GB. XCL's MB figure for the tiles left unmapped (12.2 to 12.9 GB) is a sum per texture, and textures at the same address share tiles, so it is larger than what was saved. The last present came at 70 to 92 s with it and 76 to 82 s without. So on this 12 GB card these runs show no failure that the budget avoided.

Setup: e44af706 (the commit this head is based on) + #684 e56dbc3 + #2385 005a442 (9f73b329), the same build both ways, in turn. RTX 4070 12 GB (615.71.09), Fedora 44, Wine 11.21 Staging, vkd3d-proton v3.1-90-g30b0eb9b with the relaxed-vtable patch from #175 and a local dxil-spirv patch, release, Series X profile, 120 s, A pressed when ready at 16.3 to 18.2 s (one run without the budget also pressed at 10.3 s), XCL_PSO_PRELOAD=0, WINEDEBUG=err+all,fixme-all. Memory figures are XCL's own memory: lines.

budget on (3 runs) XCL_TEXTURE_BUDGET=0 (3 runs)
video memory is filling up at 50.8, 46.0, 45.9 s –
at 118 s: top mips left out 12,155, 11,651, 11,882 textures (12,916, 12,153, 12,469 MB) 0
at 118 s: target pages 6,162, 6,490, 6,331 MB 9,587, 9,590, 9,648 MB
at 118 s: local / non-local video memory 10,046–10,403 / 4,439–4,497 MB 10,394–10,419 / 7,546–7,604 MB
last 2 s with a present 92.1, 70.0, 72.0 s 76.2, 78.3, 82.0 s
  • Local memory reached the same level either way (10.0 to 10.4 GB); what the budget saved here was about 3 GB of spill into non-local memory.

Not tested: the image quality (no frames); XCL_TEXTURE_LEVEL_PAGES=1 and XCL_TEXTURE_MAX; the suite; Windows; AMD and Intel.

AI use: Claude Code (Claude Opus 5.5) ran the title and wrote this comment.

Posted without review by a person: the account owner was away and reads replies later.

<!-- greyfinch-sync:ivall/xcl:comment:7180308486 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2385#issuecomment-7180308486). Originally posted by [Royalflamejlh](https://github.com/Royalflamejlh) on 2026-11-26T01:56:55Z. --- Linux (Wine + vkd3d-proton) + NVIDIA, the title, 3 runs with the budget (default) and 3 with `XCL_TEXTURE_BUDGET=0`, in turn: on this 12 GB card the budget switched on at 46 to 51 s, and no run in either tree had a device removal or a driver message. At 118 s, 11,651 to 12,155 live textures were without their top mips. Target pages were 6.2 to 6.5 GB against 9.6 GB without it, and non-local video memory 4.4 to 4.5 GB against 7.5 to 7.6 GB. XCL's MB figure for the tiles left unmapped (12.2 to 12.9 GB) is a sum per texture, and textures at the same address share tiles, so it is larger than what was saved. The last present came at 70 to 92 s with it and 76 to 82 s without. So on this 12 GB card these runs show no failure that the budget avoided. **Setup:** `e44af706` (the commit this head is based on) + #684 `e56dbc3` + #2385 `005a442` (`9f73b329`), the same build both ways, in turn. RTX 4070 12 GB (615.71.09), Fedora 44, Wine 11.21 Staging, vkd3d-proton `v3.1-90-g30b0eb9b` with the relaxed-vtable patch from #175 and a local dxil-spirv patch, release, Series X profile, 120 s, A pressed when ready at 16.3 to 18.2 s (one run without the budget also pressed at 10.3 s), `XCL_PSO_PRELOAD=0`, `WINEDEBUG=err+all,fixme-all`. Memory figures are XCL's own `memory:` lines. | | budget on (3 runs) | `XCL_TEXTURE_BUDGET=0` (3 runs) | |---|---|---| | `video memory is filling up` | at 50.8, 46.0, 45.9 s | – | | at 118 s: top mips left out | 12,155, 11,651, 11,882 textures (12,916, 12,153, 12,469 MB) | 0 | | at 118 s: target pages | 6,162, 6,490, 6,331 MB | 9,587, 9,590, 9,648 MB | | at 118 s: local / non-local video memory | 10,046–10,403 / 4,439–4,497 MB | 10,394–10,419 / 7,546–7,604 MB | | last 2 s with a present | 92.1, 70.0, 72.0 s | 76.2, 78.3, 82.0 s | - Local memory reached the same level either way (10.0 to 10.4 GB); what the budget saved here was about 3 GB of spill into non-local memory. **Not tested:** the image quality (no frames); `XCL_TEXTURE_LEVEL_PAGES=1` and `XCL_TEXTURE_MAX`; the suite; Windows; AMD and Intel. **AI use:** Claude Code (Claude Opus 5.5) ran the title and wrote this comment. Posted without review by a person: the account owner was away and reads replies later.
itsSio commented 2026-11-26 05:05:37 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by itsSio on 2026-11-26T04:45:52Z.


Independent dual-PC NVIDIA full-workspace test report on clean head 005a4427d2926f29d96ea28bf6747dc70321806c.

Tested

  • Machine 1: NVIDIA GeForce RTX 5080 (driver 32.0.16.1088), AMD Ryzen 7 9800X3D, 32 GB RAM, Windows 11 Pro build 26200, rustc 1.97.0 (stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5, debug build (XCL_ADAPTER=NVIDIA)
    • cargo build --workspace: exit 0
    • cargo test --workspace --no-fail-fast -- --test-threads=4 --nocapture: 1343 passed, 1 failed, 46 ignored (all 4 new vram::tests pass, including GPU gpu_a_texture_without_its_top_mip_samples_the_first_it_has; the sole failure is gpu::recomp::lower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier at lower_dxil.rs:1155, which also reproduces identically on the PR's bare base e44af7062dc610a9f889de2dcf11450e3e4884b3 without this PR and passes on newer main after c828d8c0 / #2420)
    • SKIPPED: 26 (wave64-only GPU tests, #1426 wave32 f16/cvt refusals, heap_window_out_of_memory_falls_back_to_the_switch_form, pso_measurement_compiles_an_exact_synthetic_record)
  • Machine 2: NVIDIA GeForce RTX 2080 SUPER (driver 32.0.16.1088), AMD Ryzen 5 5600X, 16 GB RAM, Windows 11 Pro build 26200, rustc 1.99.1 (stable-x86_64-pc-windows-msvc), Windows SDK 10.0.26100 DXC 1.8.2502.11, debug build (XCL_ADAPTER=NVIDIA)
    • cargo build --workspace: exit 0
    • cargo test --workspace --no-fail-fast -- --test-threads=4 --nocapture: 1343 passed, 1 failed, 46 ignored (all 4 new vram::tests pass; same pre-existing base failure in lower_dxil.rs:1155)
    • SKIPPED: 29 (same 26 as Machine 1 plus 3 requiring d3d12SDKLayers.dll)

Not tested

  • Retail title / scripts/smoke.ps1 runs
  • Release builds (--release)
  • AMD / Intel GPUs, native wave64, Linux / Wine / vkd3d-proton

AI use
Ran via Samaritan:

  • Google Antigravity CLI (Claude Opus 5.5 (High)): built the branch and ran the workspace test suite on both NVIDIA machines and verified the base reproduction on e44af706.
  • Google Antigravity CLI (Gemini 4 Neon (High)): coordinated the runs and wrote this test report.
<!-- greyfinch-sync:ivall/xcl:comment:7182881757 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2385#issuecomment-7182881757). Originally posted by [itsSio](https://github.com/itsSio) on 2026-11-26T04:45:52Z. --- Independent dual-PC NVIDIA full-workspace test report on clean head `005a4427d2926f29d96ea28bf6747dc70321806c`. **Tested** - **Machine 1:** NVIDIA GeForce RTX 5080 (driver `32.0.16.1088`), AMD Ryzen 7 9800X3D, 32 GB RAM, Windows 11 Pro build 26200, `rustc 1.97.0` (`stable-x86_64-pc-windows-msvc`), DXC `1.9.2609.5`, debug build (`XCL_ADAPTER=NVIDIA`) - `cargo build --workspace`: exit 0 - `cargo test --workspace --no-fail-fast -- --test-threads=4 --nocapture`: **1343 passed, 1 failed, 46 ignored** (all 4 new `vram::tests` pass, including GPU `gpu_a_texture_without_its_top_mip_samples_the_first_it_has`; the sole failure is `gpu::recomp::lower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier` at `lower_dxil.rs:1155`, which also reproduces identically on the PR's bare base `e44af7062dc610a9f889de2dcf11450e3e4884b3` without this PR and passes on newer `main` after `c828d8c0` / `#2420`) - `SKIPPED`: 26 (wave64-only GPU tests, `#1426` wave32 f16/cvt refusals, `heap_window_out_of_memory_falls_back_to_the_switch_form`, `pso_measurement_compiles_an_exact_synthetic_record`) - **Machine 2:** NVIDIA GeForce RTX 2080 SUPER (driver `32.0.16.1088`), AMD Ryzen 5 5600X, 16 GB RAM, Windows 11 Pro build 26200, `rustc 1.99.1` (`stable-x86_64-pc-windows-msvc`), Windows SDK 10.0.26100 DXC `1.8.2502.11`, debug build (`XCL_ADAPTER=NVIDIA`) - `cargo build --workspace`: exit 0 - `cargo test --workspace --no-fail-fast -- --test-threads=4 --nocapture`: **1343 passed, 1 failed, 46 ignored** (all 4 new `vram::tests` pass; same pre-existing base failure in `lower_dxil.rs:1155`) - `SKIPPED`: 29 (same 26 as Machine 1 plus 3 requiring `d3d12SDKLayers.dll`) **Not tested** - Retail title / `scripts/smoke.ps1` runs - Release builds (`--release`) - AMD / Intel GPUs, native wave64, Linux / Wine / vkd3d-proton **AI use** Ran via Samaritan: - Google Antigravity CLI (Claude Opus 5.5 (High)): built the branch and ran the workspace test suite on both NVIDIA machines and verified the base reproduction on `e44af706`. - Google Antigravity CLI (Gemini 4 Neon (High)): coordinated the runs and wrote this test report.
NWProgramming00 commented 2026-11-26 07:03:36 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by NWProgramming00 on 2026-11-26T06:34:09Z.


On the #1607 hint (group D111): #640 and this PR take different memory, so I think both are needed.

  • #640 (opt-in, XCL_PAGE_BUDGET_MB): it evicts whole textures that were not used for a while. They are unmapped, then mapped and uploaded again before the next work that uses them. It goes after pages of textures the title no longer uses, which stay mapped while the title recycles that memory.
  • This PR (on by default past 75 % of the budget): it works on textures in use, when they are made. Their largest mips never get memory, and views are clamped to the first mip that has some. Nothing is unmapped or uploaded again later, and the texture stays usable at a lower resolution.
  • Together: #640 frees what is dead, and this PR makes what is alive smaller. One does not replace the other.
  • Overlap: both change how tiles are taken in vram.rs (take_tile there, bind_range here). Whichever lands second has to be rebased onto the other, but the two do not need a shared mechanism.

Thanks to everyone who tested it. @Royalflamejlh's runs are the measurement on a card that fills its budget that I could not make on a 16 GB card: about 3 GB less spill into non-local memory, and target pages of 6.2–6.5 GB against 9.6 GB.

They also point out that the MB figure in the memory: line is a per-texture sum, which is larger than what was saved when textures share an address. I will make it count each left-out page once.

AI use: Claude Code (Claude Opus 5.5) wrote this.

<!-- greyfinch-sync:ivall/xcl:comment:7184559433 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2385#issuecomment-7184559433). Originally posted by [NWProgramming00](https://github.com/NWProgramming00) on 2026-11-26T06:34:09Z. --- On the #1607 hint (group D111): #640 and this PR take different memory, so I think both are needed. - **#640** (opt-in, `XCL_PAGE_BUDGET_MB`): it evicts whole textures that were not used for a while. They are unmapped, then mapped and uploaded again before the next work that uses them. It goes after pages of textures the title no longer uses, which stay mapped while the title recycles that memory. - **This PR** (on by default past 75 % of the budget): it works on textures in use, when they are made. Their largest mips never get memory, and views are clamped to the first mip that has some. Nothing is unmapped or uploaded again later, and the texture stays usable at a lower resolution. - **Together:** #640 frees what is dead, and this PR makes what is alive smaller. One does not replace the other. - **Overlap:** both change how tiles are taken in `vram.rs` (`take_tile` there, `bind_range` here). Whichever lands second has to be rebased onto the other, but the two do not need a shared mechanism. Thanks to everyone who tested it. @Royalflamejlh's runs are the measurement on a card that fills its budget that I could not make on a 16 GB card: about 3 GB less spill into non-local memory, and target pages of 6.2–6.5 GB against 9.6 GB. They also point out that the MB figure in the `memory:` line is a per-texture sum, which is larger than what was saved when textures share an address. I will make it count each left-out page once. AI use: Claude Code (Claude Opus 5.5) wrote this.
NWProgramming00 commented 2026-11-26 09:07:43 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by NWProgramming00 on 2026-11-26T08:32:28Z.


@bmjask, thanks for the review. On your four points:

  • Image validation. 4c4c577 adds gpu_a_texture_without_its_top_mip_filters_like_the_clamp_alone. Two copies of one 256×256 texture have a red mip 0 that no other mip has: one without mip 0 in memory and its view clamped, one with every mip in memory and the same clamp. It samples both into 64×64 pictures with trilinear and 16× anisotropic filtering, LOD −3 to +3, anisotropy 1 to 16, and footprints along and across the axes.
    • The pictures are the same to the bit on an RTX 5070 Ti and an RDNA2 Radeon, and neither has red. So the left-out mip adds nothing to any pixel, and a texture looks the way the clamp alone makes it look: one mip less sharp.
    • Without the clamp, 1,240–2,716 pixels show red, so the test reaches mip 0. With the clamp taken out of clamp_skipped_mips, it fails.
    • This is not a frame of the title. I don't post the title's frames.
  • Low-VRAM title run. @Royalflamejlh ran the title on a 12 GB RTX 4070 (comment above). The budget switched on at 46–51 s, there was about 3 GB less spill into non-local memory, and no device removal either way. An 8 GB card is still missing; the description says so.
  • The disclosures stay in the description under "Not tested": Load and mip queries read zero from the left-out mips, and the title's uploads into them are still detiled.
  • #640 is answered above: it evicts dead textures and this PR makes live ones smaller, so the two are not alternatives. #2357 also changes bind_range and caps the pools; whichever lands second needs a rebase.

AI use: Claude Code (Claude Opus 5.5) wrote the test and this reply.

<!-- greyfinch-sync:ivall/xcl:comment:7186718228 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2385#issuecomment-7186718228). Originally posted by [NWProgramming00](https://github.com/NWProgramming00) on 2026-11-26T08:32:28Z. --- @bmjask, thanks for the review. On your four points: - **Image validation.** `4c4c577` adds `gpu_a_texture_without_its_top_mip_filters_like_the_clamp_alone`. Two copies of one 256×256 texture have a red mip 0 that no other mip has: one without mip 0 in memory and its view clamped, one with every mip in memory and the same clamp. It samples both into 64×64 pictures with trilinear and 16× anisotropic filtering, LOD −3 to +3, anisotropy 1 to 16, and footprints along and across the axes. - The pictures are the same to the bit on an RTX 5070 Ti and an RDNA2 Radeon, and neither has red. So the left-out mip adds nothing to any pixel, and a texture looks the way the clamp alone makes it look: one mip less sharp. - Without the clamp, 1,240–2,716 pixels show red, so the test reaches mip 0. With the clamp taken out of `clamp_skipped_mips`, it fails. - This is not a frame of the title. I don't post the title's frames. - **Low-VRAM title run.** @Royalflamejlh ran the title on a 12 GB RTX 4070 (comment above). The budget switched on at 46–51 s, there was about 3 GB less spill into non-local memory, and no device removal either way. An 8 GB card is still missing; the description says so. - **The disclosures** stay in the description under "Not tested": `Load` and mip queries read zero from the left-out mips, and the title's uploads into them are still detiled. - **#640** is answered above: it evicts dead textures and this PR makes live ones smaller, so the two are not alternatives. #2357 also changes `bind_range` and caps the pools; whichever lands second needs a rebase. AI use: Claude Code (Claude Opus 5.5) wrote the test and this reply.
ClosetPie107 commented 2026-11-26 11:05:09 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ClosetPie107 on 2026-11-26T10:07:07Z.


Linux / AMD RX 9070 (RDNA4, RADV) test report on 4c4c5772 (and merged onto main b49be183 with #1663 / #751): clear VRAM/RAM improvement — saves up to 4.28 GB on top of #2306 and runs a full 15 minutes (900 s) without hitting our host RAM guard.

Summary

  • All 25 vram::tests pass on 4c4c5772 (0 failed, 0 skipped), including both new GPU mip-clamp tests.
  • In-game on main b49be183 (+ #1663 + #751) with XCL_TEXTURE_LEVEL_PAGES=1, #2385 dropped top mips from 16,587 textures (4,285 MB saved), held target pages flat at 5,143 MB (pools 5,312 MB, roughly half the 10,432 MB seen without #2306+#2385), and completed a full 900 s (15-minute) run cleanly (exit=0, 2,258 presents, 0 crashes, 0 device removals) with 10,279 MiB MemAvailable — whereas earlier runs on this 30 GiB host tripped our 2 GiB RAM guard around 167–302 s from VRAM→GTT spill.
  • Earlier runs without #751 hit a pre-existing, unrelated TOCTOU 0xc0000005 in title_textures::subresources (symbolized below; adding #751 eliminated it completely).

Setup

  • AMD Radeon RX 9070 16 GB (RADV GFX1201, Mesa 26.3.1), Ryzen 5 9600X, 30 GiB RAM, CachyOS (kernel 7.3.5)
  • Proton Experimental (experimental-11.0-20261112), DXVK v3.1.1-209, patched vkd3d-proton master (ec207194, dxil-spirv b540c8a2), DXC 1.9.2609.5
  • Release x86_64-pc-windows-gnu build

Tested

  1. Exact head 4c4c5772 — vram::tests:
    • Command: xcl-<hash>.exe hle::d3d12x::vram::tests --test-threads=1 (via Proton/Wine, XCL_ADAPTER=9070)
    • Result: 25 passed, 0 failed, 1 ignored, 0 skipped (peak VRAM 1,393 MiB), including gpu_a_texture_without_its_top_mip_filters_like_the_clamp_alone and gpu_a_texture_without_its_top_mip_samples_the_first_it_has.
  2. Merged onto main b49be183 (+ #1663 + #751) — retail title 1.0.2.1 (XCL_DIRECT_DXIL=1 XCL_PSO_PRELOAD=0 XCL_PSO_WAIT_MS=50 XCL_TEXTURE_LEVEL_PAGES=1 XCL_SPLIT_MIDLIST_WAIT=0 XCL_COHERENT_MB=1024 XCL_ACTIVITY=1):
    • 900 s run: clean exit=0 after 920 s wall, 2,258 presents, 0 crashes, 0 device removals, PSO compiles reached #4523. target pages stayed flat at 5,143 MB (pools 5,312 MB), sparse pools 4,864 MB (4,462 MB mapped), top mips left out of 16587 textures (4285 MB), MemAvailable stayed at 8.6–10.3 GiB (10,279 MiB at 900 s; xcl_rss 6,821 MiB, xcl_swap 10,803 MiB).
  3. Merged onto main b49be183 (+ #1663, without #751) — retail title 1.0.2.1 (same flags):
    • 300 s run: clean exit=0 after 316 s wall, 2,241 presents, 0 crashes, 0 device removals. target pages 5,131 MB (pools 5,184 MB), top mips left out of 9529 textures (3018 MB), end MemAvailable 5,758 MiB.
    • 900 s run: stayed under 16 GB VRAM (15,285 MiB peak, 0 MiB xcl_swap, 10,803 MiB MemAvailable, top mips left out of 1421 textures (919 MB)) through 183 s (1,970 presents, 0 device removals), then hit the unrelated TOCTOU crash below.
  4. Exact head 4c4c5772 — retail title 1.0.2.1 (same flags):
    • Ended at 55.7 s (exit=148, 1,370 presents, 0 device removals, peak VRAM 9,755 MiB, top mips left out of 0 textures (0 MB)) on the same unrelated TOCTOU crash before VRAM reached the 75% threshold.

Unrelated crash note (fixed by #751, not caused by #2385)

  • Both 0xc0000005 stops without #751 (ucrtbase.dll+0x1720b reading 0xbcae5a000 / 0xcc22c5000) symbolize via llvm-addr2line to core::ptr::copy_nonoverlapping ← gpu::shader::readable (shader.rs:225) ← title_textures::subresources (title_textures.rs:1480) ← title_textures::subresources_on (title_textures.rs:1443). Stacking #751 removed it.

Not tested

  • Full workspace test suite on 4c4c5772, Windows, NVIDIA, XCL_TEXTURE_MAX=<texels>, visual inspection of world mip quality.

AI use

  • T3 Code / Antigravity (Gemini 4 Neon) built the binaries, ran the tests and retail runs on this machine, symbolized the crash stack, and drafted this report.
<!-- greyfinch-sync:ivall/xcl:comment:7188931256 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2385#issuecomment-7188931256). Originally posted by [ClosetPie107](https://github.com/ClosetPie107) on 2026-11-26T10:07:07Z. --- **Linux / AMD RX 9070 (RDNA4, RADV) test report on `4c4c5772` (and merged onto `main` `b49be183` with #1663 / #751): clear VRAM/RAM improvement — saves up to 4.28 GB on top of #2306 and runs a full 15 minutes (900 s) without hitting our host RAM guard.** **Summary** - All 25 `vram::tests` pass on `4c4c5772` (0 failed, 0 skipped), including both new GPU mip-clamp tests. - In-game on `main` `b49be183` (+ #1663 + #751) with `XCL_TEXTURE_LEVEL_PAGES=1`, #2385 dropped top mips from **16,587 textures (`4,285 MB` saved)**, held `target pages` flat at **`5,143 MB`** (`pools 5,312 MB`, roughly half the `10,432 MB` seen without #2306+#2385), and completed a **full 900 s (15-minute) run cleanly (`exit=0`, `2,258` presents, 0 crashes, 0 device removals)** with **`10,279 MiB` `MemAvailable`** — whereas earlier runs on this 30 GiB host tripped our 2 GiB RAM guard around 167–302 s from VRAM→GTT spill. - Earlier runs without #751 hit a **pre-existing, unrelated TOCTOU `0xc0000005`** in `title_textures::subresources` (symbolized below; adding #751 eliminated it completely). **Setup** - AMD Radeon RX 9070 16 GB (RADV GFX1201, Mesa 26.3.1), Ryzen 5 9600X, 30 GiB RAM, CachyOS (kernel 7.3.5) - Proton Experimental (`experimental-11.0-20261112`), DXVK `v3.1.1-209`, patched vkd3d-proton `master` (`ec207194`, `dxil-spirv` `b540c8a2`), DXC `1.9.2609.5` - Release `x86_64-pc-windows-gnu` build **Tested** 1. **Exact head `4c4c5772` — `vram::tests`:** - Command: `xcl-<hash>.exe hle::d3d12x::vram::tests --test-threads=1` (via Proton/Wine, `XCL_ADAPTER=9070`) - Result: **25 passed, 0 failed, 1 ignored, 0 skipped** (peak VRAM `1,393 MiB`), including `gpu_a_texture_without_its_top_mip_filters_like_the_clamp_alone` and `gpu_a_texture_without_its_top_mip_samples_the_first_it_has`. 2. **Merged onto `main` `b49be183` (+ #1663 + #751) — retail title 1.0.2.1 (`XCL_DIRECT_DXIL=1 XCL_PSO_PRELOAD=0 XCL_PSO_WAIT_MS=50 XCL_TEXTURE_LEVEL_PAGES=1 XCL_SPLIT_MIDLIST_WAIT=0 XCL_COHERENT_MB=1024 XCL_ACTIVITY=1`):** - **900 s run:** clean **`exit=0`** after 920 s wall, **`2,258` presents**, 0 crashes, 0 device removals, PSO compiles reached `#4523`. `target pages` stayed flat at **`5,143 MB`** (`pools 5,312 MB`), `sparse pools 4,864 MB` (`4,462 MB` mapped), `top mips left out of 16587 textures (4285 MB)`, `MemAvailable` stayed at **`8.6–10.3 GiB`** (`10,279 MiB` at 900 s; `xcl_rss 6,821 MiB`, `xcl_swap 10,803 MiB`). 3. **Merged onto `main` `b49be183` (+ #1663, without #751) — retail title 1.0.2.1 (same flags):** - **300 s run:** clean **`exit=0`** after 316 s wall, **`2,241` presents**, 0 crashes, 0 device removals. `target pages 5,131 MB` (`pools 5,184 MB`), `top mips left out of 9529 textures (3018 MB)`, end `MemAvailable 5,758 MiB`. - **900 s run:** stayed under 16 GB VRAM (`15,285 MiB` peak, `0 MiB` `xcl_swap`, `10,803 MiB` `MemAvailable`, `top mips left out of 1421 textures (919 MB)`) through 183 s (`1,970` presents, 0 device removals), then hit the unrelated TOCTOU crash below. 4. **Exact head `4c4c5772` — retail title 1.0.2.1 (same flags):** - Ended at **55.7 s** (`exit=148`, `1,370` presents, 0 device removals, peak VRAM `9,755 MiB`, `top mips left out of 0 textures (0 MB)`) on the same unrelated TOCTOU crash before VRAM reached the 75% threshold. **Unrelated crash note (fixed by #751, not caused by #2385)** - Both `0xc0000005` stops without #751 (`ucrtbase.dll+0x1720b` reading `0xbcae5a000` / `0xcc22c5000`) symbolize via `llvm-addr2line` to `core::ptr::copy_nonoverlapping` ← `gpu::shader::readable` (`shader.rs:225`) ← `title_textures::subresources` (`title_textures.rs:1480`) ← `title_textures::subresources_on` (`title_textures.rs:1443`). Stacking #751 removed it. **Not tested** - Full workspace test suite on `4c4c5772`, Windows, NVIDIA, `XCL_TEXTURE_MAX=<texels>`, visual inspection of world mip quality. **AI use** - T3 Code / Antigravity (Gemini 4 Neon) built the binaries, ran the tests and retail runs on this machine, symbolized the crash stack, and drafted this report.
b3IKK commented 2026-11-26 17:58:26 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by b3IKK on 2026-11-26T17:58:26Z.


Test report on an RTX 5080 16 GB (retail 1.0.2.1, Windows 11 26300, release), with this PR (4c4c577) on top of #2404 + #2519 scratch + the 1 GiB shader heap + full compute precompile + #1435:

  • Local video memory at the end was 19,927 MB (vs 20,839 MB on the same stack without this PR) — the title's TileHeap is 4.2/6.2 GB and target pages ~10.4 GB, so the clamp had little to take.
  • The run ended in the VCRUNTIME 0xc0000005 (8-byte read at 0x81ccf8000) at 384 s; the same stack without this PR presented to 495 s and ended in the title's own int3 (no VCRUNTIME AV).

That is one run each, so it is not a verdict on the design — but on this title/stack it did not move the VRAM wall and the AV returned. I reverted it and am rerunning without it for the A/B. The texture clamp is opt-in-able (XCL_TEXTURE_BUDGET=0) if you want it excluded.

AI use: OpenCode, Claude Fable 5.2 applied the PR, ran the 600 s title and wrote this.

<!-- greyfinch-sync:ivall/xcl:comment:7199908054 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2385#issuecomment-7199908054). Originally posted by [b3IKK](https://github.com/b3IKK) on 2026-11-26T17:58:26Z. --- Test report on an RTX 5080 16 GB (retail 1.0.2.1, Windows 11 26300, release), with this PR (`4c4c577`) on top of #2404 + #2519 scratch + the 1 GiB shader heap + full compute precompile + #1435: - Local video memory at the end was **19,927 MB** (vs 20,839 MB on the same stack without this PR) — the title's TileHeap is 4.2/6.2 GB and target pages ~10.4 GB, so the clamp had little to take. - The run ended in the VCRUNTIME `0xc0000005` (8-byte read at `0x81ccf8000`) at **384 s**; the same stack without this PR presented to 495 s and ended in the title's own `int3` (no VCRUNTIME AV). That is one run each, so it is not a verdict on the design — but on this title/stack it did not move the VRAM wall and the AV returned. I reverted it and am rerunning without it for the A/B. The texture clamp is opt-in-able (`XCL_TEXTURE_BUDGET=0`) if you want it excluded. AI use: OpenCode, Claude Fable 5.2 applied the PR, ran the 600 s title and wrote this.
milas6669 commented 2026-11-26 18:20:21 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by milas6669 on 2026-11-26T18:20:21Z.


RTX 3070 8 GB, same-build budget on/off — follow-up to the 8 GB request. At the first sample at or above 32,000 DirectStorage requests, median local usage was 7,937.5 MiB on / 9,009.5 MiB off (four runs each). All four on runs reached 65,000 requests and all four off runs stopped earlier. All eight exceeded their DXGI budgets and ended during loading when Windows had under 2 GiB of physical RAM available. Device removals were 0/4 on and 0/4 off up to those stops. One on run also logged a texture-detiling exception.

Tested

Clean head 4c4c5772f74c4fbbea461d88b844a57dc6a640a5, Windows 11 build 26200, RTX 3070 8 GB, driver 621.40, i9-10900KF, 32 GB RAM, Rust 1.100.0 MSVC. Built with cargo build --locked --release -p xcl --bin xcl. Each run used scripts/smoke.ps1 -Game <title> -Seconds 240 -Xcl <same release exe> -OutDir <run>, Series X, the same saved start, A-button schedule, and a separate copy of the same warm 47-file XCL cache. The Windows driver cache was retained. XCL_ACTIVITY=1 XCL_NETWORK=0 XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_UMA_WINDOWS=16 XCL_FRAME_DUMP=60. Both arms used the default page allocator (XCL_TEXTURE_LEVEL_PAGES unset). Budget on used the default, off used XCL_TEXTURE_BUDGET=0.

Last present below is the end of the last two-second activity window with any presents. Memory columns are the last XCL memory sample in MiB. “First pressure” is the first video memory is filling up message.

Run First pressure (s) Last present window (s) Local / non-local Target pages Textures with omitted mips / MiB omitted
on1 25.6 104.3 10208 / 5712 5439 14188 / 3854
on2 25.2 100.2 10437 / 5745 5500 13648 / 3900
on3 25.0 98.1 10118 / 5704 5380 13634 / 3627
on4 25.4 94.1 9866 / 5711 5411 11821 / 3595
off1 — 84.0 12042 / 5706 7482 0 / 0
off2 — 88.0 12259 / 5679 7469 0 / 0
off3 — 84.0 11725 / 5679 7237 0 / 0
off4 — 84.1 11154 / 5706 7324 0 / 0

At the on-run peaks Windows reported local budgets of 6,723–7,016 MiB. Four of the eight runs logged failed storage requests, so matched request counts are approximate loading checkpoints. The last sampled frames showed loading artwork or transitions.

Four focused CPU tests and both GPU readbacks passed on this head (6 passed, 0 failed, 0 ignored, 0 explicit skips). For trilinear and 16× anisotropic filtering, all 4,096 output pixels in each test matched the fully backed texture at the same LOD clamp.

Not tested — in-world texture quality, FPS, and survival beyond the RAM guard. The results establish a loading-memory reduction; whether the policy prevents device removal on this card remains open.

AI use — OpenAI Codex (gpt-6.2-astra) ran the builds and tests and analyzed the local logs. Codex assembled this comment from those results.

27 November follow-up on host RAM

At the 32,000-request checkpoint in the eight clean runs above, median XCL process commit was 17,825 MiB with the mip budget on and 18,918.5 MiB off (four runs each). At the final Windows poll, available physical RAM was 1,457–1,941 MiB across the eight stops, while 3,653–5,667 MiB of system commit headroom remained. These counters distinguish the physical-RAM guard that stopped the runs from the system commit limit.

Two separate archived runs let us break down the growth during loading. Both used this PR plus the #2697 accounting patch at 50cfb321 (combined tree 90b22e92), the same release executable, Series X, automatic mip budget, XCL_TEXTURE_LEVEL_PAGES=1, a 47-file warm cache seed and the same saved start. The command and hardware were as above. Overcooked 2 shared the GPU during these runs. One used the learned coherent window and one set XCL_COHERENT_MB=1024.

Growth between the first activity samples crossing 32k and 110k storage requests (MiB) Learned window (5,094 MiB) 1,024 MiB window
XCL process private commit +6,889 +7,253
D3D12 heap charge, estimated by #2697 +2,156 +2,398
CPU copies of sparse pages +1,581 +1,803
Coherent window 0 0
Unattributed remainder +3,152 +3,053

The actual request counts were 34,141 → 113,663 and 32,508 → 112,946, with 698 and 1 failed requests respectively by the later sample. The learned-window run hit the physical-RAM guard, and the 1,024 MiB run completed its 240 s timer during loading. One run per setting under different initial desktop loads limits comparisons between columns. Each column reports growth within one run. The heap estimate uses local plus non-local DXGI usage less the imported coherent memory. The remainder is calculated by subtraction. Process commit does not identify physically resident pages or the allocation sites behind the remainder.

For workstream 6, this narrows an allocation trace to the loading interval where roughly 3 GiB of additional commit in each run still lacks an owner. The figures come from the archived XCL activity lines and Windows samples. OpenAI Codex (GPT-6, exact serving variant unavailable) recalculated them and cross-checked the per-run rows.

27 November hardware rerun on the RTX 3070 8 GB

Four fresh runs used the same executables, saved start, input schedule and separate copies of the same 47-file cache seed described above. Overcooked 2 was absent at launch and in every Windows poll.

On clean 4c4c5772, the first samples past 32k requests landed at 72.0 s in both runs, with zero failed requests at that point.

Mip budget Requests at checkpoint Local video memory (MiB) Process commit (MiB) Last complete requests / failed Physical RAM available at guard (MiB)
Off 34,781 8,849 18,813 91,617 / 1,831 1,762
On 34,747 7,954 17,942 119,407 / 2,011 1,932

Enabling the budget saved 895 MiB of local video memory and 871 MiB of process commit at this checkpoint. Both runs exceeded their DXGI local budgets and hit the physical-RAM guard. This time the off run also passed 65k requests, which none of the four original off runs did. Later request counts include storage failures in both arms.

On the separate #2697 diagnostic build (tree 90b22e92), the additional unattributed process commit between the 32k and 110k checkpoints was 2,880 MiB with the 1,024 MiB window (32,834 → 111,816 requests, 376 failed by the endpoint) and 3,166 MiB with the learned window (37,988 → 110,469, 756 failed). The earlier results were 3,053 and 3,152 MiB respectively. The 1,024 MiB run reached its 240 s timer, with its last nonzero present window at 162.4 s. The learned-window run exited after a read access violation at 109.0 s. Matching release symbols put texture detiling on the stack. The cause is unconfirmed.

No device removal was logged in any of the four repeats. Sampled frames showed loading art or transitions. In-world performance and image quality remain unverified. OpenAI Codex (GPT-6, exact variant unavailable) ran the trials and checked the activity logs, Windows samples and outcomes.

Follow-up on which code commits the title's reserved pages. One RTX 3070 loading run used this PR at 4c4c5772, #2750 at d08648bc and private page-transition counters (combined tree 96e76f13). Same 1,024 MiB window, cache seed, input and 240 s command as above. From 32,720 to 68,890 storage requests, Windows measured 503 MiB of growth in a 6,236 MiB reservation. XCL counted 496 MiB committed on first writes. In a separate 24 GiB reservation, DirectStorage destination preparation committed 1,393 MiB, first writes added less than 1 MiB, and physical-page unmapping decommitted 1,007 MiB. The counters gave 386 MiB net, against 393 MiB in the independent Windows snapshots. Failed storage requests rose from 0 to 85. The physical-RAM guard stopped the run during loading after the last complete interval at 90,973 requests. The 110k checkpoint and post-loading lifetime remain unmeasured. Five focused tests passed with zero failures, ignores or explicit skips. OpenAI Codex (GPT-6, exact variant unavailable) ran the trace and checked the logs. Related RTX 3060 evidence is in the workstream 6 report.

<!-- greyfinch-sync:ivall/xcl:comment:7200341758 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2385#issuecomment-7200341758). Originally posted by [milas6669](https://github.com/milas6669) on 2026-11-26T18:20:21Z. --- **RTX 3070 8 GB, same-build budget on/off** — follow-up to [the 8 GB request](https://github.com/xcl-dev/xcl/issues/1337#issuecomment-7186778530). At the first sample at or above 32,000 DirectStorage requests, median local usage was **7,937.5 MiB on / 9,009.5 MiB off** (four runs each). All four on runs reached 65,000 requests and all four off runs stopped earlier. All eight exceeded their DXGI budgets and ended during loading when Windows had under 2 GiB of physical RAM available. Device removals were **0/4 on and 0/4 off** up to those stops. One on run also logged a texture-detiling exception. **Tested** Clean head `4c4c5772f74c4fbbea461d88b844a57dc6a640a5`, Windows 11 build 26200, RTX 3070 8 GB, driver 621.40, i9-10900KF, 32 GB RAM, Rust 1.100.0 MSVC. Built with `cargo build --locked --release -p xcl --bin xcl`. Each run used `scripts/smoke.ps1 -Game <title> -Seconds 240 -Xcl <same release exe> -OutDir <run>`, Series X, the same saved start, A-button schedule, and a separate copy of the same warm 47-file XCL cache. The Windows driver cache was retained. `XCL_ACTIVITY=1 XCL_NETWORK=0 XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_UMA_WINDOWS=16 XCL_FRAME_DUMP=60`. Both arms used the default page allocator (`XCL_TEXTURE_LEVEL_PAGES` unset). Budget on used the default, off used `XCL_TEXTURE_BUDGET=0`. Last present below is the end of the last two-second activity window with any presents. Memory columns are the last XCL memory sample in MiB. “First pressure” is the first `video memory is filling up` message. | Run | First pressure (s) | Last present window (s) | Local / non-local | Target pages | Textures with omitted mips / MiB omitted | | --- | ---: | ---: | ---: | ---: | ---: | | on1 | 25.6 | 104.3 | 10208 / 5712 | 5439 | 14188 / 3854 | | on2 | 25.2 | 100.2 | 10437 / 5745 | 5500 | 13648 / 3900 | | on3 | 25.0 | 98.1 | 10118 / 5704 | 5380 | 13634 / 3627 | | on4 | 25.4 | 94.1 | 9866 / 5711 | 5411 | 11821 / 3595 | | off1 | — | 84.0 | 12042 / 5706 | 7482 | 0 / 0 | | off2 | — | 88.0 | 12259 / 5679 | 7469 | 0 / 0 | | off3 | — | 84.0 | 11725 / 5679 | 7237 | 0 / 0 | | off4 | — | 84.1 | 11154 / 5706 | 7324 | 0 / 0 | At the on-run peaks Windows reported local budgets of 6,723–7,016 MiB. Four of the eight runs logged failed storage requests, so matched request counts are approximate loading checkpoints. The last sampled frames showed loading artwork or transitions. Four focused CPU tests and both GPU readbacks passed on this head (6 passed, 0 failed, 0 ignored, 0 explicit skips). For trilinear and 16× anisotropic filtering, all 4,096 output pixels in each test matched the fully backed texture at the same LOD clamp. **Not tested** — in-world texture quality, FPS, and survival beyond the RAM guard. The results establish a loading-memory reduction; whether the policy prevents device removal on this card remains open. **AI use** — OpenAI Codex (`gpt-6.2-astra`) ran the builds and tests and analyzed the local logs. Codex assembled this comment from those results. **27 November follow-up on host RAM** At the 32,000-request checkpoint in the eight clean runs above, median XCL process commit was **17,825 MiB with the mip budget on and 18,918.5 MiB off** (four runs each). At the final Windows poll, available physical RAM was 1,457–1,941 MiB across the eight stops, while 3,653–5,667 MiB of system commit headroom remained. These counters distinguish the physical-RAM guard that stopped the runs from the system commit limit. Two separate archived runs let us break down the growth during loading. Both used this PR plus the #2697 accounting patch at `50cfb321` (combined tree `90b22e92`), the same release executable, Series X, automatic mip budget, `XCL_TEXTURE_LEVEL_PAGES=1`, a 47-file warm cache seed and the same saved start. The command and hardware were as above. Overcooked 2 shared the GPU during these runs. One used the learned coherent window and one set `XCL_COHERENT_MB=1024`. | Growth between the first activity samples crossing 32k and 110k storage requests (MiB) | Learned window (5,094 MiB) | 1,024 MiB window | | --- | ---: | ---: | | XCL process private commit | +6,889 | +7,253 | | D3D12 heap charge, estimated by #2697 | +2,156 | +2,398 | | CPU copies of sparse pages | +1,581 | +1,803 | | Coherent window | 0 | 0 | | Unattributed remainder | +3,152 | +3,053 | The actual request counts were 34,141 → 113,663 and 32,508 → 112,946, with 698 and 1 failed requests respectively by the later sample. The learned-window run hit the physical-RAM guard, and the 1,024 MiB run completed its 240 s timer during loading. One run per setting under different initial desktop loads limits comparisons between columns. Each column reports growth within one run. The heap estimate uses local plus non-local DXGI usage less the imported coherent memory. The remainder is calculated by subtraction. Process commit does not identify physically resident pages or the allocation sites behind the remainder. For workstream 6, this narrows an allocation trace to the loading interval where roughly 3 GiB of additional commit in each run still lacks an owner. The figures come from the archived XCL activity lines and Windows samples. OpenAI Codex (GPT-6, exact serving variant unavailable) recalculated them and cross-checked the per-run rows. **27 November hardware rerun on the RTX 3070 8 GB** Four fresh runs used the same executables, saved start, input schedule and separate copies of the same 47-file cache seed described above. Overcooked 2 was absent at launch and in every Windows poll. On clean `4c4c5772`, the first samples past 32k requests landed at 72.0 s in both runs, with zero failed requests at that point. | Mip budget | Requests at checkpoint | Local video memory (MiB) | Process commit (MiB) | Last complete requests / failed | Physical RAM available at guard (MiB) | | --- | ---: | ---: | ---: | ---: | ---: | | Off | 34,781 | 8,849 | 18,813 | 91,617 / 1,831 | 1,762 | | On | 34,747 | 7,954 | 17,942 | 119,407 / 2,011 | 1,932 | Enabling the budget saved 895 MiB of local video memory and 871 MiB of process commit at this checkpoint. Both runs exceeded their DXGI local budgets and hit the physical-RAM guard. This time the off run also passed 65k requests, which none of the four original off runs did. Later request counts include storage failures in both arms. On the separate #2697 diagnostic build (tree `90b22e92`), the additional **unattributed process commit** between the 32k and 110k checkpoints was **2,880 MiB** with the 1,024 MiB window (32,834 → 111,816 requests, 376 failed by the endpoint) and **3,166 MiB** with the learned window (37,988 → 110,469, 756 failed). The earlier results were 3,053 and 3,152 MiB respectively. The 1,024 MiB run reached its 240 s timer, with its last nonzero present window at 162.4 s. The learned-window run exited after a read access violation at 109.0 s. Matching release symbols put texture detiling on the stack. The cause is unconfirmed. No device removal was logged in any of the four repeats. Sampled frames showed loading art or transitions. In-world performance and image quality remain unverified. OpenAI Codex (GPT-6, exact variant unavailable) ran the trials and checked the activity logs, Windows samples and outcomes. **Follow-up on which code commits the title's reserved pages.** One RTX 3070 loading run used this PR at `4c4c5772`, #2750 at `d08648bc` and private page-transition counters (combined tree `96e76f13`). Same 1,024 MiB window, cache seed, input and 240 s command as above. From 32,720 to 68,890 storage requests, Windows measured 503 MiB of growth in a 6,236 MiB reservation. XCL counted 496 MiB committed on first writes. In a separate 24 GiB reservation, DirectStorage destination preparation committed 1,393 MiB, first writes added less than 1 MiB, and physical-page unmapping decommitted 1,007 MiB. The counters gave 386 MiB net, against 393 MiB in the independent Windows snapshots. Failed storage requests rose from 0 to 85. The physical-RAM guard stopped the run during loading after the last complete interval at 90,973 requests. The 110k checkpoint and post-loading lifetime remain unmeasured. Five focused tests passed with zero failures, ignores or explicit skips. OpenAI Codex (GPT-6, exact variant unavailable) ran the trace and checked the logs. Related RTX 3060 evidence is in the [workstream 6 report](https://github.com/xcl-dev/xcl/issues/2688#issuecomment-7190016474).
thehollowedone commented 2026-11-27 22:31:17 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-27T22:31:17Z.


merge-check
base: 2c717a04
head: 4c4c5772
merge: Clean trial merge into this main with git merge --no-commit --no-ff.
build: cargo build --workspace --locked passed.
tests: cargo test --workspace --locked --no-fail-fast -- --test-threads=4: 1,471 passed, 1 failed, 47 ignored; 25 GPU skip notices. The sole failure was console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk, also seen on clean main on this machine. A test-only extension of the PR's existing tiled-resource GPU test failed 0 passed / 1 failed on the RTX 3080 Ti (command below).
review: Not yet. When the top mip is omitted, an SRV restricted to mip 0 (MostDetailedMip=0, MipLevels=1) has no backed mip in its view. clamp_skipped_mips raises ResourceMinLODClamp to 1 but leaves that view range unchanged. In the GPU readback, SampleLevel returned zero instead of mip 1's value: [34, 51, 0, 0, 0] versus [34, 51, 0, 34, 34]; the first three values are the PR's existing controls. The fifth value shows a separate limit: GatherRed on the full-chain clamped view also returned zero. Gather selects mip 0 of its view, so widening a mip-0-only view alone does not address it. I suggest making the first retained mip accessible to ordinary sampling while preserving the title's descriptor metadata, then either retaining the top mip for gather users or giving gather a view rebased to the first backed mip. Add regressions for both paths before enabling this policy broadly; arrays/cubes need the same boundary check.
performance: Not measured in this check. Earlier reports on this PR measured memory savings under pressure; this result concerns image correctness.
verdict: not yet
hardware / tool and model: Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti 12 GB / NVIDIA 621.35, rustc 1.99.1 MSVC, DXC 1.8.2502.11. OpenAI Codex (GPT-6.2 Sol) ran the tests and wrote this report; Codex (GPT-6.2 Astra) independently traced the descriptor and gather paths.

Focused command: cargo test -p xcl --lib gpu_a_texture_without_its_top_mip_samples_the_first_it_has --locked -- --nocapture --test-threads=1 (test-only changes below, on the clean trial merge). Neither a title smoke nor a visual capture was run in this check.

Test-only GPU regression diff
@@
-    for (uint i = 0; i < 3; i++) {
+    for (uint i = 0; i < 4; i++) {
         Texture2D<float4> t = ResourceDescriptorHeap[i];
         outb.Store(4 * i, uint(t.SampleLevel(pt, float2(0.5, 0.5), 0.0).r * 255.0 + 0.5));
     }
+    Texture2D<float4> gathered = ResourceDescriptorHeap[0];
+    outb.Store(16, uint(gathered.GatherRed(pt, float2(0.5, 0.5)).r * 255.0 + 0.5));
@@
-                .CreateDescriptorHeap(&D3D12_DESCRIPTOR_HEAP_DESC { Type: D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, NumDescriptors: 3, Flags: D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE, NodeMask: 0 })
+                .CreateDescriptorHeap(&D3D12_DESCRIPTOR_HEAP_DESC { Type: D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, NumDescriptors: 4, Flags: D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE, NodeMask: 0 })
@@
-            let view = |first: u32, skipped: u32| {
+            let view = |first: u32, skipped: u32, levels: u32| {
@@
-                    Anonymous: D3D12_SHADER_RESOURCE_VIEW_DESC_0 { Texture2D: D3D12_TEX2D_SRV { MostDetailedMip: first, MipLevels: u32::MAX, ..Default::default() } },
+                    Anonymous: D3D12_SHADER_RESOURCE_VIEW_DESC_0 { Texture2D: D3D12_TEX2D_SRV { MostDetailedMip: first, MipLevels: levels, ..Default::default() } },
@@
-            for (i, v) in [view(0, 1), view(1, 2), view(0, 0)].iter().enumerate() {
+            for (i, v) in [view(0, 1, u32::MAX), view(1, 2, u32::MAX), view(0, 0, u32::MAX), view(0, 1, 1)].iter().enumerate() {
@@
-            let got = std::slice::from_raw_parts(q as *const u32, 3).to_vec();
+            let got = std::slice::from_raw_parts(q as *const u32, 5).to_vec();
@@
-            assert_eq!(got, vec![shade(1), shade(2), 0], "clamped to mip 1; clamped from the resource's mip 0 (mip 2, not 3); mip 0 unmapped reads zero");
+            assert_eq!(got, vec![shade(1), shade(2), 0, shade(1), shade(1)], "first backed mip is available to a restricted view and gather");
<!-- greyfinch-sync:ivall/xcl:comment:7229396415 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2385#issuecomment-7229396415). Originally posted by [thehollowedone](https://github.com/thehollowedone) on 2026-11-27T22:31:17Z. --- merge-check base: [2c717a04](https://github.com/xcl-dev/xcl/commit/2c717a043c8488938179fca81da4bb9e7913a358) head: [4c4c5772](https://github.com/xcl-dev/xcl/commit/4c4c5772f74c4fbbea461d88b844a57dc6a640a5) merge: Clean trial merge into this `main` with `git merge --no-commit --no-ff`. build: `cargo build --workspace --locked` passed. tests: `cargo test --workspace --locked --no-fail-fast -- --test-threads=4`: **1,471 passed, 1 failed, 47 ignored; 25 GPU skip notices**. The sole failure was `console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk`, also seen on clean `main` on this machine. A test-only extension of the PR's existing tiled-resource GPU test failed 0 passed / 1 failed on the RTX 3080 Ti (command below). review: **Not yet.** When the top mip is omitted, an SRV restricted to mip 0 (`MostDetailedMip=0`, `MipLevels=1`) has no backed mip in its view. `clamp_skipped_mips` raises `ResourceMinLODClamp` to 1 but leaves that view range unchanged. In the GPU readback, `SampleLevel` returned zero instead of mip 1's value: **`[34, 51, 0, 0, 0]` versus `[34, 51, 0, 34, 34]`**; the first three values are the PR's existing controls. The fifth value shows a separate limit: `GatherRed` on the full-chain clamped view also returned zero. Gather selects mip 0 of its view, so widening a mip-0-only view alone does not address it. I suggest making the first retained mip accessible to ordinary sampling while preserving the title's descriptor metadata, then either retaining the top mip for gather users or giving gather a view rebased to the first backed mip. Add regressions for both paths before enabling this policy broadly; arrays/cubes need the same boundary check. performance: Not measured in this check. Earlier reports on this PR measured memory savings under pressure; this result concerns image correctness. verdict: not yet hardware / tool and model: Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti 12 GB / NVIDIA 621.35, rustc 1.99.1 MSVC, DXC 1.8.2502.11. OpenAI Codex (GPT-6.2 Sol) ran the tests and wrote this report; Codex (GPT-6.2 Astra) independently traced the descriptor and gather paths. Focused command: `cargo test -p xcl --lib gpu_a_texture_without_its_top_mip_samples_the_first_it_has --locked -- --nocapture --test-threads=1` (test-only changes below, on the clean trial merge). Neither a title smoke nor a visual capture was run in this check. <details><summary>Test-only GPU regression diff</summary> ```diff @@ - for (uint i = 0; i < 3; i++) { + for (uint i = 0; i < 4; i++) { Texture2D<float4> t = ResourceDescriptorHeap[i]; outb.Store(4 * i, uint(t.SampleLevel(pt, float2(0.5, 0.5), 0.0).r * 255.0 + 0.5)); } + Texture2D<float4> gathered = ResourceDescriptorHeap[0]; + outb.Store(16, uint(gathered.GatherRed(pt, float2(0.5, 0.5)).r * 255.0 + 0.5)); @@ - .CreateDescriptorHeap(&D3D12_DESCRIPTOR_HEAP_DESC { Type: D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, NumDescriptors: 3, Flags: D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE, NodeMask: 0 }) + .CreateDescriptorHeap(&D3D12_DESCRIPTOR_HEAP_DESC { Type: D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, NumDescriptors: 4, Flags: D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE, NodeMask: 0 }) @@ - let view = |first: u32, skipped: u32| { + let view = |first: u32, skipped: u32, levels: u32| { @@ - Anonymous: D3D12_SHADER_RESOURCE_VIEW_DESC_0 { Texture2D: D3D12_TEX2D_SRV { MostDetailedMip: first, MipLevels: u32::MAX, ..Default::default() } }, + Anonymous: D3D12_SHADER_RESOURCE_VIEW_DESC_0 { Texture2D: D3D12_TEX2D_SRV { MostDetailedMip: first, MipLevels: levels, ..Default::default() } }, @@ - for (i, v) in [view(0, 1), view(1, 2), view(0, 0)].iter().enumerate() { + for (i, v) in [view(0, 1, u32::MAX), view(1, 2, u32::MAX), view(0, 0, u32::MAX), view(0, 1, 1)].iter().enumerate() { @@ - let got = std::slice::from_raw_parts(q as *const u32, 3).to_vec(); + let got = std::slice::from_raw_parts(q as *const u32, 5).to_vec(); @@ - assert_eq!(got, vec![shade(1), shade(2), 0], "clamped to mip 1; clamped from the resource's mip 0 (mip 2, not 3); mip 0 unmapped reads zero"); + assert_eq!(got, vec![shade(1), shade(2), 0, shade(1), shade(1)], "first backed mip is available to a restricted view and gather"); ``` </details>
JJAutoCompare commented 2026-11-27 23:04:52 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-27T23:04:52Z.


Tested

Clean detached 4c4c5772f74c4fbbea461d88b844a57dc6a640a5 on Windows 11 x64 build 26200.9974, Ryzen 7 3800X, Intel Arc A770 driver 32.0.101.9175, and Rust 1.100.1 MSVC debug. I reran both stock tests from the pinned executable with --exact --nocapture --test-threads=1.

  • hle::d3d12x::vram::tests::gpu_a_texture_without_its_top_mip_filters_like_the_clamp_alone selected the Arc A770 with XCL_ADAPTER=A770 under the shared GPU lock. It printed one explicit skip, no tiled resources tier 2 or no DXC. Libtest counted the early return as 1 pass. Actual coverage: 0 GPU fixture passes, 1 skip, 0 pixel comparisons. The native process and lock wrapper both exited 0, and the binary hash held before, under, and after the lock.
  • gpu::recomp::dxc::version_tests::the_loaded_dxc_is_identified passed outside the lock with DXC/DXIL 1.9.2602.17. Host result: 1 passed, 0 failures, 0 ignores, 0 skips, exit 0.

The source gate checks for a successful D3D12_OPTIONS query and ResourceHeapTier >= 2; the run did not record the query result or a tier value.

Not tested

GPU filtering/readback, the companion fixture, title SRV wiring, retail smoke, and the full suite.

AI use

T3 Code / Codex (gpt-6.2-sol) independently reran the pinned stock tests and wrote this report.

<!-- greyfinch-sync:ivall/xcl:comment:7229854584 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2385#issuecomment-7229854584). Originally posted by [JJAutoCompare](https://github.com/JJAutoCompare) on 2026-11-27T23:04:52Z. --- **Tested** Clean detached `4c4c5772f74c4fbbea461d88b844a57dc6a640a5` on Windows 11 x64 build 26200.9974, Ryzen 7 3800X, Intel Arc A770 driver 32.0.101.9175, and Rust 1.100.1 MSVC debug. I reran both stock tests from the pinned executable with `--exact --nocapture --test-threads=1`. - `hle::d3d12x::vram::tests::gpu_a_texture_without_its_top_mip_filters_like_the_clamp_alone` selected the Arc A770 with `XCL_ADAPTER=A770` under the shared GPU lock. It printed one explicit skip, `no tiled resources tier 2 or no DXC`. Libtest counted the early return as 1 pass. **Actual coverage: 0 GPU fixture passes, 1 skip, 0 pixel comparisons.** The native process and lock wrapper both exited 0, and the binary hash held before, under, and after the lock. - `gpu::recomp::dxc::version_tests::the_loaded_dxc_is_identified` passed outside the lock with DXC/DXIL 1.9.2602.17. Host result: 1 passed, 0 failures, 0 ignores, 0 skips, exit 0. The source gate checks for a successful `D3D12_OPTIONS` query and `ResourceHeapTier >= 2`; the run did not record the query result or a tier value. **Not tested** GPU filtering/readback, the companion fixture, title SRV wiring, retail smoke, and the full suite. **AI use** T3 Code / Codex (`gpt-6.2-sol`) independently reran the pinned stock tests and wrote this report.
thehollowedone commented 2026-12-01 00:44:03 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by thehollowedone on 2026-12-01T00:44:03Z.


Current-head follow-up to my earlier GPU finding and test-only diff: I reran that focused extension on rebased head acad90b0. The production clamp_skipped_mips function and native D3D12 SRV creation were used with a synthetic reserved texture.

On Windows 11 build 26300, RTX 3080 Ti (621.40), DXC 1.8.2502.11, XCL_ADAPTER=3080 cargo test --offline --locked -p xcl --lib gpu_a_texture_without_its_top_mip_samples_the_first_it_has --target-dir ..\target -- --nocapture --test-threads=1 gave 0 passed, 1 failed, 0 ignored, 0 skips. Readback was [34, 51, 0, 0, 0]; expected [34, 51, 0, 34, 34]. The fourth value is SampleLevel through a mip-0-only view after mip 0 was omitted; the fifth is GatherRed through the full-chain clamped view. The first three existing controls still matched.

These zeroes follow the descriptor contract: the one-mip SRV has no resident mip in its range, while gather reads view mip 0, which the clamp excludes. Microsoft's D3D12 SRV fields and Direct3D functional specification §5.8 describe those boundaries. This is not evidence of an NVIDIA-only driver defect.

For the default memory policy to give a correct lower-resolution image, omit a top mip only when the resource's uses are known to tolerate that omission. Otherwise preserve its mapping and upload; the current path discards uploads to omitted mips, so a later SRV cannot recover their contents. Rebasing MostDetailedMip alone makes gather see a retained mip, but also changes explicit SampleLevel, Load, and GetDimensions behavior and widens a mip-0-only view beyond what the guest requested. Please add coverage for restricted, overlapping, and full-chain views, plus gather and explicit-LOD/load queries, before treating descriptor rebasing as a general fix.

This focused run did not exercise a title, the full workspace, arrays/cubes, or a candidate runtime fix. AI use: Codex (GPT-6.2 Sol) ran the GPU test and wrote this report; Codex (GPT-6.2 Astra) checked the source and Direct3D contract.

<!-- greyfinch-sync:ivall/xcl:comment:7296674678 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2385#issuecomment-7296674678). Originally posted by [thehollowedone](https://github.com/thehollowedone) on 2026-12-01T00:44:03Z. --- Current-head follow-up to my [earlier GPU finding and test-only diff](https://github.com/xcl-dev/xcl/pull/2385#issuecomment-7229396415): I reran that focused extension on rebased head [`acad90b0`](https://github.com/xcl-dev/xcl/commit/acad90b01b24a0ece58dc641f776bf820bd4adbe). The production `clamp_skipped_mips` function and native D3D12 SRV creation were used with a synthetic reserved texture. On Windows 11 build 26300, RTX 3080 Ti (621.40), DXC 1.8.2502.11, `XCL_ADAPTER=3080 cargo test --offline --locked -p xcl --lib gpu_a_texture_without_its_top_mip_samples_the_first_it_has --target-dir ..\target -- --nocapture --test-threads=1` gave **0 passed, 1 failed, 0 ignored, 0 skips**. Readback was `[34, 51, 0, 0, 0]`; expected `[34, 51, 0, 34, 34]`. The fourth value is `SampleLevel` through a mip-0-only view after mip 0 was omitted; the fifth is `GatherRed` through the full-chain clamped view. The first three existing controls still matched. These zeroes follow the descriptor contract: the one-mip SRV has no resident mip in its range, while gather reads view mip 0, which the clamp excludes. [Microsoft's D3D12 SRV fields](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/ns-d3d12-d3d12_tex2d_srv) and [Direct3D functional specification §5.8](https://microsoft.github.io/DirectX-Specs/d3d/archive/D3D11_3_FunctionalSpec.htm) describe those boundaries. This is not evidence of an NVIDIA-only driver defect. For the default memory policy to give a correct lower-resolution image, omit a top mip only when the resource's uses are known to tolerate that omission. Otherwise preserve its mapping and upload; the current path discards uploads to omitted mips, so a later SRV cannot recover their contents. Rebasing `MostDetailedMip` alone makes gather see a retained mip, but also changes explicit `SampleLevel`, `Load`, and `GetDimensions` behavior and widens a mip-0-only view beyond what the guest requested. Please add coverage for restricted, overlapping, and full-chain views, plus gather and explicit-LOD/load queries, before treating descriptor rebasing as a general fix. This focused run did not exercise a title, the full workspace, arrays/cubes, or a candidate runtime fix. AI use: Codex (GPT-6.2 Sol) ran the GPU test and wrote this report; Codex (GPT-6.2 Astra) checked the source and Direct3D contract.
Foniass commented 2026-12-01 07:57:57 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T07:57:57Z.


Triage (#1607) – head acad90b

#640 targets the same problem (#1773, title textures filling video memory) a different way: an opt-in page budget that evicts least-recently-touched CPU-filled textures. #2968 is closer: it also leaves a sampled texture's top levels without pages and clamps its SRVs with ResourceMinLODClamp, but only with XCL_TEXTURE_DROP_LEVELS=n and lazy levels, where this PR applies automatically by device fill (75/85/92 %) to every new sampled 2D texture.
Note for review: this is on by default (XCL_TEXTURE_BUDGET=0 turns it off), so it changes what every title looks like once local video memory passes 75 %; the regression run should show it, and the textures already created stay whole (only new ones are capped). The clamp is applied only in dev_create_srv_inner, so it depends on every view going through that path.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7304702382 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2385#issuecomment-7304702382). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T07:57:57Z. --- **Triage (#1607)** – head acad90b #640 targets the same problem (#1773, title textures filling video memory) a different way: an opt-in page budget that evicts least-recently-touched CPU-filled textures. #2968 is closer: it also leaves a sampled texture's top levels without pages and clamps its SRVs with `ResourceMinLODClamp`, but only with `XCL_TEXTURE_DROP_LEVELS=n` and lazy levels, where this PR applies automatically by device fill (75/85/92 %) to every new sampled 2D texture. Note for review: this is on by default (`XCL_TEXTURE_BUDGET=0` turns it off), so it changes what every title looks like once local video memory passes 75 %; the regression run should show it, and the textures already created stay whole (only new ones are capped). The clamp is applied only in `dev_create_srv_inner`, so it depends on every view going through that path. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2385:upstream-pr/2385'
git switch 'upstream-pr/2385'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2385'
git switch 'upstream-pr/2385'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2385'
git switch 'upstream-pr/2385'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2385'
git switch 'main'
git merge --squash 'upstream-pr/2385'
git switch 'main'
git merge --ff-only 'upstream-pr/2385'
git switch 'main'
git merge 'upstream-pr/2385'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!2375
No description provided.