kernelx: XCL_COHERENT_HEAPS=sparse:N puts big GPU heaps in video memory #1999

Closed
Ariorh1337 wants to merge 2 commits from upstream-pr/2009 into main
Ariorh1337 commented 2026-11-25 00:40:48 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Ariorh1337 on 2026-11-25T00:40:48Z.


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

An opt-in switch, XCL_COHERENT_HEAPS=sparse[:N], that puts a title's GPU heaps (committed with a PAGE_GRAPHICS_* protection) in the sparse windows (video memory) instead of the coherent window (process memory the GPU reaches over the bus). With sparse every heap moves, with sparse:N those of at least N MB. Part of #505.

Why. In the coherent window, on an RTX 5090:

  • dependent reads from a shader are ~30× slower than from video memory (no L2 hits, about 2.4 µs each);
  • store instructions whose lanes leave gaps (per-lane dwordx2/x4, 8- and 16-byte formats) run at about 0.1 GB/s. Lane-contiguous ones run at about 50 GB/s, and the same stores in video memory at over 1 TB/s. Micro-benchmark in my #505 comments.

The retail title of #505 keeps 4.4 GB of heaps there (1172, 2199, 563 and 596 MB), and its world passes take 0.4–2.7 s each.

Keeping the heaps out of the window (XCL_COHERENT_HEAPS=0) removed the GPU stall on an RTX 5090, an RTX 5080 (@kanade333), an RTX 3080 (@not-rex) and RDNA3 / Linux (@lucsoft). But there the shaders read zeros, and the 3D picture is black. This switch keeps them GPU-visible at the same addresses.

