kernelx: XCL_COHERENT_HEAPS=sparse-wc puts write-combined GPU heaps in video memory #3619

Open
Royalflamejlh wants to merge 1 commit from upstream-pr/3619 into main
Royalflamejlh commented 2026-12-01 22:11:35 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-01T22:11:35Z.


XCL_COHERENT_HEAPS=sparse[:N] moves GPU heaps out of the coherent window by size alone. In the sparse windows the CPU's writes are uploaded before each submission, but what shaders write stays in video memory (only memory operations are copied back), so a heap the CPU reads back would show it stale bytes. This adds sparse-wc[:N]: only GPU heaps committed with PAGE_WRITECOMBINE (of at least N MB) go to the sparse windows. Write-combined memory is written by the CPU and not read by it (its reads are uncached on the console; results a title reads come back in PAGE_GRAPHICS_COHERENT memory with cached pages), so what shaders write there can stay on the card. Off by default.

A retail title commits one write-combined GPU heap of 1277 MB (protection 0x2404) beside three GPU-coherent ones. Its shaders read it over the bus: most of the coherent window's reads in a profiling run. The CPU writes about 0.5 MB/s of it after loading.

What is in it

  • crates/xcl/src/hle/kernelx.rs: sparse-wc[:N] in the XCL_COHERENT_HEAPS parse, and the GPU-heap route sends a write-combined heap to sparse_reserve under it; tests of the parse and of the route (write_combined_heaps_alone_go_to_the_sparse_windows_with_sparse_wc).

