D3D12.X: add opt-in XCL_SPARSE_VRAM_CAP_MB to overflow sparse pools to L0 system memory #3112

Open
iggyvilla wants to merge 1 commit from upstream-pr/3112 into amd-dev
iggyvilla commented 2026-11-28 08:44:32 +00:00 (Migrated from github.com)

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


Adds an opt-in XCL_SPARSE_VRAM_CAP_MB=<N> environment variable (unset by default: zero behavior change) that overflows sparse page-pool allocations past N MiB of local video memory into L0 write-back system-memory heaps, and reports L0 sparse pools separately in memory_report.rs.

TL;DR — Before vs After

Metric Before (origin/amd-dev 41aa60ce) After (93570fea, XCL_SPARSE_VRAM_CAP_MB unset) After (XCL_SPARSE_VRAM_CAP_MB=1024, RX 7800 XT report)
60 s smoke frames / peak commit 1,654 / 15,902 MB (0 crashes) 1,645 / 15,818 MB (0 crashes) —
Peak local sparse pools / local VRAM 2,236 MB / 6,896 MB Unchanged (opt-in off) 1,024 MB / 5,784 MB (−1,112 MB local)
L0 sparse pool reporting Not tracked "sparse pools in system memory" (uma_segment) Reported separately from video memory

What is in it

  • crates/xcl/src/hle/d3d12x/sparse.rs: XCL_SPARSE_VRAM_CAP_MB parsing, pool_is_sys parallel tracking, heap-kind matching when recycling retired pools, L0 fallback to video memory on CreateHeap failure, split local/L0 memory_bytes_for, unit test sparse_vram_cap_parses_pool_counts, and GPU test sparse_vram_cap_overflows_to_l0_and_reports_separately.
  • crates/xcl/src/hle/d3d12x/memory_report.rs: exposes "sparse pools in system memory" on uma_segment(non_local) (non-local on discrete GPUs, local on single-segment/UMA adapters).

Tested

  • Hardware: AMD Radeon RX 6650 XT 8 GB (RDNA2, driver 32.0.21045.29003), AMD Ryzen 7 5700X, Windows 11 x64, rustc 1.100.0 (0ef1bc386 2026-11-09), debug tests + release smoke.
  • cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4: 2,960 passed, 13 failed, 49 ignored. All 13 failures reproduce identically on clean origin/amd-dev 41aa60ce (2,954 passed, 17 failed, 49 ignored: 3 pre-existing RDNA2 f32/NaN tests, 6 parallel sparse/title_textures shared-global contention tests, test_title_runs_and_game_folder_is_untouched, and two_pass_driver_cache_e2e). SKIPPED (7): 4× f16_programs_on_the_gpu (unsupported V_MUL_F16/V_PK_MUL_F16 per-lane), 2× heap-window tests (XCL_HEAP_WINDOWS=1 opt-in), 1× pso_measurement_compiles_an_exact_synthetic_record (Windows Developer Mode not enabled).
  • Targeted single-threaded run cargo test -p xcl --lib -- hle::d3d12x::sparse::tests::sparse_vram_cap hle::d3d12x::memory_report::tests --test-threads=1: all passed, 0 failed, 0 skipped.
  • Independent community reports on earlier head 5ca76771: JJAutoCompare (12/12 env-parsing cases) and moombathepilot (RX 7800 XT 300 s run showing local sparse pools capped at 1,024 MB vs 2,236 MB baseline, local VRAM 5,784 vs 6,896 MB).

Regression run
Base (main, required by pr_check.py):

xcl-smoke v1
commit: d8bd9a38204667f3ca7dd9eeffcc2f1c937b07b0
gpu: AMD Radeon RX 6650 XT
title: 1778c2d9
seconds: 60
exit: 0x0
frames shown: 1618 (PresentX 1618)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 15479 MB

Base (origin/amd-dev merge base):

