D3D12.X: XCL_SPARSE_LAZY=1 gives a committed sparse-window tile video memory at its first use #2897

Manually merged
github merged 2 commits from gh-pr/2897/head into gh-pr/2897/base 2026-11-27 01:15:22 +00:00
Owner

@⁠Prime1997 on GitHub · 2026-11-26 22:17 UTC · original
Prime1997:contrib/nv-sparse-lazy → nvidia-dev · +440 −12 · 2 files · 2 commits · merged 2026-11-26 22:58 UTC

Requested by Prime · project thread

Stacked on #2895; only the top commit belongs here.

With XCL_SPARSE_LAZY=1, a tile the title commits in a sparse window is listed with no pool tile and gets video memory when it is first used: the CPU's first bytes at an upload (a used pool tile is cleared right behind its mapping, before those bytes go up), a memory write recorded on a list (immediates, fills, copies, timestamps) before the list runs, or a buffer placed on it. Bytes that find no video memory are owed and go up whole once there is some. Off by default; left out on a device whose unmapped tiles do not read zeros (tiled resources tier under 2).

Part of #2688 (workstream 4).

Why
On the Series S profile a retail title commits a page pool of 4.3 GB in a sparse window up front, 3,751 MB of it in tiles the CPU never writes, on an 8 GB card. In a 60 s run with no input (RTX 3060 Ti 8 GB, Series S profile) local video memory went from 7,503 MB to 3,022 MB with the switch, 542 frames against 376, 0 draws skipped either way.

What is in it

  • crates/xcl/src/hle/d3d12x/sparse.rs: the LAZY pool sentinel, lazy_commits / lazy_asked / the tier check, ensure_listed (commit), materialize (first use), give_memory and will_write (recorded writes), the starved list, runs_where; buffer_tiles leaves a tile with no memory out; copies back and zero runs pass a tile with no memory by.
  • crates/xcl/src/hle/d3d12x/list_x.rs: note_write / note_imm tell will_write.
  • Tests in sparse::tests (real GPU, skipped without tiled resources tier 2): a tile's first bytes reach the GPU and are still there two submits later; bytes that found no memory go up once there is some; a recorded write gives memory and a buffer never maps the sentinel; a decommitted tile frees and parks nothing, and with the switch off a commit maps at once.

Tested

  • NVIDIA GeForce RTX 3060 Ti 8 GB (driver 32.0.16.1714), Intel Core i5-10400, Windows 11 26200, rustc 1.100.0; debug tests, release smoke.
  • cargo test --locked --workspace --no-fail-fast -- --test-threads=4 with XCL_DXC_DIR set to DXC 1.9.2609.5: 1820 passed, 9 failed, 48 ignored. The 9 failures are the same tests that fail on nvidia-dev eae01502 itself (1816 passed, 9 failed, 48 ignored there, same command): async_compute_pso_registers_real_pso_and_not_standin, console_ms_in_as_slot_and_ms_with_as_are_refused_cleanly, gpu::recomp::tests::gpu_compute_thread_limits_leave_the_lanes_past_them_out, hle::d3d12x::texture_upload::tests::gpu_parts_of_a_texture_go_up_and_the_rest_stays, hle::d3d12x::texture_upload::tests::pieces_hold_the_texels_of_their_levels, split_compute_prefers_the_offline_whole_pipeline, two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs.
  • SKIPPED on this adapter: 28 (no wave64: 21, per-lane f16 form refused: 3, no dxc.exe: 1, no heap windows (opt-in: XCL_HEAP_WINDOWS=1): 1, cannot disable the driver cache (Windows Developer Mode is required): The application requested an operation that depend: 1, no heap windows: 1).
  • GitHub's Build and test (Windows, no GPU) fails here on hle::d3d12x::sparse::tests::a_gpu_write_into_a_gpu_view_lands_in_its_cpu_view (the WARP device is removed, 0x887a0005). That test passes on the card above, on this branch and on eae01502, and fails the same way on the other open pull requests against nvidia-dev (#2905, for one).