Tested

  • RTX 4060 Ti 16 GB, NVIDIA 615.71.09, AMD Ryzen 9 9950X3D, Linux, Wine 11.21 Staging, vkd3d-proton master with local patches, Rust 1.98.0, x86_64-pc-windows-gnu, release. Head ede473ab2 (the two comments that described only sparse[:N] updated; no code change since c8902b4e) on main f07e426d.
  • cargo test -p xcl --release --lib -- kernelx:: gpu::uma under Wine (CPU Vulkan): 87 passed, 0 failed, 1 ignored.
  • In the retail title, on a tree that carries this commit beside other unmerged pull requests (16 memory windows, Series S profile), 600 s runs of the same build with the switch on (and XCL_COHERENT_MB=3027, the window's stored need less this heap) and off, 2 each: on, both ran the full 600 s, 2.14 and 2.78 frames a second past their first 1,490 frames; off, one ended on a device removal at 371 s (1,564 frames) and one on an access violation in the title at 261 s (1,489 frames). Two pairs: the difference in how they ended is not settled, and shader builds in the first minutes blur the frame rates.

Regression run
RTX 5070 Ti 16 GB (driver 621.24), Ryzen 7 9800X3D, Windows 11 Pro 26300, release builds by scripts/smoke.ps1, the same retail title for 60 s each.

main:

xcl-smoke v1
commit: 1c8b551475e1e7bfe48f94448492a4c3544a2e0f
gpu: NVIDIA GeForce RTX 5070 Ti
title: 5330474d
seconds: 60
exit: 0x0
frames shown: 1620 (PresentX 1621)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 15476 MB

this PR's head:

xcl-smoke v1
commit: ede473ab207b34a348dce798c66eca5744268ae7
gpu: NVIDIA GeForce RTX 5070 Ti
title: 5330474d
seconds: 60
exit: 0x0
frames shown: 1656 (PresentX 1656)
presents per 2 s (last 3): 60 61 60
device removals: 0
crashes: 0
peak commit: 16386 MB

Not tested

  • Native Windows, AMD, the whole suite; whether the title reads this heap back on the CPU (inferred from its protection, not measured); cards under 16 GB (the heap takes its size in video memory).

AI use

  • Claude Code (Claude Opus 5.5): found the heap with XCL's memory counters, wrote the change and its tests, ran the title runs and wrote this description.
<!-- greyfinch-sync:ivall/xcl:issue:5595506316 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3619). Originally posted by [Royalflamejlh](https://github.com/Royalflamejlh) on 2026-12-01T22:11:35Z. --- `XCL_COHERENT_HEAPS=sparse[:N]` moves GPU heaps out of the coherent window by size alone. In the sparse windows the CPU's writes are uploaded before each submission, but what shaders write stays in video memory (only memory operations are copied back), so a heap the CPU reads back would show it stale bytes. This adds `sparse-wc[:N]`: only GPU heaps committed with `PAGE_WRITECOMBINE` (of at least N MB) go to the sparse windows. Write-combined memory is written by the CPU and not read by it (its reads are uncached on the console; results a title reads come back in `PAGE_GRAPHICS_COHERENT` memory with cached pages), so what shaders write there can stay on the card. Off by default. A retail title commits one write-combined GPU heap of 1277 MB (protection `0x2404`) beside three GPU-coherent ones. Its shaders read it over the bus: most of the coherent window's reads in a profiling run. The CPU writes about 0.5 MB/s of it after loading. **What is in it** - `crates/xcl/src/hle/kernelx.rs`: `sparse-wc[:N]` in the `XCL_COHERENT_HEAPS` parse, and the GPU-heap route sends a write-combined heap to `sparse_reserve` under it; tests of the parse and of the route (`write_combined_heaps_alone_go_to_the_sparse_windows_with_sparse_wc`). **Tested** - RTX 4060 Ti 16 GB, NVIDIA 615.71.09, AMD Ryzen 9 9950X3D, Linux, Wine 11.21 Staging, vkd3d-proton `master` with local patches, Rust 1.98.0, `x86_64-pc-windows-gnu`, release. Head `ede473ab2` (the two comments that described only `sparse[:N]` updated; no code change since `c8902b4e`) on `main` `f07e426d`. - `cargo test -p xcl --release --lib -- kernelx:: gpu::uma` under Wine (CPU Vulkan): 87 passed, 0 failed, 1 ignored. - In the retail title, on a tree that carries this commit beside other unmerged pull requests (16 memory windows, Series S profile), 600 s runs of the same build with the switch on (and `XCL_COHERENT_MB=3027`, the window's stored need less this heap) and off, 2 each: on, both ran the full 600 s, 2.14 and 2.78 frames a second past their first 1,490 frames; off, one ended on a device removal at 371 s (1,564 frames) and one on an access violation in the title at 261 s (1,489 frames). Two pairs: the difference in how they ended is not settled, and shader builds in the first minutes blur the frame rates. **Regression run** RTX 5070 Ti 16 GB (driver 621.24), Ryzen 7 9800X3D, Windows 11 Pro 26300, release builds by `scripts/smoke.ps1`, the same retail title for 60 s each. `main`: ``` xcl-smoke v1 commit: 1c8b551475e1e7bfe48f94448492a4c3544a2e0f gpu: NVIDIA GeForce RTX 5070 Ti title: 5330474d seconds: 60 exit: 0x0 frames shown: 1620 (PresentX 1621) presents per 2 s (last 3): 61 60 60 device removals: 0 crashes: 0 peak commit: 15476 MB ``` this PR's head: ``` xcl-smoke v1 commit: ede473ab207b34a348dce798c66eca5744268ae7 gpu: NVIDIA GeForce RTX 5070 Ti title: 5330474d seconds: 60 exit: 0x0 frames shown: 1656 (PresentX 1656) presents per 2 s (last 3): 60 61 60 device removals: 0 crashes: 0 peak commit: 16386 MB ``` **Not tested** - Native Windows, AMD, the whole suite; whether the title reads this heap back on the CPU (inferred from its protection, not measured); cards under 16 GB (the heap takes its size in video memory). **AI use** - Claude Code (Claude Opus 5.5): found the heap with XCL's memory counters, wrote the change and its tests, ran the title runs and wrote this description.
Foniass commented 2026-12-01 22:14:11 +00:00 (Migrated from github.com)

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


Review (head c8902b4e, diff read, not a merge-check; checks red):

No problems found in the diff. Checked the sparse-wc[:N] parse and its round trip through heaps_route (a separate uma_coherent_sparse-wc*.txt size file), the heap_in_sparse predicate at the only call site of the old sparse_heaps_min (kernelx.rs ~1016, ~1079), which still sees the title's raw protection so the PAGE_WRITECOMBINE (0x400) test works, that sparse and sparse:N behave as before, and that the default path is untouched when XCL_COHERENT_HEAPS is unset. The comments at ~1011 and ~1089-1091 still describe only sparse[:N]. The red check is PR description: Regression run has no xcl-smoke blocks yet, and the tests ran under Wine only.

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

<!-- greyfinch-sync:ivall/xcl:comment:7327469575 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3619#issuecomment-7327469575). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T22:14:11Z. --- Review (head c8902b4e, diff read, not a merge-check; checks red): No problems found in the diff. Checked the `sparse-wc[:N]` parse and its round trip through `heaps_route` (a separate `uma_coherent_sparse-wc*.txt` size file), the `heap_in_sparse` predicate at the only call site of the old `sparse_heaps_min` (`kernelx.rs` ~1016, ~1079), which still sees the title's raw protection so the `PAGE_WRITECOMBINE` (0x400) test works, that `sparse` and `sparse:N` behave as before, and that the default path is untouched when `XCL_COHERENT_HEAPS` is unset. The comments at ~1011 and ~1089-1091 still describe only `sparse[:N]`. The red check is `PR description`: **Regression run** has no `xcl-smoke` blocks yet, and the tests ran under Wine only. AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Royalflamejlh commented 2026-12-01 22:28:54 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-01T22:28:54Z.


@Foniass thanks for the read. The two comments now mention sparse-wc (head ede473ab2, comments only). The smoke pair is still owed: no Windows machine of ours has answered today.

AI use: Claude Code (Claude Opus 5.5).

<!-- greyfinch-sync:ivall/xcl:comment:7327916227 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3619#issuecomment-7327916227). Originally posted by [Royalflamejlh](https://github.com/Royalflamejlh) on 2026-12-01T22:28:54Z. --- @Foniass thanks for the read. The two comments now mention `sparse-wc` (head `ede473ab2`, comments only). The smoke pair is still owed: no Windows machine of ours has answered today. AI use: Claude Code (Claude Opus 5.5).
Foniass commented 2026-12-01 22:30:40 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T22:30:40Z.


Follow-up review (head ede473ab, since c8902b4e, diff read, not a merge-check; checks red):

  • Stale comments: fixed. The route comment (kernelx.rs ~1012) and the heaps_route doc (~1091) now describe sparse-wc[:N].

New: none; only those comments changed since c8902b4e. The xcl-smoke blocks are still owed.

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

<!-- greyfinch-sync:ivall/xcl:comment:7327957004 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3619#issuecomment-7327957004). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T22:30:40Z. --- Follow-up review (head ede473ab, since c8902b4e, diff read, not a merge-check; checks red): - **Stale comments:** fixed. The route comment (`kernelx.rs` ~1012) and the `heaps_route` doc (~1091) now describe `sparse-wc[:N]`. New: none; only those comments changed since `c8902b4e`. The `xcl-smoke` blocks are still owed. AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
throny commented 2026-12-02 04:13:22 +00:00 (Migrated from github.com)

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


merge-check claim
head: ede473ab20

<!-- greyfinch-sync:ivall/xcl:comment:7334685506 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3619#issuecomment-7334685506). Originally posted by [throny](https://github.com/throny) on 2026-12-02T04:13:22Z. --- merge-check claim head: ede473ab207b34a348dce798c66eca5744268ae7
throny commented 2026-12-02 04:13:44 +00:00 (Migrated from github.com)

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


Queued an in-world A/B of this on an RTX 4080 16 GB: current main + this head ede473ab, same build with XCL_COHERENT_HEAPS default vs =sparse-wc, 900 s each with XCL_RESIDENCY_PRIORITY=1 and XCL_GPU_PROFILE=1 (the write-combined heaps in the coherent window are a lead for our per-pass cost on #505). Also doing a merge check. Numbers here when done.

AI use: Claude Code (Claude Opus 5.5).

<!-- greyfinch-sync:ivall/xcl:comment:7334692229 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3619#issuecomment-7334692229). Originally posted by [throny](https://github.com/throny) on 2026-12-02T04:13:44Z. --- Queued an in-world A/B of this on an RTX 4080 16 GB: current `main` + this head `ede473ab`, same build with `XCL_COHERENT_HEAPS` default vs `=sparse-wc`, 900 s each with `XCL_RESIDENCY_PRIORITY=1` and `XCL_GPU_PROFILE=1` (the write-combined heaps in the coherent window are a lead for our per-pass cost on #505). Also doing a merge check. Numbers here when done. AI use: Claude Code (Claude Opus 5.5).
throny commented 2026-12-02 04:33:53 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-12-02T04:33:53Z.


First pair, RTX 4080 16 GB (621.40), main 1c8b5514 + this head (plus our local input-timing patch), same build, same save and inputs, XCL_RESIDENCY_PRIORITY=1:

run XCL_COHERENT_HEAPS result video memory peak / budget
418 default 900 s, 3.02 presents/s, no removal 18.9 / 15.1 GB
419 sparse-wc device removed (0x887a0006, hung) 101 s after the first world frame 16.1 / 15.1 GB

With sparse-wc the coherent window shrinks to 512 MB and non-local video memory drops from 4.9 to 1.7 GB, so the heaps do move to video memory as intended; but the run hung early in the world. That is one run; hangs around 100–190 s have also shown up here in other runs that got closer to the budget, so it may be the same in-world hang rather than this change. I'll repeat it once after the merge-check suites and add the result.

AI use: Claude Code (Claude Opus 5.5).

<!-- greyfinch-sync:ivall/xcl:comment:7335034777 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3619#issuecomment-7335034777). Originally posted by [throny](https://github.com/throny) on 2026-12-02T04:33:53Z. --- First pair, RTX 4080 16 GB (621.40), `main` `1c8b5514` + this head (plus our local input-timing patch), same build, same save and inputs, `XCL_RESIDENCY_PRIORITY=1`: | run | `XCL_COHERENT_HEAPS` | result | video memory peak / budget | |---|---|---|---| | 418 | default | 900 s, 3.02 presents/s, no removal | 18.9 / 15.1 GB | | 419 | `sparse-wc` | **device removed (0x887a0006, hung) 101 s after the first world frame** | 16.1 / 15.1 GB | With `sparse-wc` the coherent window shrinks to 512 MB and non-local video memory drops from 4.9 to 1.7 GB, so the heaps do move to video memory as intended; but the run hung early in the world. That is one run; hangs around 100–190 s have also shown up here in other runs that got closer to the budget, so it may be the same in-world hang rather than this change. I'll repeat it once after the merge-check suites and add the result. AI use: Claude Code (Claude Opus 5.5).
Royalflamejlh commented 2026-12-02 04:39:45 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-02T04:39:45Z.


Thanks for running it. Our numbers so far are from Linux only (RTX 4060 Ti 16 GB, Wine + vkd3d-proton, a development tree with this change): 2 of 2 runs with sparse-wc went their full 600 s, 2 of 2 without it ended early, so a Windows hang is new information. Running the same A/B in the world on an RTX 5070 Ti 16 GB now (main + this head, 600 s, 2 runs each way); results here when done.

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

<!-- greyfinch-sync:ivall/xcl:comment:7335134159 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3619#issuecomment-7335134159). Originally posted by [Royalflamejlh](https://github.com/Royalflamejlh) on 2026-12-02T04:39:45Z. --- Thanks for running it. Our numbers so far are from Linux only (RTX 4060 Ti 16 GB, Wine + vkd3d-proton, a development tree with this change): 2 of 2 runs with `sparse-wc` went their full 600 s, 2 of 2 without it ended early, so a Windows hang is new information. Running the same A/B in the world on an RTX 5070 Ti 16 GB now (`main` + this head, 600 s, 2 runs each way); results here when done. AI use: Claude Code (Claude Opus 5.5) wrote this comment.
Royalflamejlh commented 2026-12-02 05:09:07 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-02T05:09:07Z.


Confirmed on Windows: with sparse-wc the device is removed early in the world, 2 of 2 runs; without it the run goes its length. RTX 5070 Ti 16 GB (621.24), Ryzen 7 9800X3D, Windows 11 26300, main 1c8b5514 + this head ede473ab, release, 600 s, XCL_SKIP_BINK=1:

run XCL_COHERENT_HEAPS frames end
1 default 518 cold pipeline cache: presents steady only from 680 s, not counted
2 default 17,888 full length (last present 646 s)
3 sparse-wc 1,633 device removed (0x887a0006, hung) at 141 s
4 sparse-wc 1,548 device removed (0x887a0006) at 76 s; system commit 50,046 of 50,661 MB at the removal; DRED had no breadcrumbs

So it is this change, not the in-world hang seen elsewhere, and on Windows the switch is not usable as it is. Our earlier result (2 of 2 runs better with it) was under Wine + vkd3d-proton only. I am moving this back to draft until the cause is found; the commit figure is the first lead (a guess: the heap's pages in video memory plus the CPU copy the sparse windows keep).

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

<!-- greyfinch-sync:ivall/xcl:comment:7335633727 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3619#issuecomment-7335633727). Originally posted by [Royalflamejlh](https://github.com/Royalflamejlh) on 2026-12-02T05:09:07Z. --- Confirmed on Windows: with `sparse-wc` the device is removed early in the world, 2 of 2 runs; without it the run goes its length. RTX 5070 Ti 16 GB (621.24), Ryzen 7 9800X3D, Windows 11 26300, `main` `1c8b5514` + this head `ede473ab`, release, 600 s, `XCL_SKIP_BINK=1`: | run | `XCL_COHERENT_HEAPS` | frames | end | |---|---|---|---| | 1 | default | 518 | cold pipeline cache: presents steady only from 680 s, not counted | | 2 | default | 17,888 | full length (last present 646 s) | | 3 | `sparse-wc` | 1,633 | device removed (0x887a0006, hung) at 141 s | | 4 | `sparse-wc` | 1,548 | device removed (0x887a0006) at 76 s; system commit 50,046 of 50,661 MB at the removal; DRED had no breadcrumbs | So it is this change, not the in-world hang seen elsewhere, and on Windows the switch is not usable as it is. Our earlier result (2 of 2 runs better with it) was under Wine + vkd3d-proton only. I am moving this back to draft until the cause is found; the commit figure is the first lead (a guess: the heap's pages in video memory plus the CPU copy the sparse windows keep). AI use: Claude Code (Claude Opus 5.5) ran the runs and wrote this comment.
throny commented 2026-12-02 05:26:11 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-12-02T05:26:11Z.


Follow-up: two more runs with sparse-wc, each started without a stored window size (uma_coherent_sparse-wc.txt moved aside; with the stored size, runs crashed at 37 s before the world — that is the mixed-range/window-size problem in #3568, not this PR): both ran 900 s with no removal, but at 1.18 and 1.41 presents/s against 3.02 without the switch (run 418), and video memory peaked at 19.3 GB (default: 18.9 GB). So on this RTX 4080 with XCL_UMA_DRIVER=mixed:1536:1792 and residency priority it is slower, not faster; the early hang in run 419 did not repeat. It may behave differently without mixed or on a card with more headroom.

AI use: Claude Code (Claude Opus 5.5).

<!-- greyfinch-sync:ivall/xcl:comment:7335931579 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3619#issuecomment-7335931579). Originally posted by [throny](https://github.com/throny) on 2026-12-02T05:26:11Z. --- Follow-up: two more runs with `sparse-wc`, each started without a stored window size (`uma_coherent_sparse-wc.txt` moved aside; with the stored size, runs crashed at 37 s before the world — that is the `mixed`-range/window-size problem in #3568, not this PR): both ran 900 s with no removal, but at **1.18 and 1.41 presents/s** against 3.02 without the switch (run 418), and video memory peaked at 19.3 GB (default: 18.9 GB). So on this RTX 4080 with `XCL_UMA_DRIVER=mixed:1536:1792` and residency priority it is slower, not faster; the early hang in run 419 did not repeat. It may behave differently without `mixed` or on a card with more headroom. AI use: Claude Code (Claude Opus 5.5).
throny commented 2026-12-02 05:26:13 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-12-02T05:26:13Z.


merge-check
base: 1c8b55147 (main)
head: ede473ab20
merge: clean trial merge into main 1c8b55147 (merge_trial_suite.sh 3619).
build: cargo build --workspace passed.
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 on the merged tree: 2910 passed, 0 failed, 51 ignored; 25 SKIPPED notices (no wave64, no heap windows, driver cache); 0 binaries ended abnormally. The new test write_combined_heaps_alone_go_to_the_sparse_windows_with_sparse_wc and the extended sparse_heaps_setting / heaps_route tests pass.
review: diff read (one file, hle/kernelx.rs, +47/-18). The sparse-wc[:N] parse, heap_in_sparse and the route name for the coherent window's size file are correct; the default path (XCL_COHERENT_HEAPS unset) is unchanged; the earlier reviews' stale-comment point is fixed at this head. The tests cover only the parse and the predicate, not an allocation. It is an opt-in switch, so no default behaviour changes. Problem found by our run below: the switch is not safe in the world on this card.
performance: in the world on an RTX 4080 (XCL_UMA_DRIVER=mixed:1536:1792, XCL_RESIDENCY_PRIORITY=1) the switch was slower: 1.18 and 1.41 presents/s vs 3.02 without it; one earlier run lost the device at 101 s, two later runs did not (see the comments above). Default path unchanged.
verdict: safe to merge (opt-in, default unchanged; not a recommendation to turn it on with the mixed driver)
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300; Claude Code, Claude Sonnet 5.5 ran the build and the suite and read the diff; Claude Opus 5.5 checked this report

<!-- greyfinch-sync:ivall/xcl:comment:7335931993 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3619#issuecomment-7335931993). Originally posted by [throny](https://github.com/throny) on 2026-12-02T05:26:13Z. --- merge-check base: 1c8b55147 (main) head: ede473ab207b34a348dce798c66eca5744268ae7 merge: clean trial merge into main 1c8b55147 (`merge_trial_suite.sh 3619`). build: `cargo build --workspace` passed. tests: `cargo test --workspace --no-fail-fast -- --test-threads=4` on the merged tree: 2910 passed, 0 failed, 51 ignored; 25 SKIPPED notices (no wave64, no heap windows, driver cache); 0 binaries ended abnormally. The new test `write_combined_heaps_alone_go_to_the_sparse_windows_with_sparse_wc` and the extended `sparse_heaps_setting` / `heaps_route` tests pass. review: diff read (one file, `hle/kernelx.rs`, +47/-18). The `sparse-wc[:N]` parse, `heap_in_sparse` and the route name for the coherent window's size file are correct; the default path (`XCL_COHERENT_HEAPS` unset) is unchanged; the earlier reviews' stale-comment point is fixed at this head. The tests cover only the parse and the predicate, not an allocation. It is an opt-in switch, so no default behaviour changes. Problem found by our run below: the switch is not safe in the world on this card. performance: in the world on an RTX 4080 (XCL_UMA_DRIVER=mixed:1536:1792, XCL_RESIDENCY_PRIORITY=1) the switch was slower: 1.18 and 1.41 presents/s vs 3.02 without it; one earlier run lost the device at 101 s, two later runs did not (see the comments above). Default path unchanged. verdict: safe to merge (opt-in, default unchanged; not a recommendation to turn it on with the mixed driver) hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300; Claude Code, Claude Sonnet 5.5 ran the build and the suite and read the diff; Claude Opus 5.5 checked this report
CharlyRien commented 2026-12-02 09:58:42 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by CharlyRien on 2026-12-02T09:58:42Z.


Static review (head ede473ab, diff and the code around it read on main 1c8b5514; nothing built or run for this comment). The parse, the route and the per-setting size file look right to me as well; below are only points that may bear on the Windows removals above.

  1. What sparse-wc costs in commit. A heap in the sparse windows keeps the title's own pages committed as the CPU view (sparse.rs: the CPU writes are found by write-watch and uploaded before the next ExecuteCommandLists), and its committed tiles are also mapped onto video-memory heaps. So the write-combined heap is paid twice, plus the staging ring, which fits the 50,046 of 50,661 MB commit at the removal. How big that heap is depends on the console profile: the retail title asked for 2,199 MB of write-combined GPU memory (protection 0x2404) in the Series X profile on our machine, against the 1,277 MB quoted for Series S. That size is the title's request, logged on our tree (main 493dbd3d + #3528 + #3517 + local commits), not something XCL chooses. Comparing commit at the removal with the default path at the same moment would show whether this is the cause.
  2. First run of the setting. Without a uma_coherent_sparse-wc*.txt, coherent_hint_for plans the coherent window at RUNTIME_COMMITTED_CAP (512 MB). The other GPU heaps (about 3 GB in Series S) then do not fit and fall back to ordinary memory until the next run. That may account for some of the difference between runs with and without a stored size in the comments above (a guess, not measured). Seeding the size from the all file minus the write-combined heaps, or noting XCL_COHERENT_MB in the description, would make first runs comparable.
  3. 64-byte upload granularity (existing behaviour, not this PR's). changed_chunks sends whole 64-byte chunks: if the CPU writes into a chunk where the GPU has written other bytes, the upload overwrites them. This heap is the one the title keeps writing from the CPU, so the overlap is more likely here than for the other heaps. If the GPU wrote counters or indirect arguments in those chunks, that could hang the GPU (a guess). A count of chunks uploaded over bytes the GPU wrote since the last upload would rule it in or out.
  4. CPU reads of write-combined memory. The description assumes the CPU does not read this heap back. Waits (wait_memory) read the CPU view; a GPU write into these tiles reaches that view only through the readback path. A counter of waits or reads that land in a write-combined range would confirm that the assumption holds.
  5. Tests: sparse-wc:0 → sparse-wc route is not covered (the sparse:0 → sparse case is); easy to add.

AI use: Claude Code (Claude Opus 5.5) read the diff and the code and wrote this review; checked and posted at my request.

<!-- greyfinch-sync:ivall/xcl:comment:7341771961 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3619#issuecomment-7341771961). Originally posted by [CharlyRien](https://github.com/CharlyRien) on 2026-12-02T09:58:42Z. --- Static review (head `ede473ab`, diff and the code around it read on `main` `1c8b5514`; nothing built or run for this comment). The parse, the route and the per-setting size file look right to me as well; below are only points that may bear on the Windows removals above. 1. **What `sparse-wc` costs in commit.** A heap in the sparse windows keeps the title's own pages committed as the CPU view (`sparse.rs`: the CPU writes are found by write-watch and uploaded before the next `ExecuteCommandLists`), and its committed tiles are also mapped onto video-memory heaps. So the write-combined heap is paid twice, plus the staging ring, which fits the 50,046 of 50,661 MB commit at the removal. How big that heap is depends on the console profile: the retail title asked for **2,199 MB** of write-combined GPU memory (protection `0x2404`) in the Series X profile on our machine, against the 1,277 MB quoted for Series S. That size is the title's request, logged on our tree (`main` `493dbd3d` + #3528 + #3517 + local commits), not something XCL chooses. Comparing commit at the removal with the default path at the same moment would show whether this is the cause. 2. **First run of the setting.** Without a `uma_coherent_sparse-wc*.txt`, `coherent_hint_for` plans the coherent window at `RUNTIME_COMMITTED_CAP` (512 MB). The other GPU heaps (about 3 GB in Series S) then do not fit and fall back to ordinary memory until the next run. That may account for some of the difference between runs with and without a stored size in the comments above (a guess, not measured). Seeding the size from the `all` file minus the write-combined heaps, or noting `XCL_COHERENT_MB` in the description, would make first runs comparable. 3. **64-byte upload granularity (existing behaviour, not this PR's).** `changed_chunks` sends whole 64-byte chunks: if the CPU writes into a chunk where the GPU has written other bytes, the upload overwrites them. This heap is the one the title keeps writing from the CPU, so the overlap is more likely here than for the other heaps. If the GPU wrote counters or indirect arguments in those chunks, that could hang the GPU (a guess). A count of chunks uploaded over bytes the GPU wrote since the last upload would rule it in or out. 4. **CPU reads of write-combined memory.** The description assumes the CPU does not read this heap back. Waits (`wait_memory`) read the CPU view; a GPU write into these tiles reaches that view only through the readback path. A counter of waits or reads that land in a write-combined range would confirm that the assumption holds. 5. Tests: `sparse-wc:0` → `sparse-wc` route is not covered (the `sparse:0` → `sparse` case is); easy to add. AI use: Claude Code (Claude Opus 5.5) read the diff and the code and wrote this review; checked and posted at my request.
Royalflamejlh commented 2026-12-02 10:11:32 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-02T10:11:32Z.


Thanks, these line up with what the runs showed.

  1. The double cost fits the removals: 50,046 of 50,661 MB commit at the 76 s removal. The heap stays committed as the CPU view and its tiles are also mapped onto video memory, so on Windows this switch as it is adds the heap's size to commit. That is the first thing to fix before this can leave draft.
  2. Agreed; the A/B above had a stored size on both sides only for the default route. I will seed the sparse-wc size from the all file minus the write-combined heaps.
    3 and 4 I will measure rather than guess: a count of 64-byte chunks uploaded over bytes the GPU wrote since the last upload, and of waits or reads landing in a write-combined range.
  3. Added at bec54b80: sparse-wc:0 routes as sparse-wc.

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

<!-- greyfinch-sync:ivall/xcl:comment:7342102486 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3619#issuecomment-7342102486). Originally posted by [Royalflamejlh](https://github.com/Royalflamejlh) on 2026-12-02T10:11:32Z. --- Thanks, these line up with what the runs showed. 1. The double cost fits the removals: 50,046 of 50,661 MB commit at the 76 s removal. The heap stays committed as the CPU view and its tiles are also mapped onto video memory, so on Windows this switch as it is adds the heap's size to commit. That is the first thing to fix before this can leave draft. 2. Agreed; the A/B above had a stored size on both sides only for the default route. I will seed the `sparse-wc` size from the `all` file minus the write-combined heaps. 3 and 4 I will measure rather than guess: a count of 64-byte chunks uploaded over bytes the GPU wrote since the last upload, and of waits or reads landing in a write-combined range. 5. Added at `bec54b80`: `sparse-wc:0` routes as `sparse-wc`. AI use: Claude Code (Claude Opus 5.5) added the test and wrote this reply.
Foniass commented 2026-12-02 10:12:56 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T10:12:56Z.


Follow-up review (head bec54b80, since ede473ab, diff read, not a merge-check; draft, checks red):

  • Earlier points: none open in the code; this push (a rebase) only adds a test assertion that sparse-wc:0 routes like sparse-wc.

New: none.

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

<!-- greyfinch-sync:ivall/xcl:comment:7342136455 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3619#issuecomment-7342136455). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-02T10:12:56Z. --- Follow-up review (head bec54b80, since ede473ab, diff read, not a merge-check; draft, checks red): - **Earlier points:** none open in the code; this push (a rebase) only adds a test assertion that `sparse-wc:0` routes like `sparse-wc`. New: none. AI review: Claude Code (Claude Opus 5.5), 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/3619:upstream-pr/3619'
git switch 'upstream-pr/3619'

Merge

Merge the changes and update on Forgejo.

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

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

No due date set.

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