Where it does not pay. The moved heaps cost their size in video memory. On 12 GB cards two people measured it:

  • mgrein (RTX 4070 12 GB, #1773): with sparse:1024 the world-load stall is gone, but local video memory reaches 20 GB by 256 s and CreatePlacedResourceX fails with E_OUTOFMEMORY. Without the switch the world load stalls at once (queue.Wait time-outs from 132 s, device removed at 575 s).

  • joeypercia (RTX 4070 Ti 12 GB, with a page budget, #1773): with sparse:512 the device went at 184.6 s instead of 304 s. Texture pools went to system memory from 23 s on, and compute passes slowed to ~0.5 s a dispatch.

  • STmihan (RTX 3070 Ti 8 GB, on this PR): sparse:2048 (the 2199 MB heap only) made the world's compute passes 27–36× faster, and then local video memory ran to 17–21 GB and the 5 s timeouts came back past ~16 GB.

So the switch is for cards whose video memory holds the heaps on top of the title's textures (24–32 GB). It stays off by default. The next step is a limit by the adapter's video-memory budget instead of a fixed size.

Other ways at the same problem:

  • #1329 (XCL_UMA_SHADOW=1) keeps a copy of the whole committed window in video memory. This switch moves only the big heaps.
  • #2090 (XCL_SPARSE_DIRECT=1) goes the other way: the sparse windows become memory the GPU reads where it is, which ends the write-watch scan and the copies back. With it, this switch has nothing to gain, since the heaps would land in system memory again. Which way is faster on a card with enough video memory is not measured yet; I'll run both on the RTX 5090.

What is in it (crates/xcl/src/hle/kernelx.rs, one commit)

  • In the coherent-heap branch of VirtualAlloc, a heap the switch selects goes to d3d12x::sparse::alloc, as the title's MEM_GRAPHICS commits already do. A heap that goes there is not counted in the coherent window's size for the next run (note_coherent_need).
  • parse_sparse_heaps and the test sparse_heaps_setting.
  • Off by default. It costs a second copy in video memory and the per-submit write-watch scan of it. It needs #1993: the title's lists write into these heaps (fence values among them), and without #1993 each copy back of such a write waits for the submitting thread.

Tested

  • RTX 5090 32 GB (driver 32.0.16.1692), Ryzen 7 9800X3D, 64 GB, Windows 11 Pro 26300, rustc 1.99.0, DXC 1.9.2609.5.
  • cargo test --workspace --no-fail-fast -- --test-threads=4 (debug):
    • this PR (2f49088, on #1993 0a755f0 and main 06055a7): 1419 passed, 4 failed, 46 ignored;
    • main (06055a7): 1409 passed, 4 failed, 46 ignored.
    • The 4 failures are gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3 (0x8007000E), the same on main. SKIPPED: 26 lines, the same tests as on main.
  • Retail title (1.0.2.1), on a local tree: main b9b6ea6 + open PRs + #1329 + the earlier prototype of #1993 + this switch, with XCL_COHERENT_HEAPS=sparse:1024 XCL_HEAP_WINDOWS=1. That moves the 1172 and 2199 MB heaps; the 563 and 596 MB ones, which hold the fences, stay in the window.
    • The intro played to the in-game HUD.
    • The title ran 465 s after the first #101 with 0 draws and 0 dispatches skipped.
    • 125 123 ops of console code took 21.1 s of GPU time. With the heaps in the window it was 30.9 s for 23 452 ops, and the title stopped ~45 s after #101.
    • One run each.
  • Retail title on 2f49088 alone (main 06055a7 + #1993 + this PR, XCL_COHERENT_HEAPS=sparse:1024 XCL_HEAP_WINDOWS=1, release): both big heaps moved (sparse pools 5.4 GB, local video memory 17.7 GB). The world's first burst ran (7861 dispatches after the first #101) with no GPU wait or copy back running out and no crash or device removal in 438 s. Presents stopped 8 s after the first #101 while the title waited on cold driver builds of compute pipelines (68 with no driver blob for main's HLSL on this machine). So this shows the switch's path up to there, not the world running with it.
  • Cost seen in that run: the write-watch scan of the sparse windows took 88 s of the first 137 s (7.9 M dirty pages). That is the main thing between this and a default. theaustinayers' looks at the blocks written lately (7c18bc4 in #2057) go at that cost; #2057 runs this switch as sparse:16.

Regression run
scripts/smoke.ps1 -Game <retail title> -Seconds 60 (start screen, no input, switch not set, so this checks the default path), XCL_HEAP_WINDOWS=1, same machine. The main block is the one from #1993.

xcl-smoke v1
commit: 06055a7a0fb43c5f83f55e7a2ce201417de171e9
gpu: NVIDIA GeForce RTX 5090
title: a155fb60
seconds: 60
exit: 0x0
frames shown: 1604 (PresentX 1604)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 14766 MB
xcl-smoke v1
commit: 2f490889758f32dfafd9c0593dd1125332168c7d
gpu: NVIDIA GeForce RTX 5090
title: a155fb60
seconds: 60
exit: 0x0
frames shown: 1607 (PresentX 1607)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14995 MB

Not tested

  • Cards with 16 GB or less. The two runs above on 12 GB cards say it hurts there.
  • The switch on Intel. On AMD only lucsoft's runs (RX 7800 XT 16 GB, Linux, on this PR): sparse:1024 on 99a7e4f with #1993 and about 20 other PRs; two runs reached the prologue with no device removal and no GPU-wait timeout, at about 1 fps, with the write-watch scan taking 215 s by 811 s.
  • The world running on main + #1993 + this PR with the switch: the run above stops on cold compute builds first. The smoke run does not set the switch.
  • sparse without :N (every heap, the fences included) in a title run on top of #1993. On my prototype, moving every heap made the readbacks of fence writes the bottleneck.

AI use

  • Claude Code (Claude Opus 5.5) found the cause with a micro-benchmark and the title runs, wrote the change and the test, ran the suite and the smoke runs on the machine above, and wrote this description. I read the diff and checked the results before pushing.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5482865497 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2009). Originally posted by [Ariorh1337](https://github.com/Ariorh1337) on 2026-11-25T00:40:48Z. --- Stacked on #1993; only the top commit belongs here. An opt-in switch, `XCL_COHERENT_HEAPS=sparse[:N]`, that puts a title's GPU heaps (committed with a `PAGE_GRAPHICS_*` protection) in the sparse windows (video memory) instead of the coherent window (process memory the GPU reaches over the bus). With `sparse` every heap moves, with `sparse:N` those of at least N MB. Part of #505. **Why.** In the coherent window, on an RTX 5090: - **dependent reads** from a shader are ~30× slower than from video memory (no L2 hits, about 2.4 µs each); - **store instructions whose lanes leave gaps** (per-lane `dwordx2`/`x4`, 8- and 16-byte formats) run at about 0.1 GB/s. Lane-contiguous ones run at about 50 GB/s, and the same stores in video memory at over 1 TB/s. Micro-benchmark in my #505 comments. The retail title of #505 keeps 4.4 GB of heaps there (1172, 2199, 563 and 596 MB), and its world passes take 0.4–2.7 s each. Keeping the heaps out of the window (`XCL_COHERENT_HEAPS=0`) removed the GPU stall on an RTX 5090, an RTX 5080 (@kanade333), an RTX 3080 (@not-rex) and RDNA3 / Linux (@lucsoft). But there the shaders read zeros, and the 3D picture is black. This switch keeps them GPU-visible at the same addresses. **Where it does not pay.** The moved heaps cost their size in video memory. On 12 GB cards two people measured it: - mgrein (RTX 4070 12 GB, [#1773](https://github.com/xcl-dev/xcl/issues/1773#issuecomment-7155226080)): with `sparse:1024` the world-load stall is gone, but local video memory reaches 20 GB by 256 s and `CreatePlacedResourceX` fails with `E_OUTOFMEMORY`. Without the switch the world load stalls at once (`queue.Wait` time-outs from 132 s, device removed at 575 s). - joeypercia (RTX 4070 Ti 12 GB, with a page budget, [#1773](https://github.com/xcl-dev/xcl/issues/1773#issuecomment-7158420181)): with `sparse:512` the device went at 184.6 s instead of 304 s. Texture pools went to system memory from 23 s on, and compute passes slowed to ~0.5 s a dispatch. - STmihan (RTX 3070 Ti 8 GB, [on this PR](https://github.com/xcl-dev/xcl/pull/2009#issuecomment-7163621368)): `sparse:2048` (the 2199 MB heap only) made the world's compute passes 27–36× faster, and then local video memory ran to 17–21 GB and the 5 s timeouts came back past ~16 GB. So the switch is for cards whose video memory holds the heaps on top of the title's textures (24–32 GB). It stays off by default. The next step is a limit by the adapter's video-memory budget instead of a fixed size. **Other ways at the same problem:** - #1329 (`XCL_UMA_SHADOW=1`) keeps a copy of the whole committed window in video memory. This switch moves only the big heaps. - #2090 (`XCL_SPARSE_DIRECT=1`) goes the other way: the sparse windows become memory the GPU reads where it is, which ends the write-watch scan and the copies back. With it, this switch has nothing to gain, since the heaps would land in system memory again. Which way is faster on a card with enough video memory is not measured yet; I'll run both on the RTX 5090. **What is in it** (`crates/xcl/src/hle/kernelx.rs`, one commit) - In the coherent-heap branch of `VirtualAlloc`, a heap the switch selects goes to `d3d12x::sparse::alloc`, as the title's `MEM_GRAPHICS` commits already do. A heap that goes there is not counted in the coherent window's size for the next run (`note_coherent_need`). - `parse_sparse_heaps` and the test `sparse_heaps_setting`. - **Off by default.** It costs a second copy in video memory and the per-submit write-watch scan of it. It needs #1993: the title's lists write into these heaps (fence values among them), and without #1993 each copy back of such a write waits for the submitting thread. **Tested** - RTX 5090 32 GB (driver 32.0.16.1692), Ryzen 7 9800X3D, 64 GB, Windows 11 Pro 26300, rustc 1.99.0, DXC 1.9.2609.5. - `cargo test --workspace --no-fail-fast -- --test-threads=4` (debug): - this PR (`2f49088`, on #1993 `0a755f0` and `main` `06055a7`): 1419 passed, 4 failed, 46 ignored; - `main` (`06055a7`): 1409 passed, 4 failed, 46 ignored. - The 4 failures are `gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3` (`0x8007000E`), the same on `main`. SKIPPED: 26 lines, the same tests as on `main`. - **Retail title** (1.0.2.1), on a local tree: `main` `b9b6ea6` + open PRs + #1329 + the earlier prototype of #1993 + this switch, with `XCL_COHERENT_HEAPS=sparse:1024 XCL_HEAP_WINDOWS=1`. That moves the 1172 and 2199 MB heaps; the 563 and 596 MB ones, which hold the fences, stay in the window. - The intro played to the in-game HUD. - The title ran 465 s after the first `#101` with 0 draws and 0 dispatches skipped. - 125 123 ops of console code took 21.1 s of GPU time. With the heaps in the window it was 30.9 s for 23 452 ops, and the title stopped ~45 s after `#101`. - One run each. - **Retail title on `2f49088` alone** (`main` `06055a7` + #1993 + this PR, `XCL_COHERENT_HEAPS=sparse:1024 XCL_HEAP_WINDOWS=1`, release): both big heaps moved (sparse pools 5.4 GB, local video memory 17.7 GB). The world's first burst ran (7861 dispatches after the first `#101`) with no GPU wait or copy back running out and no crash or device removal in 438 s. Presents stopped 8 s after the first `#101` while the title waited on cold driver builds of compute pipelines (68 with no driver blob for `main`'s HLSL on this machine). So this shows the switch's path up to there, not the world running with it. - **Cost seen in that run:** the write-watch scan of the sparse windows took 88 s of the first 137 s (7.9 M dirty pages). That is the main thing between this and a default. theaustinayers' looks at the blocks written lately (`7c18bc4` in #2057) go at that cost; #2057 runs this switch as `sparse:16`. **Regression run** `scripts/smoke.ps1 -Game <retail title> -Seconds 60` (start screen, no input, switch not set, so this checks the default path), `XCL_HEAP_WINDOWS=1`, same machine. The `main` block is the one from #1993. ``` xcl-smoke v1 commit: 06055a7a0fb43c5f83f55e7a2ce201417de171e9 gpu: NVIDIA GeForce RTX 5090 title: a155fb60 seconds: 60 exit: 0x0 frames shown: 1604 (PresentX 1604) presents per 2 s (last 3): 61 60 60 device removals: 0 crashes: 0 peak commit: 14766 MB ``` ``` xcl-smoke v1 commit: 2f490889758f32dfafd9c0593dd1125332168c7d gpu: NVIDIA GeForce RTX 5090 title: a155fb60 seconds: 60 exit: 0x0 frames shown: 1607 (PresentX 1607) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14995 MB ``` **Not tested** - Cards with 16 GB or less. The two runs above on 12 GB cards say it hurts there. - The switch on Intel. On AMD only lucsoft's runs (RX 7800 XT 16 GB, Linux, [on this PR](https://github.com/xcl-dev/xcl/pull/2009)): `sparse:1024` on `99a7e4f` with #1993 and about 20 other PRs; two runs reached the prologue with no device removal and no GPU-wait timeout, at about 1 fps, with the write-watch scan taking 215 s by 811 s. - **The world running on `main` + #1993 + this PR with the switch:** the run above stops on cold compute builds first. The smoke run does not set the switch. - `sparse` without `:N` (every heap, the fences included) in a title run on top of #1993. On my prototype, moving every heap made the readbacks of fence writes the bottleneck. **AI use** - Claude Code (Claude Opus 5.5) found the cause with a micro-benchmark and the title runs, wrote the change and the test, ran the suite and the smoke runs on the machine above, and wrote this description. I read the diff and checked the results before pushing. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
futurepro62 commented 2026-11-25 01:11:05 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-25T01:05:48Z.


Full-suite run, since this PR has no test report yet. Tested exact head 5370f4b (on its base 8e87fc7).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::dxil::fuzz_tests: 981 passed, 0 failed, 43 ignored. SKIPPED (no wave64): a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu, a_per_lane_2d_or_3d_group_runs_on_the_gpu, coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu, cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu, gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware, the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu.
  • The new tests ran and passed: a_copy_back_does_not_wait_for_the_title_queue, sparse_heaps_setting.
  • Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 991 passed, 0 failed, 45 ignored. SKIPPED: f16_programs_on_the_gpu (f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), f32_programs_on_the_gpu (f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))), f32_programs_on_the_gpu (f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • --skip leaves out tests that fail on main 7994cd1 too, not because of this PR. On NVIDIA: heap_window_out_of_memory_falls_back_to_the_switch_form (#1651), the four gpu::recomp::lower_dxil::tests::*_programs_on_the_gpu tests and const_and_null_mask_operands_agree_with_hlsl_on_the_gpu (follow-up on #1651) fail because runner::skip_test turns their skips into failures under XCL_REQUIRE_GPU=mesh, and gpu::dxil::fuzz_tests seeds 70, 545, 1019 and 1507 fail CreateComputePipelineState with E_OUTOFMEMORY on this card (drivers 616.64 and 621.40). On AMD: fuzz_validate_and_gpu_1 fails on seed 540 (res[833] 0x7 vs CPU 0x6). The AMD run does not set XCL_REQUIRE_GPU.

Not tested

  • a release build, a game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
<!-- greyfinch-sync:ivall/xcl:comment:7149201133 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2009#issuecomment-7149201133). Originally posted by [futurepro62](https://github.com/futurepro62) on 2026-11-25T01:05:48Z. --- Full-suite run, since this PR has no test report yet. Tested exact head `5370f4b` (on its base `8e87fc7`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed. - `cargo build --workspace`, then `XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::dxil::fuzz_tests`: **981 passed, 0 failed, 43 ignored**. SKIPPED (no wave64): `a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu`, `a_per_lane_2d_or_3d_group_runs_on_the_gpu`, `coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu`, `cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu`, `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`, `the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu`. - The new tests ran and passed: `a_copy_back_does_not_wait_for_the_title_queue`, `sparse_heaps_setting`. - Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, `XCL_ADAPTER=radeon`), `cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1`: **991 passed, 0 failed, 45 ignored**. SKIPPED: `f16_programs_on_the_gpu` (f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), `f16_programs_on_the_gpu` (f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), `f16_programs_on_the_gpu` (f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), `f16_programs_on_the_gpu` (f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), `f32_programs_on_the_gpu` (f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))), `f32_programs_on_the_gpu` (f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))), `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows). - `--skip` leaves out tests that fail on main `7994cd1` too, not because of this PR. On NVIDIA: `heap_window_out_of_memory_falls_back_to_the_switch_form` (#1651), the four `gpu::recomp::lower_dxil::tests::*_programs_on_the_gpu` tests and `const_and_null_mask_operands_agree_with_hlsl_on_the_gpu` ([follow-up on #1651](https://github.com/xcl-dev/xcl/issues/1651#issuecomment-7146069648)) fail because `runner::skip_test` turns their skips into failures under `XCL_REQUIRE_GPU=mesh`, and `gpu::dxil::fuzz_tests` seeds 70, 545, 1019 and 1507 fail `CreateComputePipelineState` with `E_OUTOFMEMORY` on this card (drivers 616.64 and 621.40). On AMD: `fuzz_validate_and_gpu_1` fails on seed 540 (`res[833]` 0x7 vs CPU 0x6). The AMD run does not set `XCL_REQUIRE_GPU`. **Not tested** - a release build, a game (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
raylitebull commented 2026-11-25 02:08:40 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-25T01:12:55Z.


Code review on 5370f4b:

  • In crates/xcl/src/hle/kernelx.rs, sparse_heaps_min() / parse_sparse_heaps (XCL_COHERENT_HEAPS=sparse[:N], overflow-safe checked_mul(1 << 20), and sparse_heaps_setting unit tests) cleanly routes graphics heaps >= N MiB into d3d12x::sparse::alloc.
  • Diff audited and CI workflow approved (currently running).
  • Note: This branch also carries the crates/xcl/src/hle/d3d12x/sparse.rs async-readback changes from #1993 — so please keep the shared monotonic rb_fence multi-queue ordering note from #1993 in mind (or rebase onto #1993 once settled).

Remaining before merge: Settling the #1993 sparse.rs overlap / multi-queue rb_fence note, Build and test finishing green, and an AMD verification pass.

<!-- greyfinch-sync:ivall/xcl:comment:7149321488 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2009#issuecomment-7149321488). Originally posted by [raylitebull](https://github.com/raylitebull) on 2026-11-25T01:12:55Z. --- Code review on `5370f4b`: - In `crates/xcl/src/hle/kernelx.rs`, `sparse_heaps_min()` / `parse_sparse_heaps` (`XCL_COHERENT_HEAPS=sparse[:N]`, overflow-safe `checked_mul(1 << 20)`, and `sparse_heaps_setting` unit tests) cleanly routes graphics heaps `>= N MiB` into `d3d12x::sparse::alloc`. - Diff audited and `CI` workflow approved (currently running). - **Note:** This branch also carries the `crates/xcl/src/hle/d3d12x/sparse.rs` async-readback changes from `#1993` — so please keep the shared monotonic `rb_fence` multi-queue ordering note from `#1993` in mind (or rebase onto `#1993` once settled). **Remaining before merge:** Settling the `#1993` `sparse.rs` overlap / multi-queue `rb_fence` note, `Build and test` finishing green, and an **AMD** verification pass.
Filip722 commented 2026-11-25 02:08:54 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Filip722 on 2026-11-25T01:40:47Z.


On the RTX 5060 Laptop GPU (8 GiB), the first sample with zero render-target pages showed 256 MiB of sparse pools on main and 3,584 MiB with #1993 + #2009 (197 and 3,527 MiB mapped). The cost was already visible before render-target streaming.

Requested size Main bf9eebd 5370f4b integrated on the same main
1,172 MiB Coherent Sparse VRAM
2,199 MiB Write-watched fallback Sparse VRAM
563 MiB Coherent Coherent
596 MiB Write-watched fallback Coherent

Both offline Series X runs used fresh copies of the same prefix/cache seeds and XCL_COHERENT_MB=2048 XCL_COHERENT_HEAPS=sparse:1024 XCL_HEAP_WINDOWS=1. I retained main’s internal-wait diagnostics when integrating the stack. The 2 GiB free-VRAM guard stopped each run around 30 s, before account input. I added 100 ms VRAM sampling for the second run after seeing a >1 GiB drop between baseline samples. Each had seven black captures, zero scope swap and zero reported storage failures. World entry remains unverified here.

Bazzite 44, NVIDIA 615.78.08, Proton Experimental 11.0-20261112, local vkd3d-proton 3.1.0 (4522cc1a8b1347f with dxil-spirv compatibility changes). Focused Windows release tests under Proton, including sparse GPU readback, passed 5/5 on main and 7/7 with the stack. No reported skips.

OpenAI Codex (GPT-6.2-Sol) integrated the PRs locally, ran the comparison and wrote this report.

<!-- greyfinch-sync:ivall/xcl:comment:7149829600 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2009#issuecomment-7149829600). Originally posted by [Filip722](https://github.com/Filip722) on 2026-11-25T01:40:47Z. --- On the **RTX 5060 Laptop GPU (8 GiB)**, the first sample with zero render-target pages showed **256 MiB of sparse pools on main and 3,584 MiB with #1993 + #2009** (197 and 3,527 MiB mapped). The cost was already visible before render-target streaming. | Requested size | Main `bf9eebd` | `5370f4b` integrated on the same main | |---|---|---| | 1,172 MiB | Coherent | Sparse VRAM | | 2,199 MiB | Write-watched fallback | Sparse VRAM | | 563 MiB | Coherent | Coherent | | 596 MiB | Write-watched fallback | Coherent | Both offline Series X runs used fresh copies of the same prefix/cache seeds and `XCL_COHERENT_MB=2048 XCL_COHERENT_HEAPS=sparse:1024 XCL_HEAP_WINDOWS=1`. I retained main’s internal-wait diagnostics when integrating the stack. The 2 GiB free-VRAM guard stopped each run around 30 s, before account input. I added 100 ms VRAM sampling for the second run after seeing a >1 GiB drop between baseline samples. Each had seven black captures, zero scope swap and zero reported storage failures. World entry remains unverified here. Bazzite 44, NVIDIA 615.78.08, Proton Experimental 11.0-20261112, local vkd3d-proton 3.1.0 (`4522cc1a8b1347f` with dxil-spirv compatibility changes). Focused Windows release tests under Proton, including sparse GPU readback, passed 5/5 on main and 7/7 with the stack. No reported skips. OpenAI Codex (GPT-6.2-Sol) integrated the PRs locally, ran the comparison and wrote this report.
DavidM1911 commented 2026-11-25 04:10:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T03:51:33Z.


Verification on RTX 3060 Ti (Windows 11): merge conflict with current main — needs a rebase before it can be tested.

<!-- greyfinch-sync:ivall/xcl:comment:7152306519 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2009#issuecomment-7152306519). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T03:51:33Z. --- Verification on RTX 3060 Ti (Windows 11): **merge conflict with current `main`** — needs a rebase before it can be tested.
raylitebull commented 2026-11-25 11:09:43 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-25T11:00:42Z.


Code review on 783ac15 (top commit in crates/xcl/src/hle/kernelx.rs, stacked on #1993):

  • sparse_heaps_min + parse_sparse_heaps (checked_mul(1 << 20) guarding usize::MAX overflow, tested in sparse_heaps_setting) cleanly routes opt-in XCL_COHERENT_HEAPS=sparse[:N] PAGE_GRAPHICS_* allocations into d3d12x::sparse::alloc before note_coherent_need.
  • Diff audited and CI workflow approved (45598152814).

Remaining before merge: Land #1993 first (or rebase once #1993 merges), Build and test green, and independent AMD + NVIDIA verification exercising the opt-in switch on 783ac15.

<!-- greyfinch-sync:ivall/xcl:comment:7160467236 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2009#issuecomment-7160467236). Originally posted by [raylitebull](https://github.com/raylitebull) on 2026-11-25T11:00:42Z. --- Code review on `783ac15` (top commit in `crates/xcl/src/hle/kernelx.rs`, stacked on `#1993`): - `sparse_heaps_min` + `parse_sparse_heaps` (`checked_mul(1 << 20)` guarding `usize::MAX` overflow, tested in `sparse_heaps_setting`) cleanly routes opt-in `XCL_COHERENT_HEAPS=sparse[:N]` `PAGE_GRAPHICS_*` allocations into `d3d12x::sparse::alloc` before `note_coherent_need`. - Diff audited and CI workflow approved (`45598152814`). **Remaining before merge:** Land `#1993` first (or rebase once `#1993` merges), `Build and test` green, and independent **AMD** + **NVIDIA** verification exercising the opt-in switch on `783ac15`.
raylitebull commented 2026-11-25 11:09:48 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-25T11:06:07Z.


CI \45598152814\ on \783ac15\ reported \1154 passed; 1 failed: the lone failure is pre-existing \hle::d3d12x::device_x::tests::pc_resource_desc_strips_uav_on_unsupported_formats_and_msaa\ (\device_x.rs:1376), unrelated to #2009\ (\sparse_heaps_setting\ passed).

<!-- greyfinch-sync:ivall/xcl:comment:7160588117 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2009#issuecomment-7160588117). Originally posted by [raylitebull](https://github.com/raylitebull) on 2026-11-25T11:06:07Z. --- CI \45598152814\ on \783ac15\ reported \1154 passed; 1 failed\: the lone failure is pre-existing \hle::d3d12x::device_x::tests::pc_resource_desc_strips_uav_on_unsupported_formats_and_msaa\ (\device_x.rs:1376\), unrelated to \#2009\ (\sparse_heaps_setting\ passed).
Ariorh1337 commented 2026-11-25 12:06:28 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Ariorh1337 on 2026-11-25T11:44:44Z.


@mgrein, @joeypercia thanks for running the switch on 12 GB cards. Both runs show what it costs there: the heaps fill video memory, and textures go to system memory early. I've added both to the description, along with where the switch does not pay (16 GB or less) and how it relates to #1329 and #2090. It stays off by default.

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

<!-- greyfinch-sync:ivall/xcl:comment:7161443552 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2009#issuecomment-7161443552). Originally posted by [Ariorh1337](https://github.com/Ariorh1337) on 2026-11-25T11:44:44Z. --- @mgrein, @joeypercia thanks for running the switch on 12 GB cards. Both runs show what it costs there: the heaps fill video memory, and textures go to system memory early. I've added both to the description, along with where the switch does not pay (16 GB or less) and how it relates to #1329 and #2090. It stays off by default. AI use: Claude Code (Claude Opus 5.5) drafted this.
STmihan commented 2026-11-25 14:09:58 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by STmihan on 2026-11-25T13:19:53Z.


#2009 on an 8 GB Ampere card: sparse:2048 makes the world compute passes 27–36× faster, but local VRAM then runs to 17–21 GB and the 5 s timeouts come back past ~16 GB.

RTX 3070 Ti 8 GB, driver 621.14, Ryzen 7 5800X, 64 GB RAM, Windows 11 26100, release. Retail 1.0.2.1, local tree on main f087b99 + #2009 + #1993 and other open PRs, XCL_DIRECT_DXIL=all XCL_HEAP_WINDOWS=1 XCL_PAGE_BUDGET_MB=3584, warm caches, XCL_GPU_PROFILE=1.

Per-call GPU time from XCL_GPU_PROFILE (median of the "longest" field over all windows), without and with XCL_COHERENT_HEAPS=sparse:2048 (moves the 2199 MB heap only):

| program | without | with sparse:2048 |
|

<!-- greyfinch-sync:ivall/xcl:comment:7163621368 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2009#issuecomment-7163621368). Originally posted by [STmihan](https://github.com/STmihan) on 2026-11-25T13:19:53Z. --- **#2009 on an 8 GB Ampere card: `sparse:2048` makes the world compute passes 27–36× faster, but local VRAM then runs to 17–21 GB and the 5 s timeouts come back past ~16 GB.** RTX 3070 Ti 8 GB, driver 621.14, Ryzen 7 5800X, 64 GB RAM, Windows 11 26100, release. Retail 1.0.2.1, local tree on `main` `f087b99` + #2009 + #1993 and other open PRs, `XCL_DIRECT_DXIL=all XCL_HEAP_WINDOWS=1 XCL_PAGE_BUDGET_MB=3584`, warm caches, `XCL_GPU_PROFILE=1`. Per-call GPU time from `XCL_GPU_PROFILE` (median of the "longest" field over all windows), without and with `XCL_COHERENT_HEAPS=sparse:2048` (moves the 2199 MB heap only): | program | without | with `sparse:2048` | |
Ariorh1337 commented 2026-11-25 17:07:30 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Ariorh1337 on 2026-11-25T16:51:18Z.


@STmihan thanks for the 8 GB run. Your comment ends at the table's header row, so if the per-program numbers got cut off when pasting, they would still be useful here.

What it adds: on a card that small, moving only the 2199 MB heap (sparse:2048) made the world's compute passes 27–36× faster, and then video memory ran to 17–21 GB and the 5 s timeouts came back past ~16 GB. With @mgrein's and @joeypercia's 12 GB runs, the picture is the same on all three: a large gain while the heaps fit, worse than without the switch once they don't. So the next step for this switch is a limit by the adapter's video-memory budget: move a heap only while it fits, instead of a fixed size in MB. I've added your run to the description.

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

<!-- greyfinch-sync:ivall/xcl:comment:7168632572 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2009#issuecomment-7168632572). Originally posted by [Ariorh1337](https://github.com/Ariorh1337) on 2026-11-25T16:51:18Z. --- @STmihan thanks for the 8 GB run. Your comment ends at the table's header row, so if the per-program numbers got cut off when pasting, they would still be useful here. What it adds: on a card that small, moving only the 2199 MB heap (`sparse:2048`) made the world's compute passes 27–36× faster, and then video memory ran to 17–21 GB and the 5 s timeouts came back past ~16 GB. With @mgrein's and @joeypercia's 12 GB runs, the picture is the same on all three: a large gain while the heaps fit, worse than without the switch once they don't. So the next step for this switch is a limit by the adapter's video-memory budget: move a heap only while it fits, instead of a fixed size in MB. I've added your run to the description. AI use: Claude Code (Claude Opus 5.5) drafted this.
STmihan commented 2026-11-25 17:07:32 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by STmihan on 2026-11-25T16:57:23Z.


@Ariorh1337 thanks, my earlier comment got cut off at the table when I posted it and I didn't notice. Here is the rest:

program without with sparse:2048
CS 6da1f38b06d6c735 (wave64 split) 715 ms 20 ms
CS 19a1c1ba0b567618 (wave64 split) 541 ms 20 ms
CS b78fa10b425b8e54 969 ms 487 ms
CS 24de2aef6c31d55e (wave32) 908 ms 643 ms
  • Without the switch, 3–4 small programs with no loops (e.g. 3429c04607b00016, 119 instructions, 57600 groups) take 0.3–1.7 s per call; their output buffers are in the coherent window (0x7…), which fits the ~0.1 GB/s store rate in #505.
  • With it, 0 bridge watchdog timeouts for the first ~4 min of the world, against 250–300 per run without.
  • The cost on 8 GB: local video memory reached 20.7 GB (DXGI local budget ~7.1 GB), commit 40.5 GB, and the 5 s timeouts returned (36) once local passed ~16 GB.
  • XCL_TEXTURE_PAGES_SYSTEM_MEMORY=1 alongside it kept local at ~5 GB, but menu draws went to ~40 ms each and the device hung (0x887a0006) at world entry with a DRED page fault at VA 0x0. One run.

Not tested: sparse:1024 (all four heaps) on this card, other drivers, AMD.

AI use: Claude Code ran the runs and wrote this.

<!-- greyfinch-sync:ivall/xcl:comment:7168783924 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2009#issuecomment-7168783924). Originally posted by [STmihan](https://github.com/STmihan) on 2026-11-25T16:57:23Z. --- @Ariorh1337 thanks, my earlier comment got cut off at the table when I posted it and I didn't notice. Here is the rest: | program | without | with `sparse:2048` | |---|---|---| | CS `6da1f38b06d6c735` (wave64 split) | 715 ms | 20 ms | | CS `19a1c1ba0b567618` (wave64 split) | 541 ms | 20 ms | | CS `b78fa10b425b8e54` | 969 ms | 487 ms | | CS `24de2aef6c31d55e` (wave32) | 908 ms | 643 ms | - Without the switch, 3–4 small programs with no loops (e.g. `3429c04607b00016`, 119 instructions, 57600 groups) take 0.3–1.7 s per call; their output buffers are in the coherent window (0x7…), which fits the ~0.1 GB/s store rate in #505. - With it, 0 bridge watchdog timeouts for the first ~4 min of the world, against 250–300 per run without. - The cost on 8 GB: local video memory reached 20.7 GB (DXGI local budget ~7.1 GB), commit 40.5 GB, and the 5 s timeouts returned (36) once local passed ~16 GB. - `XCL_TEXTURE_PAGES_SYSTEM_MEMORY=1` alongside it kept local at ~5 GB, but menu draws went to ~40 ms each and the device hung (`0x887a0006`) at world entry with a DRED page fault at VA 0x0. One run. **Not tested:** `sparse:1024` (all four heaps) on this card, other drivers, AMD. AI use: Claude Code ran the runs and wrote this.
lucsoft commented 2026-11-25 20:08:35 +00:00 (Migrated from github.com)

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


Test report: Linux / RADV, RX 7800 XT (RDNA3). Head 99a7e4f, in a stack, not alone. Two runs reached gameplay with no device removal.

  • Setup: Mesa 26.3.1 RADV, kernel 7.3.5, Wine 11.21 Staging, vkd3d-proton 3.1. XCL main 50a9fde plus about 20 other PRs, including #1993 at 69903fc on top of this one. The full list is in https://github.com/xcl-dev/xcl/issues/505#issuecomment-7170904791.
  • Env: XCL_COHERENT_HEAPS=sparse:1024 XCL_COHERENT_MB=1024 XCL_HEAP_WINDOWS=1.
  • What this PR did in the runs: the two big GPU heaps went to the sparse windows, as the log shows:
    kernelx: a GPU heap of 1172 MB in the sparse windows (XCL_COHERENT_HEAPS)
    kernelx: a GPU heap of 2199 MB in the sparse windows (XCL_COHERENT_HEAPS)
    
    The coherent window stayed at 679–715 of 1024 MB for the whole run.
  • Result: the warm-cache run went past 2 000 000 dispatches. It reached the prologue title card and the first movement prompt in 2500 s. There were no GPU-wait timeouts.
  • Cost: the write-watch scan over the windows is large. By 811 s it had taken 215 s, over 37 M dirty pages. The frame rate in the world is ~1 fps or below.
  • Not tested: without the rest of the stack, or on other hardware.

AI use: Claude Code (Claude Opus 5.5) ran the analysis and drafted this. The runs were real, on the hardware above.

<!-- greyfinch-sync:ivall/xcl:comment:7172334058 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2009#issuecomment-7172334058). Originally posted by [lucsoft](https://github.com/lucsoft) on 2026-11-25T19:27:58Z. --- **Test report: Linux / RADV, RX 7800 XT (RDNA3). Head `99a7e4f`, in a stack, not alone.** Two runs reached gameplay with no device removal. - **Setup:** Mesa 26.3.1 RADV, kernel 7.3.5, Wine 11.21 Staging, vkd3d-proton 3.1. XCL `main` `50a9fde` plus about 20 other PRs, including #1993 at `69903fc` on top of this one. The full list is in https://github.com/xcl-dev/xcl/issues/505#issuecomment-7170904791. - **Env:** `XCL_COHERENT_HEAPS=sparse:1024 XCL_COHERENT_MB=1024 XCL_HEAP_WINDOWS=1`. - **What this PR did in the runs:** the two big GPU heaps went to the sparse windows, as the log shows: ``` kernelx: a GPU heap of 1172 MB in the sparse windows (XCL_COHERENT_HEAPS) kernelx: a GPU heap of 2199 MB in the sparse windows (XCL_COHERENT_HEAPS) ``` The coherent window stayed at 679–715 of 1024 MB for the whole run. - **Result:** the warm-cache run went past 2 000 000 dispatches. It reached the prologue title card and the first movement prompt in 2500 s. There were no GPU-wait timeouts. - **Cost:** the write-watch scan over the windows is large. By 811 s it had taken 215 s, over 37 M dirty pages. The frame rate in the world is ~1 fps or below. - **Not tested:** without the rest of the stack, or on other hardware. AI use: Claude Code (Claude Opus 5.5) ran the analysis and drafted this. The runs were real, on the hardware above.
bmjask commented 2026-11-25 20:40:00 +00:00 (Migrated from github.com)

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

Review: COMMENTED


P1, inherited/extended from #1993: adopted fence hooks promise read coherence but call settle_readbacks_try and then expose completion even if bounded STATE locking fails. The title event can fire (and GetCompletedValue can return complete) before GPU->CPU sparse copyback lands. before_execute can hold STATE across sparse submission/setup, so the contention path is reachable. Do not signal/return visibility until relevant copies land, or use a deferred retry path; add a lock-contention fence-wait test. This stacked PR also lacks current Windows CI and an isolated switch-enabled title run for the #1993+#2009 stack.

<!-- greyfinch-sync:ivall/xcl:review:6064668685 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2009#pullrequestreview-6064668685). Originally posted by [bmjask](https://github.com/bmjask) on 2026-11-25T20:40:00Z. **Review:** COMMENTED --- P1, inherited/extended from #1993: adopted fence hooks promise read coherence but call settle_readbacks_try and then expose completion even if bounded STATE locking fails. The title event can fire (and GetCompletedValue can return complete) before GPU->CPU sparse copyback lands. before_execute can hold STATE across sparse submission/setup, so the contention path is reachable. Do not signal/return visibility until relevant copies land, or use a deferred retry path; add a lock-contention fence-wait test. This stacked PR also lacks current Windows CI and an isolated switch-enabled title run for the #1993+#2009 stack.
Ariorh1337 commented 2026-11-25 22:06:40 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Ariorh1337 on 2026-11-25T21:16:55Z.


@bmjask the fence hooks are fixed in #1993's 0a755f0 (details there). This PR is restacked on it as 2f49088.

About the other two points:

  • Windows CI: the CI workflow waits for a maintainer's approval on PRs from forks. I can't start it myself. The full suite on this machine is in the description: cargo test --workspace --no-fail-fast -- --test-threads=4 on 2f49088, 1419 passed, 4 failed, 46 ignored (the same 4 fuzz_validate_and_gpu_0..3 and SKIPPED tests as main 06055a7, 1409 passed).
  • A title run of main + #1993 + this PR with the switch on: done on 2f49088 alone (RTX 5090, release, XCL_COHERENT_HEAPS=sparse:1024 XCL_HEAP_WINDOWS=1, through the menus by controller):
    • both big heaps moved (a GPU heap of 1172 MB and of 2199 MB in the sparse windows); sparse pools at 5.4 GB, local video memory 17.7 GB;
    • the world's first burst ran (7861 dispatches after the first #101). There was no did not complete within, no has not reached fence and no copy-back line, and no crash or device removal in the 438 s watched;
    • presents stopped 8 s after the first #101, because the title then waited on cold driver builds of compute pipelines (68 of them with no driver blob, as main's HLSL is new to this machine's cache). So the run shows the switch's path working up to that point. It doesn't show the world running with it.

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

<!-- greyfinch-sync:ivall/xcl:comment:7174862753 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2009#issuecomment-7174862753). Originally posted by [Ariorh1337](https://github.com/Ariorh1337) on 2026-11-25T21:16:55Z. --- @bmjask the fence hooks are fixed in #1993's `0a755f0` (details there). This PR is restacked on it as `2f49088`. About the other two points: - **Windows CI:** the `CI` workflow waits for a maintainer's approval on PRs from forks. I can't start it myself. The full suite on this machine is in the description: `cargo test --workspace --no-fail-fast -- --test-threads=4` on `2f49088`, 1419 passed, 4 failed, 46 ignored (the same 4 `fuzz_validate_and_gpu_0..3` and SKIPPED tests as `main` `06055a7`, 1409 passed). - **A title run of `main` + #1993 + this PR with the switch on:** done on `2f49088` alone (RTX 5090, release, `XCL_COHERENT_HEAPS=sparse:1024 XCL_HEAP_WINDOWS=1`, through the menus by controller): - both big heaps moved (`a GPU heap of 1172 MB` and `of 2199 MB in the sparse windows`); sparse pools at 5.4 GB, local video memory 17.7 GB; - the world's first burst ran (7861 dispatches after the first `#101`). There was no `did not complete within`, no `has not reached fence` and no copy-back line, and no crash or device removal in the 438 s watched; - presents stopped 8 s after the first `#101`, because the title then waited on cold driver builds of compute pipelines (68 of them with no driver blob, as `main`'s HLSL is new to this machine's cache). So the run shows the switch's path working up to that point. It doesn't show the world running with it. AI use: Claude Code (Claude Opus 5.5) drafted this.
DavidM1911 commented 2026-11-26 01:05:43 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T00:49:43Z.


Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.

Thanks!

— Devin

<!-- greyfinch-sync:ivall/xcl:comment:7179153853 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2009#issuecomment-7179153853). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-26T00:49:43Z. --- Re-verification on RTX 3060 Ti (Windows 11), new head merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved. Thanks! — Devin
grahamster2 commented 2026-11-26 16:57:06 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by grahamster2 on 2026-11-26T16:57:06Z.


Data point from a 10 GB card, in case it helps decide the default.

RTX 3080 10 GB, 31 GB RAM, Windows 11. Austin's Build 15 plus a merge of current nvidia-dev, XCL_UMA_WINDOWS=16, XCL_HEAP_WINDOWS=1, XCL_COHERENT_MB=1024, Series S mode.

  • Without the switch: the two big heaps (1162 and 1277 MB) don't fit the 1 GB coherent window and fall back to plain memory outside every UMA window. Buffers placed there are never console buffers, so every two-pass mesh ExecuteIndirect is skipped ("arguments are not in a console buffer"). That was about 258k of 262k skipped draws in one run: the world stays black or gray.
  • With sparse:1024: those skips went to 0 and the world renders. The best run reached the first playable section at about 9.5 min with 0 skipped draws.
  • Cost: local video memory ran 1.5 to 4.3 GB over the budget Windows gives the process, growing over time. There was no E_OUTOFMEMORY and no device removal from it in 4 runs of 6 to 11 min. Runs ended on system commit at 33 to 35 GB, not on video memory.
  • Bigger coherent window instead: XCL_COHERENT_MB=5120 (so the heaps fit coherent) made the title fault with a null read at 112 s in the one run I tried.

One related thing for anyone trying this: heaps that end up outside the coherent window are still added to the stored coherent need (note_coherent_need runs before the placement decision in the default route). So the next run without XCL_COHERENT_MB pinned builds a window of several GB. Mine had a stored 4582 MB from an earlier run. Your sparse_first branch avoids this by returning before ASKED is counted. I have a local change that does the same for a fallback that places non-fitting heaps in the sparse windows automatically. I'm not posting it as a PR since this one is the place for that decision.

<!-- greyfinch-sync:ivall/xcl:comment:7198301488 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2009#issuecomment-7198301488). Originally posted by [grahamster2](https://github.com/grahamster2) on 2026-11-26T16:57:06Z. --- Data point from a 10 GB card, in case it helps decide the default. **RTX 3080 10 GB, 31 GB RAM, Windows 11.** Austin's Build 15 plus a merge of current nvidia-dev, `XCL_UMA_WINDOWS=16`, `XCL_HEAP_WINDOWS=1`, `XCL_COHERENT_MB=1024`, Series S mode. - **Without the switch:** the two big heaps (1162 and 1277 MB) don't fit the 1 GB coherent window and fall back to plain memory outside every UMA window. Buffers placed there are never console buffers, so every two-pass mesh ExecuteIndirect is skipped ("arguments are not in a console buffer"). That was about 258k of 262k skipped draws in one run: the world stays black or gray. - **With `sparse:1024`:** those skips went to 0 and the world renders. The best run reached the first playable section at about 9.5 min with 0 skipped draws. - **Cost:** local video memory ran 1.5 to 4.3 GB over the budget Windows gives the process, growing over time. There was no `E_OUTOFMEMORY` and no device removal from it in 4 runs of 6 to 11 min. Runs ended on system commit at 33 to 35 GB, not on video memory. - **Bigger coherent window instead:** `XCL_COHERENT_MB=5120` (so the heaps fit coherent) made the title fault with a null read at 112 s in the one run I tried. One related thing for anyone trying this: heaps that end up outside the coherent window are still added to the stored coherent need (`note_coherent_need` runs before the placement decision in the default route). So the next run without `XCL_COHERENT_MB` pinned builds a window of several GB. Mine had a stored 4582 MB from an earlier run. Your `sparse_first` branch avoids this by returning before `ASKED` is counted. I have a local change that does the same for a fallback that places non-fitting heaps in the sparse windows automatically. I'm not posting it as a PR since this one is the place for that decision.
afpruivo commented 2026-11-26 20:42:00 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by afpruivo on 2026-11-26T20:42:00Z.


RTX 3090 24 GB, retail 1.0.2.1 on nvidia-dev: with sparse:2048 the world ran at 3.03 fps against 1.37 fps without it (PresentMon, no profiler, one back-to-back pair). On a card with room for the moved heap, this is a data point for the default question next to @STmihan's 8 GB and @grahamster2's 10 GB runs above. Frames are GPU-bound in both arms.

Setup

  • RTX 3090 24 GB, driver 621.40, i5-13600K, 32 GB RAM (page file raised), Windows 11 26300, release.
  • nvidia-dev af2cecc4 (which has this switch as 4c14c537) + #2551, merged locally. xcl.exe in a 2 GiB shader-heap profile (#2590). XCL_DIRECT_DXIL=1, A pressed by script, compute pipelines precompiled.
  • sparse:2048 moves one heap here: a GPU heap of 2199 MB in the sparse windows.

Frame times (PresentMon 2.6, 60 s from 150 s into the run; the world had started at 105 s and 96 s; the two runs back to back):

default sparse:2048
frames 79 in 57.5 s (1.37 fps) 177 in 58.5 s (3.03 fps)
frame time, median / p90 721 / 836 ms 323 / 434 ms
GPU busy per frame, median 725 ms 322 ms
CPU wait per frame, median 0.4 ms 0.4 ms
device removals 0 0

Where the GPU time goes (XCL_GPU_PROFILE=1, 240 s runs; the profiler runs each queue's ops one at a time, so absolute times are inflated):

  • Default: CS b78fa10b425b8e54 (8x8 threads, split wave64, 160x90 groups; CS_DepthProcessingHBO per #1597) runs once a frame for 256 ms on average (200 calls, longest 481 ms). That is 51.2 s of the 181 s profiled in total, and in an in-world 2 s window 902 of 2,518 ms.
  • With sparse:2048: the same program 9.2 ms on average (186 calls, longest 22.7 ms); 67 s profiled in total. Other top programs dropped too, e.g. 24de2aef6c31d55e longest 461 → 19 ms, 680b8917303ae7df 432 → 84 ms.
  • Its RDNA2 code has two loops, both short and bounded (one counts up to a value in a constant buffer, the other runs 8 times), and 15 image_stores plus a buffer_store_format in the 8-pass loop. So it looks like the coherent-window store cost this PR describes, not a long-running loop.

Two things to know when trying it

  • sparse (every heap) got stuck before the world here: 1,104 frames in 240 s, the GPU almost idle and no world start. sparse:2048 reached the world in all three runs.
  • The first run after switching builds compute pipelines cold: 190 compute builds after the world start, with the GPU mostly idle and frames slower than without the switch. The memory layout changes, so the pipelines precompiled for the default layout did not match. The comparison above is from later runs, but both arms still built 211–232 compute pipelines after the world start.

Not tested: video memory and commit use with the switch (not logged in these runs; @STmihan's and @grahamster2's runs show the cost on smaller cards); more than one PresentMon pair; main + this PR alone; AMD; other values of N.

AI use: Claude Code (Claude Opus 5.5) ran the runs on my machine, read the PresentMon captures, the profiler logs and the program's disassembly, and drafted this. Checked by me before posting.

<!-- greyfinch-sync:ivall/xcl:comment:7202983669 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2009#issuecomment-7202983669). Originally posted by [afpruivo](https://github.com/afpruivo) on 2026-11-26T20:42:00Z. --- **RTX 3090 24 GB, retail 1.0.2.1 on `nvidia-dev`: with `sparse:2048` the world ran at 3.03 fps against 1.37 fps without it (PresentMon, no profiler, one back-to-back pair).** On a card with room for the moved heap, this is a data point for the default question next to @STmihan's 8 GB and @grahamster2's 10 GB runs above. Frames are GPU-bound in both arms. **Setup** - RTX 3090 24 GB, driver 621.40, i5-13600K, 32 GB RAM (page file raised), Windows 11 26300, release. - `nvidia-dev` `af2cecc4` (which has this switch as `4c14c537`) + #2551, merged locally. `xcl.exe` in a 2 GiB shader-heap profile (#2590). `XCL_DIRECT_DXIL=1`, A pressed by script, compute pipelines precompiled. - `sparse:2048` moves one heap here: `a GPU heap of 2199 MB in the sparse windows`. **Frame times** (PresentMon 2.6, 60 s from 150 s into the run; the world had started at 105 s and 96 s; the two runs back to back): | | default | `sparse:2048` | |---|---:|---:| | frames | 79 in 57.5 s (1.37 fps) | 177 in 58.5 s (3.03 fps) | | frame time, median / p90 | 721 / 836 ms | 323 / 434 ms | | GPU busy per frame, median | 725 ms | 322 ms | | CPU wait per frame, median | 0.4 ms | 0.4 ms | | device removals | 0 | 0 | **Where the GPU time goes** (`XCL_GPU_PROFILE=1`, 240 s runs; the profiler runs each queue's ops one at a time, so absolute times are inflated): - Default: `CS b78fa10b425b8e54` (8x8 threads, split wave64, 160x90 groups; `CS_DepthProcessingHBO` per #1597) runs once a frame for 256 ms on average (200 calls, longest 481 ms). That is 51.2 s of the 181 s profiled in total, and in an in-world 2 s window 902 of 2,518 ms. - With `sparse:2048`: the same program 9.2 ms on average (186 calls, longest 22.7 ms); 67 s profiled in total. Other top programs dropped too, e.g. `24de2aef6c31d55e` longest 461 → 19 ms, `680b8917303ae7df` 432 → 84 ms. - Its RDNA2 code has two loops, both short and bounded (one counts up to a value in a constant buffer, the other runs 8 times), and 15 `image_store`s plus a `buffer_store_format` in the 8-pass loop. So it looks like the coherent-window store cost this PR describes, not a long-running loop. **Two things to know when trying it** - **`sparse` (every heap) got stuck before the world here:** 1,104 frames in 240 s, the GPU almost idle and no world start. `sparse:2048` reached the world in all three runs. - **The first run after switching builds compute pipelines cold:** 190 compute builds after the world start, with the GPU mostly idle and frames slower than without the switch. The memory layout changes, so the pipelines precompiled for the default layout did not match. The comparison above is from later runs, but both arms still built 211–232 compute pipelines after the world start. **Not tested:** video memory and commit use with the switch (not logged in these runs; @STmihan's and @grahamster2's runs show the cost on smaller cards); more than one PresentMon pair; `main` + this PR alone; AMD; other values of N. **AI use:** Claude Code (Claude Opus 5.5) ran the runs on my machine, read the PresentMon captures, the profiler logs and the program's disassembly, and drafted this. Checked by me before posting.
Foniass commented 2026-12-01 07:11:38 +00:00 (Migrated from github.com)

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


Triage (#1607) – head 2f49088

Stacked on #1993; its own commit (kernelx.rs XCL_COHERENT_HEAPS=sparse[:N]) is on main as 4c14c537 with the same patch (identical patch-id). The base commit from #1993 is on main in an earlier form as cbba2d9d.
Recommendation: close (superseded by main commit 4c14c537).

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:7303754612 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2009#issuecomment-7303754612). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T07:11:38Z. --- **Triage (#1607)** – head 2f49088 Stacked on #1993; its own commit (kernelx.rs `XCL_COHERENT_HEAPS=sparse[:N]`) is on main as 4c14c537 with the same patch (identical patch-id). The base commit from #1993 is on main in an earlier form as cbba2d9d. Recommendation: close (superseded by main commit 4c14c537). AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
throny commented 2026-12-01 12:50:16 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-12-01T12:50:16Z.


Closing as superseded: this change is already on main (4c14c537). PR is stacked on #1993 (its other commit 0a755f0c is the readback commit, on main as cbba2d9d); its own commit 2f490889 has the same patch-id as main 4c14c537 (XCL_COHERENT_HEAPS=sparse:N)

Two independent checks found this: Foniass's close list on #1607 and ours against current main. If something here is still missing on main, say so and reopen it, or ask and I will.

AI use: Claude Code (Claude Opus 5.5); the per-PR comparison was done by Claude Sonnet 5.5 sub-agents.

<!-- greyfinch-sync:ivall/xcl:comment:7311718703 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2009#issuecomment-7311718703). Originally posted by [throny](https://github.com/throny) on 2026-12-01T12:50:16Z. --- Closing as superseded: this change is already on `main` (4c14c537). PR is stacked on #1993 (its other commit 0a755f0c is the readback commit, on main as cbba2d9d); its own commit 2f490889 has the same patch-id as main 4c14c537 (XCL_COHERENT_HEAPS=sparse:N) Two independent checks found this: Foniass's close list on #1607 and ours against current `main`. If something here is still missing on `main`, say so and reopen it, or ask and I will. AI use: Claude Code (Claude Opus 5.5); the per-PR comparison was done by Claude Sonnet 5.5 sub-agents.

Pull request closed

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!1999
No description provided.