xcl-smoke v1
commit: 41aa60ce842060a597b7e8724896f7bf6a031af5
gpu: AMD Radeon RX 6650 XT
title: 1778c2d9
seconds: 60
exit: 0x0
frames shown: 1654 (PresentX 1654)
presents per 2 s (last 3): 60 61 60
device removals: 0
crashes: 0
peak commit: 15902 MB

PR head (93570fea, XCL_SPARSE_VRAM_CAP_MB unset):

xcl-smoke v1
commit: 93570fea74162f7b2a60ac891c99b3b57542b8c2
gpu: AMD Radeon RX 6650 XT
title: 1778c2d9
seconds: 60
exit: 0x0
frames shown: 1645 (PresentX 1645)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 15818 MB

Not tested

  • NVIDIA and Intel GPUs, single-segment/integrated GPUs (relies on existing uma_segment(non_local)), and Wine.

AI use

  • Antigravity (Gemini 4 Neon High) updated memory_report.rs to use uma_segment(non_local), ran the workspace GPU test suite and 60 s smoke, and updated this description.
<!-- greyfinch-sync:ivall/xcl:issue:5538420339 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3112). Originally posted by [iggyvilla](https://github.com/iggyvilla) on 2026-11-28T08:44:32Z. --- Adds an opt-in `XCL_SPARSE_VRAM_CAP_MB=<N>` environment variable (unset by default: zero behavior change) that overflows sparse page-pool allocations past `N` MiB of local video memory into L0 write-back system-memory heaps, and reports L0 sparse pools separately in `memory_report.rs`. ### TL;DR — Before vs After | Metric | Before (`origin/amd-dev` `41aa60ce`) | After (`93570fea`, `XCL_SPARSE_VRAM_CAP_MB` unset) | After (`XCL_SPARSE_VRAM_CAP_MB=1024`, RX 7800 XT report) | |---|---|---|---| | **60 s smoke frames / peak commit** | `1,654` / `15,902 MB` (`0` crashes) | `1,645` / `15,818 MB` (`0` crashes) | — | | **Peak local sparse pools / local VRAM** | `2,236 MB` / `6,896 MB` | Unchanged (opt-in off) | `1,024 MB` / `5,784 MB` (**−1,112 MB** local) | | **L0 sparse pool reporting** | Not tracked | `"sparse pools in system memory"` (`uma_segment`) | Reported separately from video memory | **What is in it** - `crates/xcl/src/hle/d3d12x/sparse.rs`: `XCL_SPARSE_VRAM_CAP_MB` parsing, `pool_is_sys` parallel tracking, heap-kind matching when recycling retired pools, L0 fallback to video memory on `CreateHeap` failure, split local/L0 `memory_bytes_for`, unit test `sparse_vram_cap_parses_pool_counts`, and GPU test `sparse_vram_cap_overflows_to_l0_and_reports_separately`. - `crates/xcl/src/hle/d3d12x/memory_report.rs`: exposes `"sparse pools in system memory"` on `uma_segment(non_local)` (non-local on discrete GPUs, local on single-segment/UMA adapters). **Tested** - Hardware: AMD Radeon RX 6650 XT 8 GB (RDNA2, driver `32.0.21045.29003`), AMD Ryzen 7 5700X, Windows 11 x64, `rustc 1.100.0 (0ef1bc386 2026-11-09)`, debug tests + release smoke. - `cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4`: **2,960 passed, 13 failed, 49 ignored**. All 13 failures reproduce identically on clean `origin/amd-dev` `41aa60ce` (`2,954 passed, 17 failed, 49 ignored`: 3 pre-existing RDNA2 f32/NaN tests, 6 parallel `sparse`/`title_textures` shared-global contention tests, `test_title_runs_and_game_folder_is_untouched`, and `two_pass_driver_cache_e2e`). `SKIPPED` (7): 4× `f16_programs_on_the_gpu` (unsupported `V_MUL_F16`/`V_PK_MUL_F16` per-lane), 2× heap-window tests (`XCL_HEAP_WINDOWS=1` opt-in), 1× `pso_measurement_compiles_an_exact_synthetic_record` (Windows Developer Mode not enabled). - Targeted single-threaded run `cargo test -p xcl --lib -- hle::d3d12x::sparse::tests::sparse_vram_cap hle::d3d12x::memory_report::tests --test-threads=1`: **all passed, 0 failed, 0 skipped**. - Independent community reports on earlier head `5ca76771`: JJAutoCompare (12/12 env-parsing cases) and moombathepilot (RX 7800 XT 300 s run showing local sparse pools capped at `1,024 MB` vs `2,236 MB` baseline, local VRAM `5,784` vs `6,896 MB`). **Regression run** Base (`main`, required by `pr_check.py`): ``` xcl-smoke v1 commit: d8bd9a38204667f3ca7dd9eeffcc2f1c937b07b0 gpu: AMD Radeon RX 6650 XT title: 1778c2d9 seconds: 60 exit: 0x0 frames shown: 1618 (PresentX 1618) presents per 2 s (last 3): 61 60 60 device removals: 0 crashes: 0 peak commit: 15479 MB ``` Base (`origin/amd-dev` merge base): ``` xcl-smoke v1 commit: 41aa60ce842060a597b7e8724896f7bf6a031af5 gpu: AMD Radeon RX 6650 XT title: 1778c2d9 seconds: 60 exit: 0x0 frames shown: 1654 (PresentX 1654) presents per 2 s (last 3): 60 61 60 device removals: 0 crashes: 0 peak commit: 15902 MB ``` PR head (`93570fea`, `XCL_SPARSE_VRAM_CAP_MB` unset): ``` xcl-smoke v1 commit: 93570fea74162f7b2a60ac891c99b3b57542b8c2 gpu: AMD Radeon RX 6650 XT title: 1778c2d9 seconds: 60 exit: 0x0 frames shown: 1645 (PresentX 1645) presents per 2 s (last 3): 61 60 60 device removals: 0 crashes: 0 peak commit: 15818 MB ``` **Not tested** - NVIDIA and Intel GPUs, single-segment/integrated GPUs (relies on existing `uma_segment(non_local)`), and Wine. **AI use** - Antigravity (Gemini 4 Neon High) updated `memory_report.rs` to use `uma_segment(non_local)`, ran the workspace GPU test suite and 60 s smoke, and updated this description.
JJAutoCompare commented 2026-11-28 09:35:51 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-28T09:35:51Z.


Tested

Exact 5ca76771ad326f8df7f68731bd7fa8112883ef2a on the amd-dev PR, Windows 11 x64 build 26200.9974, Ryzen 7 3800X, and Rust 1.100.1 MSVC. I reran the pinned standalone CPU harness after verifying that TILE, POOL_TILES, and sparse_vram_cap_pools matched the Git source byte-for-byte. The harness used a print-only stand-in for xlog_info!.

I ran sparse_cap.exe --exact fresh_process_cap --nocapture --test-threads=1 once per setting in 12 fresh processes with child-only environments. Each process returned the same result on its second call.

XCL_SPARSE_VRAM_CAP_MB Result
Unset, empty, invalid, -1, 4.5 None
0, 3 Some(0)
4, 7 Some(1)
8 Some(2)
1024, space-padded " 1025 " Some(256)

The process readbacks distinguished Err(NotPresent) from Ok("") and showed both spaces in " 1025 ". 12 passed, 0 failed, 0 ignored, 0 runtime skips. Every native process exited 0 with zero tests filtered out.

Not tested

Device or GPU behavior, heap allocation or fallback, tile mapping, VRAM accounting, production logging, performance, retail smoke, and the full suite.

AI use

T3 Code through the Codex harness (gpt-6.2-sol) verified the source and executable, reran the cases, and wrote this report.

<!-- greyfinch-sync:ivall/xcl:comment:7237342846 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3112#issuecomment-7237342846). Originally posted by [JJAutoCompare](https://github.com/JJAutoCompare) on 2026-11-28T09:35:51Z. --- **Tested** Exact `5ca76771ad326f8df7f68731bd7fa8112883ef2a` on the `amd-dev` PR, Windows 11 x64 build 26200.9974, Ryzen 7 3800X, and Rust 1.100.1 MSVC. I reran the pinned standalone CPU harness after verifying that `TILE`, `POOL_TILES`, and `sparse_vram_cap_pools` matched the Git source byte-for-byte. The harness used a print-only stand-in for `xlog_info!`. I ran `sparse_cap.exe --exact fresh_process_cap --nocapture --test-threads=1` once per setting in 12 fresh processes with child-only environments. Each process returned the same result on its second call. | `XCL_SPARSE_VRAM_CAP_MB` | Result | |---|---| | Unset, empty, `invalid`, `-1`, `4.5` | `None` | | `0`, `3` | `Some(0)` | | `4`, `7` | `Some(1)` | | `8` | `Some(2)` | | `1024`, space-padded `" 1025 "` | `Some(256)` | The process readbacks distinguished `Err(NotPresent)` from `Ok("")` and showed both spaces in `" 1025 "`. **12 passed, 0 failed, 0 ignored, 0 runtime skips.** Every native process exited 0 with zero tests filtered out. **Not tested** Device or GPU behavior, heap allocation or fallback, tile mapping, VRAM accounting, production logging, performance, retail smoke, and the full suite. **AI use** T3 Code through the Codex harness (`gpt-6.2-sol`) verified the source and executable, reran the cases, and wrote this report.
moombathepilot commented 2026-11-28 10:39:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by moombathepilot on 2026-11-28T10:39:41Z.


RX 7800 XT comparison

I compared release builds of the latest amd-dev (7c795f5eefa0661eaf3f9f696d0cba3a75ce9628) and this PR (5ca76771ad326f8df7f68731bd7fa8112883ef2a), whose parent is that amd-dev commit. Both source trees were clean. Neither build included the local XG compatibility patch.

Hardware: RX 7800 XT, AMD driver 32.0.32029.2010, Ryzen 7 5700X3D, 64 GiB RAM, Windows 11 build 26300.9974. I used separate title-data folders and separate copies of the same starting warm DXIL cache. There was one run per revision.

Common settings: XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_RT_GATE=miss XCL_PRESS_A_AT=20,24,30,45,60,90,120,150,180,210,240,270 XCL_RUN_SECONDS=300 XCL_PIPELINE_MAX_KB=1150 XCL_PSO_MAX_KB=1150 XCL_DRED=1 XCL_PREPARE=0 XCL_COHERENT_CAP_MB=2048 XCL_TEXTURE_LEVEL_PAGES=1. Each run also set XCL_DATA_ROOT and XCL_DXIL_CACHE to its own folder. XCL_SPARSE_VRAM_CAP_MB was unset on the amd-dev baseline and 1024 on the PR. Both logs confirmed a 2,048 MB coherent window and the first scripted A press at 20.003 s.

Measure amd-dev baseline (cap unset) PR #3112 (1,024 MB cap)
Peak reported local sparse pools 2,236 MB 1,024 MB
Peak local video memory 6,896 MB 5,784 MB
Peak non-local video memory 2,792 MB 4,041 MB
Peak process commit 21,440 MB 21,338 MB
Presents counted 2,289 2,039
Last interval with a present 200.238 s 198.947 s
Last console code so far 24,132 draws (512 skipped), 3,057 dispatches (0 skipped) 21,085 draws (513 skipped), 2,871 dispatches (0 skipped)
Exit 0xe06d7363; stack includes xboxbvhbuilder.dll+0xd2538 Same
Device removal / DRED removal None None

The PR log confirms the cap setting and reports local sparse pools staying at 1,024 MB. The drop in local video memory and rise in non-local use are consistent with overflow to system memory. These counters do not directly count L0 heaps. Both runs ended at the same earlier BVH builder exception, so this test shows the memory cap taking effect on RDNA3, not improved world-load progress. With one run per revision, I cannot attribute the frame-count difference to the PR.

cargo test -p xcl --lib hle::d3d12x::sparse:: -- --test-threads=4 on the PR: 39 passed, 0 failed, 1 ignored. I did not run the full workspace suite or scripts/smoke.ps1.

Driver compile starts without a logged finish at exit: amd-dev baseline, one MS PSO (339,108 B DXIL); PR, two MS PSOs (376,292 B and 265,320 B DXIL). Those start lines contain no hashes and do not establish a driver hang.

AI use: OpenAI Codex (GPT-6) verified the commits, prepared the builds and runs, analyzed the logs, and drafted this report. I ran the test on my PC.

<!-- greyfinch-sync:ivall/xcl:comment:7238039365 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3112#issuecomment-7238039365). Originally posted by [moombathepilot](https://github.com/moombathepilot) on 2026-11-28T10:39:41Z. --- **RX 7800 XT comparison** I compared release builds of the latest `amd-dev` (`7c795f5eefa0661eaf3f9f696d0cba3a75ce9628`) and this PR (`5ca76771ad326f8df7f68731bd7fa8112883ef2a`), whose parent is that `amd-dev` commit. Both source trees were clean. Neither build included the local XG compatibility patch. Hardware: RX 7800 XT, AMD driver `32.0.32029.2010`, Ryzen 7 5700X3D, 64 GiB RAM, Windows 11 build `26300.9974`. I used separate title-data folders and separate copies of the same starting warm DXIL cache. There was one run per revision. Common settings: `XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_RT_GATE=miss XCL_PRESS_A_AT=20,24,30,45,60,90,120,150,180,210,240,270 XCL_RUN_SECONDS=300 XCL_PIPELINE_MAX_KB=1150 XCL_PSO_MAX_KB=1150 XCL_DRED=1 XCL_PREPARE=0 XCL_COHERENT_CAP_MB=2048 XCL_TEXTURE_LEVEL_PAGES=1`. Each run also set `XCL_DATA_ROOT` and `XCL_DXIL_CACHE` to its own folder. `XCL_SPARSE_VRAM_CAP_MB` was unset on the amd-dev baseline and `1024` on the PR. Both logs confirmed a 2,048 MB coherent window and the first scripted A press at 20.003 s. | Measure | amd-dev baseline (cap unset) | PR #3112 (1,024 MB cap) | | --- | ---: | ---: | | Peak reported local sparse pools | 2,236 MB | 1,024 MB | | Peak local video memory | 6,896 MB | 5,784 MB | | Peak non-local video memory | 2,792 MB | 4,041 MB | | Peak process commit | 21,440 MB | 21,338 MB | | Presents counted | 2,289 | 2,039 | | Last interval with a present | 200.238 s | 198.947 s | | Last `console code so far` | 24,132 draws (512 skipped), 3,057 dispatches (0 skipped) | 21,085 draws (513 skipped), 2,871 dispatches (0 skipped) | | Exit | `0xe06d7363`; stack includes `xboxbvhbuilder.dll+0xd2538` | Same | | Device removal / DRED removal | None | None | The PR log confirms the cap setting and reports local sparse pools staying at 1,024 MB. The drop in local video memory and rise in non-local use are consistent with overflow to system memory. These counters do not directly count L0 heaps. Both runs ended at the same earlier BVH builder exception, so this test shows the memory cap taking effect on RDNA3, **not** improved world-load progress. With one run per revision, I cannot attribute the frame-count difference to the PR. `cargo test -p xcl --lib hle::d3d12x::sparse:: -- --test-threads=4` on the PR: 39 passed, 0 failed, 1 ignored. I did not run the full workspace suite or `scripts/smoke.ps1`. Driver compile starts without a logged finish at exit: amd-dev baseline, one MS PSO (339,108 B DXIL); PR, two MS PSOs (376,292 B and 265,320 B DXIL). Those start lines contain no hashes and do not establish a driver hang. AI use: OpenAI Codex (GPT-6) verified the commits, prepared the builds and runs, analyzed the logs, and drafted this report. I ran the test on my PC.
Foniass commented 2026-12-01 09:32:01 +00:00 (Migrated from github.com)

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


Triage (#1607) – head a0f65e2

Related, not the same: #2987 (against main) puts sparse tiles outside the title's GPU heaps into L0 system-memory pools (XCL_SPARSE_SYSMEM), choosing by what a range holds. This PR caps video-memory sparse pools by size on amd-dev. The change is not on amd-dev yet.
No correctness problems found in sparse.rs. pool_is_sys is kept alongside pools, retired heaps are reused only for the same kind, and pool_bytes leaves L0 pools out. sparse_vram_cap_overflows_to_l0_and_reports_separately now covers the L0 overflow path (take_tile_with_cap), reuse of a retired L0 pool, and the separate byte counts.
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:7306838297 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3112#issuecomment-7306838297). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T09:32:01Z. --- **Triage (#1607)** – head a0f65e2 Related, not the same: #2987 (against main) puts sparse tiles outside the title's GPU heaps into L0 system-memory pools (`XCL_SPARSE_SYSMEM`), choosing by what a range holds. This PR caps video-memory sparse pools by size on amd-dev. The change is not on amd-dev yet. No correctness problems found in `sparse.rs`. `pool_is_sys` is kept alongside `pools`, retired heaps are reused only for the same kind, and `pool_bytes` leaves L0 pools out. `sparse_vram_cap_overflows_to_l0_and_reports_separately` now covers the L0 overflow path (`take_tile_with_cap`), reuse of a retired L0 pool, and the separate byte counts. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Foniass commented 2026-12-01 10:36:27 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T10:36:27Z.


Review (head b0077129, diff read, not a merge-check; draft, base amd-dev, conflicts with it):

  • Pools past the cap go to system memory whatever they hold, and never move back. Placement is first-come: GPU-written buffers can land in L0 and are then read and written over PCIe. Render targets can't, since the heaps are buffer-only (sparse.rs ~1554). moombathepilot's RDNA3 run had fewer frames, but with one run per side it can't be put on the PR.
  • L0 use is invisible. pool_bytes (~1226) leaves L0 pools out, and nothing else reports them.
  • No test covers the overflow path, and NVIDIA is untested. It conflicts with amd-dev, where the retired tuple changed shape (~2746 there).
  • The red CI comes from the base: release_tests::the_last_release_drops_entries_before_the_object_goes and exit 0x887a0005 fail the same way on #3111 at the same base f33df5a7. The description check fails on peak commit, which the author shows is amd-dev's own number.

Fine: off when unset (parsing checked by JJAutoCompare), retired heaps are reused only for the same kind, and a failed L0 heap creation falls back to video memory. #3335 / #3039 put texture levels in system memory, a different path; #2987 (main) overlaps in what it does.

AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7308440613 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3112#issuecomment-7308440613). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T10:36:27Z. --- Review (head b0077129, diff read, not a merge-check; draft, base `amd-dev`, conflicts with it): - **Pools past the cap go to system memory whatever they hold, and never move back.** Placement is first-come: GPU-written buffers can land in L0 and are then read and written over PCIe. Render targets can't, since the heaps are buffer-only (`sparse.rs` ~1554). moombathepilot's RDNA3 run had fewer frames, but with one run per side it can't be put on the PR. - **L0 use is invisible.** `pool_bytes` (~1226) leaves L0 pools out, and nothing else reports them. - No test covers the overflow path, and NVIDIA is untested. It conflicts with amd-dev, where the `retired` tuple changed shape (~2746 there). - The red CI comes from the base: `release_tests::the_last_release_drops_entries_before_the_object_goes` and exit 0x887a0005 fail the same way on #3111 at the same base f33df5a7. The description check fails on peak commit, which the author shows is amd-dev's own number. Fine: off when unset (parsing checked by JJAutoCompare), retired heaps are reused only for the same kind, and a failed L0 heap creation falls back to video memory. #3335 / #3039 put texture levels in system memory, a different path; #2987 (main) overlaps in what it does. AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
iggyvilla commented 2026-12-01 17:14:00 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by iggyvilla on 2026-12-01T17:14:00Z.


Rebased onto amd-dev 41aa60ce (a0f65e2f) addressing the review points:

  • Resolved the sparse.rs retired tuple merge conflict.
  • Exposed L0 sparse pools in memory_report.rs as "sparse pools in system memory" on Kind::NonLocal (while keeping video-memory counts local-only).
  • Added unit test sparse_vram_cap_parses_pool_counts and GPU test sparse_vram_cap_overflows_to_l0_and_reports_separately covering L0 overflow allocation, retired-pool kind matching, and split accounting.
  • Refreshed the 60 s smoke.ps1 regression run (1,643 frames, 15,430 MB peak commit — now under main's 15,479 MB).

Note: first-come placement past the cap remains intentional for this opt-in MiB cap (workload-aware placement is tracked separately by #2987 and #3587).

<!-- greyfinch-sync:ivall/xcl:comment:7318969980 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3112#issuecomment-7318969980). Originally posted by [iggyvilla](https://github.com/iggyvilla) on 2026-12-01T17:14:00Z. --- Rebased onto `amd-dev` `41aa60ce` (`a0f65e2f`) addressing the review points: - Resolved the `sparse.rs` `retired` tuple merge conflict. - Exposed L0 sparse pools in `memory_report.rs` as `"sparse pools in system memory"` on `Kind::NonLocal` (while keeping video-memory counts local-only). - Added unit test `sparse_vram_cap_parses_pool_counts` and GPU test `sparse_vram_cap_overflows_to_l0_and_reports_separately` covering L0 overflow allocation, retired-pool kind matching, and split accounting. - Refreshed the 60 s `smoke.ps1` regression run (1,643 frames, 15,430 MB peak commit — now under `main`'s 15,479 MB). Note: first-come placement past the cap remains intentional for this opt-in MiB cap (workload-aware placement is tracked separately by #2987 and #3587).
Foniass commented 2026-12-02 04:13:30 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T04:13:30Z.


Follow-up review (head 93570fea, since a0f65e2f, diff read, not a merge-check; draft):

  • L0 use is invisible: fixed. memory_bytes_for reports system-memory pools separately and memory_report lists them as "sparse pools in system memory"; this push files them under uma_segment(non_local) (memory_report.rs ~151), so on a single-segment adapter they count as local, as DXGI does.
  • No test of the overflow path: fixed; sparse_vram_cap_overflows_to_l0_and_reports_separately and sparse_vram_cap_parses_pool_counts were added, and the branch now sits on the current amd-dev tip.
  • Pools past the cap go to system memory whatever they hold, and never move back: still open; placement is still first-come (take_tile_with_cap).

New: none; only the segment kind changed since a0f65e2f.

AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7334687988 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3112#issuecomment-7334687988). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-02T04:13:30Z. --- Follow-up review (head 93570fea, since a0f65e2f, diff read, not a merge-check; draft): - **L0 use is invisible:** fixed. `memory_bytes_for` reports system-memory pools separately and `memory_report` lists them as "sparse pools in system memory"; this push files them under `uma_segment(non_local)` (`memory_report.rs` ~151), so on a single-segment adapter they count as local, as DXGI does. - **No test of the overflow path:** fixed; `sparse_vram_cap_overflows_to_l0_and_reports_separately` and `sparse_vram_cap_parses_pool_counts` were added, and the branch now sits on the current `amd-dev` tip. - **Pools past the cap go to system memory whatever they hold, and never move back:** still open; placement is still first-come (`take_tile_with_cap`). New: none; only the segment kind changed since `a0f65e2f`. AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Foniass commented 2026-12-02 13:41:36 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T13:41:36Z.


Test report (not a merge-check: draft)
base: 41aa60ce84
head: 93570fea74
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2963 passed, 9 failed, 49 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on amd-dev); failing: gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu, gpu::recomp::tests::gpu_fract_f32_edges, hle::d3d12x::sparse::tests::private_physical_pages_reach_the_gpu_on_mapping, hle::d3d12x::title_textures::tests::placed_title_textures_share_vram_and_preserve_pixels, hle::d3d12x::title_textures::tests::remapped_pages_are_compared_with_what_they_held, hle::d3d12x::title_textures::tests::stream_recheck_keeps_the_whole_upload_baseline_over_partial_uploads, hle::d3d12x::title_textures::tests::stream_recheck_partial_upload_without_an_entry_queues_a_whole_upload, hle::d3d12x::title_textures::tests::stream_recheck_schedule_catches_late_writes_and_resets_milestones (the same tests fail on amd-dev 41aa60ce alone on this card, so none is from this PR)
review: read by one reviewer at this same head; the review is at https://github.com/xcl-dev/xcl/pull/3112#issuecomment-7334687988 and its findings stand. Most serious: past the cap, take_tile_with_cap (sparse.rs ~3886) sends new pools to system memory in arrival order and never moves them back (a limit of an opt-in switch, not a bug).
performance: 60 s smoke of a retail title, amd-dev 41aa60ce vs this merge (93570fea): 1671 -> 1687 frames shown (100 %; last presents per 2 s: 60 60 60), peak commit 16722 -> 16853 MB, 0 device removals, 0 crashes.
assessment: merges cleanly into amd-dev, adds no test failure, and the smoke run is clean; the review found no blocking problem (past the cap, new pools go to system memory in arrival order and never move back, a limit of the opt-in switch); ready for a merge-check once it leaves draft
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5

AI-written and posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7347291263 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3112#issuecomment-7347291263). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-02T13:41:36Z. --- Test report (not a merge-check: draft) base: 41aa60ce842060a597b7e8724896f7bf6a031af5 head: 93570fea74162f7b2a60ac891c99b3b57542b8c2 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2963 passed, 9 failed, 49 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on amd-dev); failing: gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu, gpu::recomp::tests::gpu_fract_f32_edges, hle::d3d12x::sparse::tests::private_physical_pages_reach_the_gpu_on_mapping, hle::d3d12x::title_textures::tests::placed_title_textures_share_vram_and_preserve_pixels, hle::d3d12x::title_textures::tests::remapped_pages_are_compared_with_what_they_held, hle::d3d12x::title_textures::tests::stream_recheck_keeps_the_whole_upload_baseline_over_partial_uploads, hle::d3d12x::title_textures::tests::stream_recheck_partial_upload_without_an_entry_queues_a_whole_upload, hle::d3d12x::title_textures::tests::stream_recheck_schedule_catches_late_writes_and_resets_milestones (the same tests fail on amd-dev 41aa60ce alone on this card, so none is from this PR) review: read by one reviewer at this same head; the review is at https://github.com/xcl-dev/xcl/pull/3112#issuecomment-7334687988 and its findings stand. Most serious: past the cap, `take_tile_with_cap` (`sparse.rs` ~3886) sends new pools to system memory in arrival order and never moves them back (a limit of an opt-in switch, not a bug). performance: 60 s smoke of a retail title, amd-dev 41aa60ce vs this merge (93570fea): 1671 -> 1687 frames shown (100 %; last presents per 2 s: 60 60 60), peak commit 16722 -> 16853 MB, 0 device removals, 0 crashes. assessment: merges cleanly into amd-dev, adds no test failure, and the smoke run is clean; the review found no blocking problem (past the cap, new pools go to system memory in arrival order and never move back, a limit of the opt-in switch); ready for a merge-check once it leaves draft hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5 AI-written and posted by Foniass without a human check of each point.
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/3112:upstream-pr/3112'
git switch 'upstream-pr/3112'

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 'amd-dev'
git merge --no-ff 'upstream-pr/3112'
git switch 'upstream-pr/3112'
git rebase 'amd-dev'
git switch 'amd-dev'
git merge --ff-only 'upstream-pr/3112'
git switch 'upstream-pr/3112'
git rebase 'amd-dev'
git switch 'amd-dev'
git merge --no-ff 'upstream-pr/3112'
git switch 'amd-dev'
git merge --squash 'upstream-pr/3112'
git switch 'amd-dev'
git merge --ff-only 'upstream-pr/3112'
git switch 'amd-dev'
git merge 'upstream-pr/3112'
git push origin 'amd-dev'
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!3112
No description provided.