Regression run
A commit of main (b49be183, the last one before the shader preparation screen of #2555, which prepares every record before the title and so does not fit a 60 s run):

xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: NVIDIA GeForce RTX 3060 Ti
title: 419239bf
seconds: 60
exit: 0x0
frames shown: 363 (PresentX 363)
presents per 2 s (last 3): 16 17 16
device removals: 0
crashes: 0
peak commit: 15320 MB

The base of this PR, nvidia-dev eae01502:

xcl-smoke v1
commit: eae015021c639866ab061cdff2e9daf8ba9daac5
gpu: NVIDIA GeForce RTX 3060 Ti
title: 419239bf
seconds: 60
exit: 0x0
frames shown: 459 (PresentX 459)
presents per 2 s (last 3): 16 17 17
device removals: 0
crashes: 0
peak commit: 15366 MB

This PR's head:

xcl-smoke v1
commit: d24b4250c7d41282bf57a4e9a22f1768820b8603
gpu: NVIDIA GeForce RTX 3060 Ti
title: 419239bf
seconds: 60
exit: 0x0
frames shown: 426 (PresentX 426)
presents per 2 s (last 3): 16 16 17
device removals: 0
crashes: 0
peak commit: 15447 MB

Not tested

  • A translated shader that writes through a window by its address to a tile no buffer, view or recorded write named: it writes nothing there while the tile has no memory. This is why the switch is off by default.
  • The retail world with the switch on beyond the first minutes; AMD GPUs; tiled resources tier 1 (the switch is left out there).

AI use
Claude Code (Claude Fable 5.2 and Claude Opus 5.5) wrote the code, ran the suite and the regression runs on the hardware above, and wrote this description; Prime asked for it and owns the account. We coordinate the 8 GB work on the XCL Discord too: https://discord.gg/gK3y7WRRY

🤖 Generated with Claude Code

**@⁠Prime1997** on GitHub · 2026-11-26 22:17 UTC · [original](https://github.com/xcl-dev/xcl/pull/2897) `Prime1997:contrib/nv-sparse-lazy` → `nvidia-dev` · +440 −12 · 2 files · 2 commits · merged 2026-11-26 22:58 UTC <!-- claude-projects-attribution: {"github_login":"Prime1997"} --> _Requested by **Prime** · [project thread](https://claude.ai/code/project/chan_014ndQaTcZS9FWDAjYnDD1nA?thread=cmsg_014ndQaTcZS9FWDAjYnDD1nAWExb2NNMvZydbxWCtgmJcT)_ Stacked on #2895; only the top commit belongs here. With `XCL_SPARSE_LAZY=1`, a tile the title commits in a sparse window is listed with no pool tile and gets video memory when it is first used: the CPU's first bytes at an upload (a used pool tile is cleared right behind its mapping, before those bytes go up), a memory write recorded on a list (immediates, fills, copies, timestamps) before the list runs, or a buffer placed on it. Bytes that find no video memory are owed and go up whole once there is some. Off by default; left out on a device whose unmapped tiles do not read zeros (tiled resources tier under 2). Part of #2688 (workstream 4). **Why** On the Series S profile a retail title commits a page pool of 4.3 GB in a sparse window up front, 3,751 MB of it in tiles the CPU never writes, on an 8 GB card. In a 60 s run with no input (RTX 3060 Ti 8 GB, Series S profile) local video memory went from 7,503 MB to 3,022 MB with the switch, 542 frames against 376, 0 draws skipped either way. **What is in it** - `crates/xcl/src/hle/d3d12x/sparse.rs`: the `LAZY` pool sentinel, `lazy_commits` / `lazy_asked` / the tier check, `ensure_listed` (commit), `materialize` (first use), `give_memory` and `will_write` (recorded writes), the `starved` list, `runs_where`; `buffer_tiles` leaves a tile with no memory out; copies back and zero runs pass a tile with no memory by. - `crates/xcl/src/hle/d3d12x/list_x.rs`: `note_write` / `note_imm` tell `will_write`. - Tests in `sparse::tests` (real GPU, skipped without tiled resources tier 2): a tile's first bytes reach the GPU and are still there two submits later; bytes that found no memory go up once there is some; a recorded write gives memory and a buffer never maps the sentinel; a decommitted tile frees and parks nothing, and with the switch off a commit maps at once. **Tested** - NVIDIA GeForce RTX 3060 Ti 8 GB (driver 32.0.16.1714), Intel Core i5-10400, Windows 11 26200, rustc 1.100.0; debug tests, release smoke. - `cargo test --locked --workspace --no-fail-fast -- --test-threads=4` with `XCL_DXC_DIR` set to DXC 1.9.2609.5: 1820 passed, 9 failed, 48 ignored. The 9 failures are the same tests that fail on `nvidia-dev` `eae01502` itself (`1816` passed, `9` failed, `48` ignored there, same command): `async_compute_pso_registers_real_pso_and_not_standin`, `console_ms_in_as_slot_and_ms_with_as_are_refused_cleanly`, `gpu::recomp::tests::gpu_compute_thread_limits_leave_the_lanes_past_them_out`, `hle::d3d12x::texture_upload::tests::gpu_parts_of_a_texture_go_up_and_the_rest_stays`, `hle::d3d12x::texture_upload::tests::pieces_hold_the_texels_of_their_levels`, `split_compute_prefers_the_offline_whole_pipeline`, `two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs`. - SKIPPED on this adapter: 28 (no wave64: 21, per-lane f16 form refused: 3, no dxc.exe: 1, no heap windows (opt-in: XCL_HEAP_WINDOWS=1): 1, cannot disable the driver cache (Windows Developer Mode is required): The application requested an operation that depend: 1, no heap windows: 1). - GitHub's `Build and test (Windows, no GPU)` fails here on `hle::d3d12x::sparse::tests::a_gpu_write_into_a_gpu_view_lands_in_its_cpu_view` (the WARP device is removed, 0x887a0005). That test passes on the card above, on this branch and on `eae01502`, and fails the same way on the other open pull requests against `nvidia-dev` (#2905, for one). **Regression run** A commit of `main` (`b49be183`, the last one before the shader preparation screen of #2555, which prepares every record before the title and so does not fit a 60 s run): ``` xcl-smoke v1 commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7 gpu: NVIDIA GeForce RTX 3060 Ti title: 419239bf seconds: 60 exit: 0x0 frames shown: 363 (PresentX 363) presents per 2 s (last 3): 16 17 16 device removals: 0 crashes: 0 peak commit: 15320 MB ``` The base of this PR, `nvidia-dev` `eae01502`: ``` xcl-smoke v1 commit: eae015021c639866ab061cdff2e9daf8ba9daac5 gpu: NVIDIA GeForce RTX 3060 Ti title: 419239bf seconds: 60 exit: 0x0 frames shown: 459 (PresentX 459) presents per 2 s (last 3): 16 17 17 device removals: 0 crashes: 0 peak commit: 15366 MB ``` This PR's head: ``` xcl-smoke v1 commit: d24b4250c7d41282bf57a4e9a22f1768820b8603 gpu: NVIDIA GeForce RTX 3060 Ti title: 419239bf seconds: 60 exit: 0x0 frames shown: 426 (PresentX 426) presents per 2 s (last 3): 16 16 17 device removals: 0 crashes: 0 peak commit: 15447 MB ``` **Not tested** - A translated shader that writes through a window by its address to a tile no buffer, view or recorded write named: it writes nothing there while the tile has no memory. This is why the switch is off by default. - The retail world with the switch on beyond the first minutes; AMD GPUs; tiled resources tier 1 (the switch is left out there). **AI use** Claude Code (Claude Fable 5.2 and Claude Opus 5.5) wrote the code, ran the suite and the regression runs on the hardware above, and wrote this description; Prime asked for it and owns the account. We coordinate the 8 GB work on the XCL Discord too: https://discord.gg/gK3y7WRRY 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A title that commits a pool up front gets a video-memory tile for every
page at once (Series S profile of a retail title: 70,724 tiles in 2 s).
The line says how many of the windows' own tiles never had a CPU write
sent to them, so the cost of mapping at commit can be read from a log.
No behaviour change.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
A tile the title commits in a sparse window got a pool tile at the commit
(State::commit_range -> ensure_mapped). A retail title on the Series S
profile commits a page pool of 63,632 pages of 64 KiB in a sparse window up
front: 4.3 GB of video memory at once, 3,751 MB of it in tiles the CPU never
wrote, on an 8 GB card.

With XCL_SPARSE_LAZY=1 a committed tile is listed with no pool tile (LAZY)
and gets one when it is first used:
- the CPU's first bytes for it at an upload (upload_dirty); a pool tile used
  before is cleared right behind its mapping, before those bytes go up;
- a memory write recorded on a list (immediates, fills, copies, timestamps:
  will_write), before the list runs;
- a buffer placed on it (buffer_tiles); a tile that finds no video memory is
  left out of the buffer's mapping instead of naming pool u32::MAX;
- bytes that found no video memory at an upload are owed (starved) and go
  up whole once there is some.
A copy back of a tile with no memory copies nothing. The switch is left out
on a device whose unmapped tiles do not read zeros (tiled resources tier
under 2). Off by default.

Measured on an RTX 3060 Ti 8 GB, 60 s with no input, Series S profile:
local video memory 7,503 MB without the switch, 3,022 MB with it; 542
frames against 376; 0 draws skipped either way.

Tests (sparse::tests, real GPU, skipped without tiled resources tier 2): a tile's first
bytes reach the GPU and are still there two submits later; bytes that found no
memory go up once there is some; a recorded write gives memory and a buffer never
maps the sentinel; a decommitted tile frees and parks nothing, and with the switch
off a commit maps at once.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 01:15:22 +00:00
github manually merged commit d24b4250c7 into gh-pr/2897/base 2026-11-27 01:15:22 +00:00
Author
Owner

@⁠saintwolf on GitHub · 2026-11-26 22:55 UTC · original

Tested and reviewed commit d24b4250 (stacked on #2895; merged cleanly onto nvidia-dev eae01502 alongside #2892–#2896, zero conflicts).

Tested

  • Hardware: NVIDIA GeForce RTX 4070 SUPER (12 GiB, driver 32.0.16.2140), AMD Ryzen 7 7800X3D, Windows 11 build 26300, rustc 1.100.0, debug test build
  • cargo test -p xcl --lib hle::d3d12x::sparse::tests::a_lazy_tile -- --test-threads=1: 2 passed, 0 failed, 0 ignored, 0 skipped
  • cargo test -p xcl --lib hle::d3d12x::sparse::tests:: -- --test-threads=1: 66 passed, 0 failed, 1 ignored (early_commit_timing), 0 skipped (includes all 4 new lazy-tile GPU tests)

Review notes

  • Opt-in (XCL_SPARSE_LAZY=1) and properly gated on Tiled Resources Tier >= 2 (null_tiles_read_zero).
  • Checked every site touching s.mapped: the LAZY = (u32::MAX, u32::MAX) sentinel is properly filtered out in decommit_tiles, flush_pending, never_sent, readbacks, and mapped_ranges logging; OOM starvation (s.starved + clear_sent_range) and GPU write promotion (list_x::will_write -> State::give_memory) look solid.

Not tested

  • Full workspace test suite or retail-title smoke run with XCL_SPARSE_LAZY=1
  • Adapters without Tiled Resources Tier >= 2

AI use

  • Antigravity (exact model name not provided to the agent): reviewed the diff, ran the build/test commands, and drafted this report (checked before posting).
**@⁠saintwolf** on GitHub · 2026-11-26 22:55 UTC · [original](https://github.com/xcl-dev/xcl/pull/2897#issuecomment-7205100443) Tested and reviewed commit `d24b4250` (stacked on `#2895`; merged cleanly onto `nvidia-dev` `eae01502` alongside `#2892`–`#2896`, zero conflicts). **Tested** - Hardware: NVIDIA GeForce RTX 4070 SUPER (12 GiB, driver `32.0.16.2140`), AMD Ryzen 7 7800X3D, Windows 11 build 26300, `rustc 1.100.0`, debug test build - `cargo test -p xcl --lib hle::d3d12x::sparse::tests::a_lazy_tile -- --test-threads=1`: **2 passed, 0 failed, 0 ignored, 0 skipped** - `cargo test -p xcl --lib hle::d3d12x::sparse::tests:: -- --test-threads=1`: **66 passed, 0 failed, 1 ignored (`early_commit_timing`), 0 skipped** (includes all 4 new lazy-tile GPU tests) **Review notes** - Opt-in (`XCL_SPARSE_LAZY=1`) and properly gated on Tiled Resources Tier >= 2 (`null_tiles_read_zero`). - Checked every site touching `s.mapped`: the `LAZY = (u32::MAX, u32::MAX)` sentinel is properly filtered out in `decommit_tiles`, `flush_pending`, `never_sent`, readbacks, and `mapped_ranges` logging; OOM starvation (`s.starved` + `clear_sent_range`) and GPU write promotion (`list_x::will_write` -> `State::give_memory`) look solid. **Not tested** - Full workspace test suite or retail-title smoke run with `XCL_SPARSE_LAZY=1` - Adapters without Tiled Resources Tier >= 2 **AI use** - Antigravity (exact model name not provided to the agent): reviewed the diff, ran the build/test commands, and drafted this report (checked before posting).
Author
Owner

@⁠grahamster2 on GitHub · 2026-11-26 23:02 UTC · original

Test report from a 10 GB card: RTX 3080 10 GB, 31 GB RAM + 64 GB page file, Windows 11. Your #2893–#2897 are cherry-picked onto Austin's Build 16 (≈ nvidia-dev eae01502) plus #2815–#2817 and a page-placement fix (#2905). Settings: XCL_UMA_WINDOWS=16, XCL_HEAP_WINDOWS=1, XCL_COHERENT_MB=1024, GPU heaps in the sparse windows, XCL_TWO_PASS_MB=1536. Same retail title.

Series S profile, XCL_SPARSE_LAZY=1: ran clean for 440 s, with 2 of 524k draws skipped.

  • The sparse windows' line reported "20103 listed with no video memory (XCL_SPARSE_LAZY)", and sparse pools dropped from 6.8 to 5.2 GB.
  • Total local video memory didn't fall: 11.6 GB (2.5 GB over budget) against 10.9 GB without lazy. The target-page pools grew into the freed room.
  • GPU time per frame was the same within noise: 0.56–0.75 s with lazy, ~0.6 s without.

Series X profile, XCL_SPARSE_LAZY=1: DEVICE_HUNG at 209.5 s, as the world loaded.

  • The line just before it: "6013 of the windows' own 75067 mapped tiles (375 of 4691 MB) never got a byte from the CPU; 38111 listed with no video memory (XCL_SPARSE_LAZY)".
  • DRED had no breadcrumbs. The last recorded dispatches were cs 64021c4c25c9f2d0 (largest 115200 groups) and cs 67657769b50d2f8b.
  • The same build and settings without lazy (Series X) ran its full 440 s with no hang, at 15 GB local.
  • So I think this is the known gap (a shader writing by address to a tile nothing else touched), hit on the bigger profile. One run only, so not proven.

Happy to run a variant if you want something specific.

**@⁠grahamster2** on GitHub · 2026-11-26 23:02 UTC · [original](https://github.com/xcl-dev/xcl/pull/2897#issuecomment-7205203099) Test report from a 10 GB card: RTX 3080 10 GB, 31 GB RAM + 64 GB page file, Windows 11. Your #2893–#2897 are cherry-picked onto Austin's Build 16 (≈ nvidia-dev eae01502) plus #2815–#2817 and a page-placement fix (#2905). Settings: `XCL_UMA_WINDOWS=16`, `XCL_HEAP_WINDOWS=1`, `XCL_COHERENT_MB=1024`, GPU heaps in the sparse windows, `XCL_TWO_PASS_MB=1536`. Same retail title. **Series S profile, `XCL_SPARSE_LAZY=1`:** ran clean for 440 s, with 2 of 524k draws skipped. - The sparse windows' line reported "20103 listed with no video memory (XCL_SPARSE_LAZY)", and sparse pools dropped from 6.8 to 5.2 GB. - Total local video memory didn't fall: 11.6 GB (2.5 GB over budget) against 10.9 GB without lazy. The target-page pools grew into the freed room. - GPU time per frame was the same within noise: 0.56–0.75 s with lazy, ~0.6 s without. **Series X profile, `XCL_SPARSE_LAZY=1`:** `DEVICE_HUNG` at 209.5 s, as the world loaded. - The line just before it: "6013 of the windows' own 75067 mapped tiles (375 of 4691 MB) never got a byte from the CPU; 38111 listed with no video memory (XCL_SPARSE_LAZY)". - DRED had no breadcrumbs. The last recorded dispatches were cs `64021c4c25c9f2d0` (largest 115200 groups) and cs `67657769b50d2f8b`. - The same build and settings without lazy (Series X) ran its full 440 s with no hang, at 15 GB local. - So I think this is the known gap (a shader writing by address to a tile nothing else touched), hit on the bigger profile. One run only, so not proven. Happy to run a variant if you want something specific.
Author
Owner

@⁠upipibi on GitHub · 2026-11-26 23:37 UTC · original

The sparse tests with XCL_SPARSE_LAZY=1 set, which saintwolf's report lists as not run: RTX 3070 (Ampere), driver 616.56, Windows 11, rustc 1.100.0, debug. nvidia-dev at eff3bcabf1b6f99223796ece166948003a53e0bc, compared with the pre-merge eae015021c639866ab061cdff2e9daf8ba9daac5. Synthetic tests only.

cargo test -p xcl --lib -- hle::d3d12x::sparse::tests:: --test-threads=1, 3 runs each on eff3bcab:

  • XCL_SPARSE_LAZY unset: 66 passed, 0 failed, 1 ignored (early_commit_timing) in all 3 runs. The 4 new lazy-tile tests pass.
  • XCL_SPARSE_LAZY=1 set for the whole process: 62 passed, 4 failed, 1 ignored in all 3 runs. The 4 new lazy-tile tests still pass, but 4 older tests fail every time:
    • a_copy_back_does_not_wait_for_the_title_queue (sparse.rs:5080, "the copy back did not land")
    • a_tile_decommitted_and_committed_again_keeps_its_video_memory (:5733)
    • flush_parked_does_not_free_or_reuse_tiles_while_unmap_is_in_flight (:6076)
    • flush_parked_quarantines_tiles_until_title_queues_finish (:6121)
  • On eae01502 the same =1 command gives 62 passed, 0 failed, so the failures come with the lazy path.

My guess is that these four assume a tile gets its video memory at commit, so they would need the lazy mode turned off for the test, like the LAZY_COMMITS_FOR_TEST switch. I haven't traced it, though. One of them could also be a real gap in the lazy path, such as a copy back from a tile that has had no write yet.

Lib suite, cargo test -p xcl --lib -- --test-threads=4, XCL_* unset: eff3bcab 1695 passed, 3 failed, 28 ignored; eae01502 1689 passed, 3 failed, 28 ignored. The same 3 failures are on both trees: gpu_compute_thread_limits_leave_the_lanes_past_them_out (HLSL wave32 pipeline, 0x80070057), and two texture_upload tests with a multiply overflow at texture_upload.rs:1002. So #2892-#2897 add no failure here. No driver reset in any run.

Not tested: retail title.

AI-assisted (Claude Code, Claude Sonnet 5.5 ran the tests; Claude Opus 5.5 checked and posted).

**@⁠upipibi** on GitHub · 2026-11-26 23:37 UTC · [original](https://github.com/xcl-dev/xcl/pull/2897#issuecomment-7205710642) The sparse tests with `XCL_SPARSE_LAZY=1` set, which saintwolf's report lists as not run: RTX 3070 (Ampere), driver 616.56, Windows 11, rustc 1.100.0, debug. `nvidia-dev` at `eff3bcabf1b6f99223796ece166948003a53e0bc`, compared with the pre-merge `eae015021c639866ab061cdff2e9daf8ba9daac5`. Synthetic tests only. `cargo test -p xcl --lib -- hle::d3d12x::sparse::tests:: --test-threads=1`, 3 runs each on `eff3bcab`: - `XCL_SPARSE_LAZY` unset: 66 passed, 0 failed, 1 ignored (`early_commit_timing`) in all 3 runs. The 4 new lazy-tile tests pass. - `XCL_SPARSE_LAZY=1` set for the whole process: 62 passed, 4 failed, 1 ignored in all 3 runs. The 4 new lazy-tile tests still pass, but 4 older tests fail every time: - `a_copy_back_does_not_wait_for_the_title_queue` (sparse.rs:5080, "the copy back did not land") - `a_tile_decommitted_and_committed_again_keeps_its_video_memory` (:5733) - `flush_parked_does_not_free_or_reuse_tiles_while_unmap_is_in_flight` (:6076) - `flush_parked_quarantines_tiles_until_title_queues_finish` (:6121) - On `eae01502` the same `=1` command gives 62 passed, 0 failed, so the failures come with the lazy path. My guess is that these four assume a tile gets its video memory at commit, so they would need the lazy mode turned off for the test, like the `LAZY_COMMITS_FOR_TEST` switch. I haven't traced it, though. One of them could also be a real gap in the lazy path, such as a copy back from a tile that has had no write yet. Lib suite, `cargo test -p xcl --lib -- --test-threads=4`, `XCL_*` unset: `eff3bcab` 1695 passed, 3 failed, 28 ignored; `eae01502` 1689 passed, 3 failed, 28 ignored. The same 3 failures are on both trees: `gpu_compute_thread_limits_leave_the_lanes_past_them_out` (HLSL wave32 pipeline, 0x80070057), and two `texture_upload` tests with a multiply overflow at texture_upload.rs:1002. So #2892-#2897 add no failure here. No driver reset in any run. Not tested: retail title. AI-assisted (Claude Code, Claude Sonnet 5.5 ran the tests; Claude Opus 5.5 checked and posted).
Author
Owner

@⁠upipibi on GitHub · 2026-11-26 23:44 UTC · original

Thanks for keeping this opt-in behind the tier check. Two questions and a test note, all by reading at eff3bcab, not run. They may bear on grahamster2's Series X hang above, but that's only a guess.

  1. A recorded write that finds no memory is dropped. give_memory (crates/xcl/src/hle/d3d12x/sparse.rs:1538-1545) ignores the left count from materialize. While short_of_memory() holds (sparse.rs:3567) and no tile is at hand, or when take_tile cannot make a heap, a fill, copy, timestamp or immediate recorded on a list (list_x.rs:772, :793) into a LAZY tile goes nowhere. Nothing retries it, the way starved retries CPU bytes. Copies back also skip LAZY tiles (sparse.rs 2030 and 2120), so the CPU view never gets a fill or copy result either. Immediates are stored on the CPU by after_execute, so the CPU sees those, but a later GPU read of the same address reads zeros. Should these asks be kept, like starved, or should a recorded write take a tile with force like a placed buffer does?

  2. The asks are taken at record time. will_write runs while the list is recorded. A closed list that runs again on a later submit, or a range committed (listed LAZY) after the list was recorded but before it is submitted, gets no give_memory. The list's sparse_writes and sparse_imm are still there at execute (list_x.rs:2436, readback_sparse_writes). Could the asks be taken from the lists in the ExecuteCommandLists hook instead?

  3. Test note. In a_lazy_tile_gets_memory_at_its_first_bytes_and_keeps_them, the comment says a used pool tile is on hand so that its old bytes would show if it weren't cleared. But the test only sets no_memory = None. On a fresh state the first take_tile makes a new heap and returns used == false (sparse.rs:1259), so the inline clear of a reused tile in upload_dirty is never exercised, and that part of the test can't fail. Freeing and reusing a tile first (decommit one tile and commit another) would cover it.

AI-assisted (Claude Code, Claude Opus 5.5): read the code at eff3bcab and wrote this; nothing was run for these points.

**@⁠upipibi** on GitHub · 2026-11-26 23:44 UTC · [original](https://github.com/xcl-dev/xcl/pull/2897#issuecomment-7205810002) Thanks for keeping this opt-in behind the tier check. Two questions and a test note, all by reading at `eff3bcab`, not run. They may bear on grahamster2's Series X hang above, but that's only a guess. 1. **A recorded write that finds no memory is dropped.** `give_memory` (`crates/xcl/src/hle/d3d12x/sparse.rs:1538-1545`) ignores the `left` count from `materialize`. While `short_of_memory()` holds (`sparse.rs:3567`) and no tile is at hand, or when `take_tile` cannot make a heap, a fill, copy, timestamp or immediate recorded on a list (`list_x.rs:772`, `:793`) into a `LAZY` tile goes nowhere. Nothing retries it, the way `starved` retries CPU bytes. Copies back also skip `LAZY` tiles (`sparse.rs` 2030 and 2120), so the CPU view never gets a fill or copy result either. Immediates are stored on the CPU by `after_execute`, so the CPU sees those, but a later GPU read of the same address reads zeros. Should these asks be kept, like `starved`, or should a recorded write take a tile with `force` like a placed buffer does? 2. **The asks are taken at record time.** `will_write` runs while the list is recorded. A closed list that runs again on a later submit, or a range committed (listed `LAZY`) after the list was recorded but before it is submitted, gets no `give_memory`. The list's `sparse_writes` and `sparse_imm` are still there at execute (`list_x.rs:2436`, `readback_sparse_writes`). Could the asks be taken from the lists in the `ExecuteCommandLists` hook instead? 3. **Test note.** In `a_lazy_tile_gets_memory_at_its_first_bytes_and_keeps_them`, the comment says a used pool tile is on hand so that its old bytes would show if it weren't cleared. But the test only sets `no_memory = None`. On a fresh state the first `take_tile` makes a new heap and returns `used == false` (`sparse.rs:1259`), so the inline clear of a reused tile in `upload_dirty` is never exercised, and that part of the test can't fail. Freeing and reusing a tile first (decommit one tile and commit another) would cover it. AI-assisted (Claude Code, Claude Opus 5.5): read the code at `eff3bcab` and wrote this; nothing was run for these points.
This discussion has been locked. Commenting is limited to contributors.
No description provided.