D3D12.X: XCL_WINDOW_STATS logs each memory window's traffic #3627

Open
Royalflamejlh wants to merge 1 commit from upstream-pr/3627 into main
Royalflamejlh commented 2026-12-02 01:05:59 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-02T01:05:59Z.


(Edited: head 60b0c1672, rebased on main 395405e4c: #3702 replaced the staged-copy list in submit_upload, so the upload counts now come from its UploadCopy jobs (window and bytes). cargo test -p xcl --lib under Wine on the CPU, the touched modules: 190 passed, 0 failed, 3 ignored.)

(Edited: head bdec29f9f takes the second reviews: XCL_WINDOW_STATS uses the UMA region only once it exists, 0 is off, and an address range counts as outside when it runs past its run of adjacent windows of one kind (a root view, whose size is not known, is placed by its start). On main 38ad22da.)

An address the title gives the GPU outside every memory window is no GPU memory, and nothing said so (#3565: with 4 windows the title's GPU views lay outside them). With XCL_WINDOW_STATS=<seconds>, every that many seconds XCL logs a line for each memory window and one for the addresses given to the GPU outside every window, by path; the first 8 of each path are logged with what lies there. Off by default; then each counter is one load. Nothing is remapped.

What is in it

  • hle/d3d12x/window_stats.rs (new): per window its kind, range, bytes with memory on the GPU, and since the line before the bytes uploaded, the pages the write watch found written, the bytes read back and the GPU-view tiles filled; per view_want::Path the addresses outside every window, the first 8 placed (a GPU view of the title's memory, a graphics reservation, plain memory, nothing committed). Relaxed atomics, a logging thread started from host.rs.
  • Counted where the work already happens: sparse.rs (uploads, copy back, view tiles filled; mapped_by_window), title_textures.rs (pages the write watch found), view_want.rs and bind.rs (addresses outside every view window, root views).
  • README.md: the switch.

Tested

  • At bdec29f9f: Under Wine on Mesa's CPU Vulkan driver, release, 1 run: window_stats 5 passed, 0 failed; cargo test --lib -- window_stats file_reads write_log shader_mem console_heap eh:: at the top of the stack (#3642, f1ae90ebb): 62 passed, 0 failed. zero_seconds_is_off and the outside-range case of traffic_adds_to_its_window_and_addresses_in_one_are_not_outside failed without the fix.
  • RTX 5070 Ti 16 GB (driver 621.24), Ryzen 7 9800X3D, Windows 11 Pro 26300, debug, at the top of this stack (#3642, head 5653fd69, with an earlier version of this PR's commit, before the second review's fixes): cargo test --workspace -- --test-threads=4, 2,931 passed, 0 failed, 51 ignored, 1 run; 28 SKIPPED lines (wave64 tests: no wave64 on this card; heap-window tests without XCL_HEAP_WINDOWS=1; no D3D12 debug layer). The stack's GPU tests (gpu_mem_stats_*, the writer and geometry-pass tests) ran and passed.
  • RTX 4060 Ti 16 GB, NVIDIA 615.71.09, AMD Ryzen 9 9950X3D, Linux, Wine 11.21 Staging, Rust 1.98.0, x86_64-pc-windows-gnu, release. Tests under Wine on Mesa's CPU Vulkan driver (no card: the card was running a title).
  • cargo check -p xcl --release --target x86_64-pc-windows-gnu, with and without --tests: no errors, no new warnings.
  • cargo test -p xcl --release --target x86_64-pc-windows-gnu --lib -- --test-threads=8 window_stats view_want hle::d3d12x::bind sparse title_textures gpu::uma: 361 passed, 0 failed, 2 ignored; 3 GPU tests printed SKIPPED: no GPU. The new tests place addresses in the 16- and 4-window layouts and check the lines.
  • In title runs on our development tree, with XCL_SHADER_MEM_STATS (stacked after this), its lines and placement table showed a 1.34 GB GPU heap in a coherent window (system memory) that shaders read far more than the CPU wrote it; #3619 moves that heap to video memory.

Regression run
RTX 2070 SUPER 8 GB (driver 621.01), Ryzen 7 5700X3D, Windows 11 Pro 26200, release builds by scripts/smoke.ps1, the same retail title for 60 s each.

main:

xcl-smoke v1
commit: 395405e4c0ed814afde0610a724dc96a3af329de
gpu: NVIDIA GeForce RTX 2070 SUPER
title: 5330474d
seconds: 60
exit: 0x0
frames shown: 1522 (PresentX 1522)
presents per 2 s (last 3): 60 60 61
device removals: 0
crashes: 0
peak commit: 16017 MB

this PR's head:

xcl-smoke v1
commit: 60b0c1672e602511e93a82d099dbd51cb262e007
gpu: NVIDIA GeForce RTX 2070 SUPER
title: 5330474d
seconds: 60
exit: 0x0
frames shown: 1418 (PresentX 1418)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15438 MB

Not tested

  • AMD, the switch on in a run from this branch (the runs were on our development tree, which carries other changes).

AI use

  • Claude Code, Claude Opus 5.5: wrote the change, its tests and this description, ported it to main and made the title runs.
<!-- greyfinch-sync:ivall/xcl:issue:5597692192 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3627). Originally posted by [Royalflamejlh](https://github.com/Royalflamejlh) on 2026-12-02T01:05:59Z. --- (Edited: head `60b0c1672`, rebased on `main` 395405e4c: #3702 replaced the staged-copy list in `submit_upload`, so the upload counts now come from its `UploadCopy` jobs (window and bytes). `cargo test -p xcl --lib` under Wine on the CPU, the touched modules: 190 passed, 0 failed, 3 ignored.) (Edited: head `bdec29f9f` takes the second reviews: `XCL_WINDOW_STATS` uses the UMA region only once it exists, `0` is off, and an address range counts as outside when it runs past its run of adjacent windows of one kind (a root view, whose size is not known, is placed by its start). On `main` 38ad22da.) An address the title gives the GPU outside every memory window is no GPU memory, and nothing said so (#3565: with 4 windows the title's GPU views lay outside them). With `XCL_WINDOW_STATS=<seconds>`, every that many seconds XCL logs a line for each memory window and one for the addresses given to the GPU outside every window, by path; the first 8 of each path are logged with what lies there. Off by default; then each counter is one load. Nothing is remapped. **What is in it** - `hle/d3d12x/window_stats.rs` (new): per window its kind, range, bytes with memory on the GPU, and since the line before the bytes uploaded, the pages the write watch found written, the bytes read back and the GPU-view tiles filled; per `view_want::Path` the addresses outside every window, the first 8 placed (a GPU view of the title's memory, a graphics reservation, plain memory, nothing committed). Relaxed atomics, a logging thread started from `host.rs`. - Counted where the work already happens: `sparse.rs` (uploads, copy back, view tiles filled; `mapped_by_window`), `title_textures.rs` (pages the write watch found), `view_want.rs` and `bind.rs` (addresses outside every view window, root views). - `README.md`: the switch. **Tested** - At `bdec29f9f`: Under Wine on Mesa's CPU Vulkan driver, release, 1 run: `window_stats` 5 passed, 0 failed; `cargo test --lib -- window_stats file_reads write_log shader_mem console_heap eh::` at the top of the stack (#3642, `f1ae90ebb`): 62 passed, 0 failed. `zero_seconds_is_off` and the outside-range case of `traffic_adds_to_its_window_and_addresses_in_one_are_not_outside` failed without the fix. - RTX 5070 Ti 16 GB (driver 621.24), Ryzen 7 9800X3D, Windows 11 Pro 26300, debug, at the top of this stack (#3642, head `5653fd69`, with an earlier version of this PR's commit, before the second review's fixes): `cargo test --workspace -- --test-threads=4`, 2,931 passed, 0 failed, 51 ignored, 1 run; 28 `SKIPPED` lines (wave64 tests: no wave64 on this card; heap-window tests without `XCL_HEAP_WINDOWS=1`; no D3D12 debug layer). The stack's GPU tests (`gpu_mem_stats_*`, the writer and geometry-pass tests) ran and passed. - RTX 4060 Ti 16 GB, NVIDIA 615.71.09, AMD Ryzen 9 9950X3D, Linux, Wine 11.21 Staging, Rust 1.98.0, `x86_64-pc-windows-gnu`, release. Tests under Wine on Mesa's CPU Vulkan driver (no card: the card was running a title). - `cargo check -p xcl --release --target x86_64-pc-windows-gnu`, with and without `--tests`: no errors, no new warnings. - `cargo test -p xcl --release --target x86_64-pc-windows-gnu --lib -- --test-threads=8 window_stats view_want hle::d3d12x::bind sparse title_textures gpu::uma`: 361 passed, 0 failed, 2 ignored; 3 GPU tests printed `SKIPPED: no GPU`. The new tests place addresses in the 16- and 4-window layouts and check the lines. - In title runs on our development tree, with `XCL_SHADER_MEM_STATS` (stacked after this), its lines and placement table showed a 1.34 GB GPU heap in a coherent window (system memory) that shaders read far more than the CPU wrote it; #3619 moves that heap to video memory. **Regression run** RTX 2070 SUPER 8 GB (driver 621.01), Ryzen 7 5700X3D, Windows 11 Pro 26200, release builds by `scripts/smoke.ps1`, the same retail title for 60 s each. `main`: ``` xcl-smoke v1 commit: 395405e4c0ed814afde0610a724dc96a3af329de gpu: NVIDIA GeForce RTX 2070 SUPER title: 5330474d seconds: 60 exit: 0x0 frames shown: 1522 (PresentX 1522) presents per 2 s (last 3): 60 60 61 device removals: 0 crashes: 0 peak commit: 16017 MB ``` this PR's head: ``` xcl-smoke v1 commit: 60b0c1672e602511e93a82d099dbd51cb262e007 gpu: NVIDIA GeForce RTX 2070 SUPER title: 5330474d seconds: 60 exit: 0x0 frames shown: 1418 (PresentX 1418) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15438 MB ``` **Not tested** - AMD, the switch on in a run from this branch (the runs were on our development tree, which carries other changes). **AI use** - Claude Code, Claude Opus 5.5: wrote the change, its tests and this description, ported it to `main` and made the title runs.
Foniass commented 2026-12-02 01:11:51 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T01:11:51Z.


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

  • "KB up" counts uploads that never happen. window_stats::uploaded(runs) is called when upload_dirty_with_timeout starts (sparse.rs ~4559), before the !uploads_ordered return, before the XCL_SPARSE_LAZY starved runs are dropped (~4593), and before the Wait / RetryRequired returns (~4580, ~4612, ~4630, ~4665). A run that gets Wait is scanned and sent again later (continue 'prepare ~5541, retry_journal ~7997), so the same bytes are counted twice and the per-window upload figure this PR exists to supply is too high under upload pressure. Counting what goes into a submitted batch (submit_upload / staged) avoids it.
  • "KB read back" counts skipped pages too. copy_back (~4252) counts the whole len on entry, while the loop below leaves out LAZY tiles, holes and tiles whose gen changed.
  • The counters have no test. The new tests cover place() and the line formatting; nothing checks which slot count, given, uploaded or written add to, that given ignores an address inside a window, or that log / mapped_by_window add up per window.
  • Regression run missing. Regression run has no xcl-smoke blocks (the reason PR description is red), and Tested is a filtered --lib run under Wine.

Fine: off by default, each hook is one OnceLock load when off, and want_view / want_root_views return the same results as before; place() is right for the 4- and 16-window layouts; the sparse lock is taken through lock_state / holding like the module's other readers.

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

<!-- greyfinch-sync:ivall/xcl:comment:7331424167 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3627#issuecomment-7331424167). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-02T01:11:51Z. --- Review (head 9a0ac0a5, diff read, not a merge-check; draft, checks red): - **"KB up" counts uploads that never happen.** `window_stats::uploaded(runs)` is called when `upload_dirty_with_timeout` starts (`sparse.rs` ~4559), before the `!uploads_ordered` return, before the `XCL_SPARSE_LAZY` starved runs are dropped (~4593), and before the `Wait` / `RetryRequired` returns (~4580, ~4612, ~4630, ~4665). A run that gets `Wait` is scanned and sent again later (`continue 'prepare` ~5541, `retry_journal` ~7997), so the same bytes are counted twice and the per-window upload figure this PR exists to supply is too high under upload pressure. Counting what goes into a submitted batch (`submit_upload` / `staged`) avoids it. - **"KB read back" counts skipped pages too.** `copy_back` (~4252) counts the whole `len` on entry, while the loop below leaves out `LAZY` tiles, holes and tiles whose `gen` changed. - **The counters have no test.** The new tests cover `place()` and the line formatting; nothing checks which slot `count`, `given`, `uploaded` or `written` add to, that `given` ignores an address inside a window, or that `log` / `mapped_by_window` add up per window. - **Regression run missing.** **Regression run** has no `xcl-smoke` blocks (the reason `PR description` is red), and **Tested** is a filtered `--lib` run under Wine. Fine: off by default, each hook is one `OnceLock` load when off, and `want_view` / `want_root_views` return the same results as before; `place()` is right for the 4- and 16-window layouts; the sparse lock is taken through `lock_state` / `holding` like the module's other readers. AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Royalflamejlh commented 2026-12-02 02:55:48 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-02T02:55:48Z.


Thanks. Fixed at 4e2d2887b: KB up counts the copies of a submitted upload (submit_upload, after the submit succeeds), KB read back counts what copy_back lands, and two tests cover the counters' slots, given inside a window, and the per-window lines and mapped sums. #3628 is rebased onto it (bc55ba1fe) with no other change.

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

<!-- greyfinch-sync:ivall/xcl:comment:7333345554 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3627#issuecomment-7333345554). Originally posted by [Royalflamejlh](https://github.com/Royalflamejlh) on 2026-12-02T02:55:48Z. --- Thanks. Fixed at 4e2d2887b: KB up counts the copies of a submitted upload (`submit_upload`, after the submit succeeds), KB read back counts what `copy_back` lands, and two tests cover the counters' slots, `given` inside a window, and the per-window lines and mapped sums. #3628 is rebased onto it (`bc55ba1fe`) with no other change. AI use: Claude Code (Claude Opus 5.5) made the fixes and wrote this reply.
Foniass commented 2026-12-02 03:00:17 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T03:00:17Z.


Follow-up review (head 4e2d2887, since 9a0ac0a5, diff read, not a merge-check; draft):

  • "KB up" counts uploads that never happen: fixed. submit_upload (sparse.rs ~4762) counts staged only when submit_dirty_batch returns Ok, so copies dropped by a Wait / RetryRequired return or by the starved-run drop are not counted.
  • "KB read back" counts skipped pages too: fixed. copy_back (~4267) counts each page inside the branch that lands it.
  • The counters have no test: fixed. traffic_adds_to_its_window_and_addresses_in_one_are_not_outside (window_stats.rs ~255) and mapped_bytes_add_up_per_window_without_lazy_tiles (sparse.rs ~11345) cover the slot choice, given_in, lines and by_window.
  • Regression run missing: partly fixed. Both xcl-smoke blocks are in (1665 vs 1620 frames, peak commit 111 %), and PR description passes; Tested is still a filtered --lib run under Wine, not the whole suite on a GPU.

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:7333423817 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3627#issuecomment-7333423817). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-02T03:00:17Z. --- Follow-up review (head 4e2d2887, since 9a0ac0a5, diff read, not a merge-check; draft): - **"KB up" counts uploads that never happen:** fixed. `submit_upload` (`sparse.rs` ~4762) counts `staged` only when `submit_dirty_batch` returns `Ok`, so copies dropped by a `Wait` / `RetryRequired` return or by the starved-run drop are not counted. - **"KB read back" counts skipped pages too:** fixed. `copy_back` (~4267) counts each page inside the branch that lands it. - **The counters have no test:** fixed. `traffic_adds_to_its_window_and_addresses_in_one_are_not_outside` (`window_stats.rs` ~255) and `mapped_bytes_add_up_per_window_without_lazy_tiles` (`sparse.rs` ~11345) cover the slot choice, `given_in`, `lines` and `by_window`. - **Regression run missing:** partly fixed. Both `xcl-smoke` blocks are in (1665 vs 1620 frames, peak commit 111 %), and `PR description` passes; **Tested** is still a filtered `--lib` run under Wine, not the whole suite on a GPU. New: none. AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Decodere commented 2026-12-02 11:15:03 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Decodere on 2026-12-02T11:15:03Z.


merge-check
base: 1c8b551475
head: 4e2d2887b4
merge: clean (fast-forward onto base, commit 4e2d2887b4, git diff --check clean)
build: cargo build --workspace ok; cargo build --release -p xcl ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 --nocapture (43 targets): 2914 passed, 0 failed, 51 ignored (+5 new tests vs main baseline). All 5 new unit tests passed with 0 skips: hle::d3d12x::sparse::tests::mapped_bytes_add_up_per_window_without_lazy_tiles and all 4 hle::d3d12x::window_stats::tests (an_address_is_placed_in_its_window_or_none, a_view_address_with_four_windows_is_in_no_window, traffic_adds_to_its_window_and_addresses_in_one_are_not_outside, the_lines_name_the_window_and_the_paths_outside). 28 SKIPPED lines (host environment only: 22 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 2 no heap windows, 1 cannot disable the driver cache (Windows Developer Mode required)).
review: Read the full merged diff (+367/-7 across README.md, host.rs, and 6 files in crates/xcl/src/hle/d3d12x/). Adds opt-in XCL_WINDOW_STATS=<seconds> (parsed with .max(1) into a OnceLock<Option<u64>>, off by default so no background thread spawns and every hook short-circuits in one branch). Counts per-window uploads, written pages, readbacks, and filled view tiles using relaxed AtomicU64 counters plus out-of-window GPU addresses by view_want::Path (logging the first 8 per path with region classification). In sparse.rs, iterating staged.iter() before submit_dirty_batch and calling staged.clear() unconditionally after recording window_stats::uploaded(staged) on Ok preserves cleanup without early-return leaks, and by_window excludes LAZY tiles cleanly under lock_state(). The 5 new unit tests verify 16-window and 4-window placement, traffic/outside deltas, line formatting, and lazy-tile exclusion. No scope creep, lock-order issues, or UB.
performance: Paired 60 s retail smoke (title: 29640639): default (unset) 1654 frames (+13.1% vs 1c8b5514 baseline 1462 frames), 14630 MB peak commit (-8.8% vs 16043 MB), 0 removals, 0 crashes; opt-in XCL_WINDOW_STATS=10 1655 frames, 14604 MB peak commit, 0 removals, 0 crashes (live xcl.log confirmed startup banner, 10 s periodic lines for windows 0..3 and outside-every-window traffic, plus views by address outside-window entries).

Default (XCL_WINDOW_STATS unset):

xcl-smoke v1
commit: 4e2d2887b4dedab58b3bdf6f5c8b1224980133f0
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1654 (PresentX 1654)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14630 MB

Opt-in (XCL_WINDOW_STATS=10):

xcl-smoke v1
commit: 4e2d2887b4dedab58b3bdf6f5c8b1224980133f0
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1655 (PresentX 1655)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14604 MB

verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 4060 8 GB (driver 621.40), Intel Core i5-11400F, 32 GB RAM, Windows 11 Build 26200, Rust 1.100.1 MSVC, DXC 1.9.2602.17 / Antigravity (Gemini 4 Neon)

<!-- greyfinch-sync:ivall/xcl:comment:7343644610 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3627#issuecomment-7343644610). Originally posted by [Decodere](https://github.com/Decodere) on 2026-12-02T11:15:03Z. --- merge-check base: 1c8b551475e1e7bfe48f94448492a4c3544a2e0f head: 4e2d2887b4dedab58b3bdf6f5c8b1224980133f0 merge: clean (fast-forward onto base, commit 4e2d2887b4dedab58b3bdf6f5c8b1224980133f0, git diff --check clean) build: cargo build --workspace ok; cargo build --release -p xcl ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 --nocapture (43 targets): 2914 passed, 0 failed, 51 ignored (+5 new tests vs main baseline). All 5 new unit tests passed with 0 skips: hle::d3d12x::sparse::tests::mapped_bytes_add_up_per_window_without_lazy_tiles and all 4 hle::d3d12x::window_stats::tests (an_address_is_placed_in_its_window_or_none, a_view_address_with_four_windows_is_in_no_window, traffic_adds_to_its_window_and_addresses_in_one_are_not_outside, the_lines_name_the_window_and_the_paths_outside). 28 SKIPPED lines (host environment only: 22 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 2 no heap windows, 1 cannot disable the driver cache (Windows Developer Mode required)). review: Read the full merged diff (+367/-7 across README.md, host.rs, and 6 files in crates/xcl/src/hle/d3d12x/). Adds opt-in `XCL_WINDOW_STATS=<seconds>` (parsed with `.max(1)` into a `OnceLock<Option<u64>>`, off by default so no background thread spawns and every hook short-circuits in one branch). Counts per-window uploads, written pages, readbacks, and filled view tiles using relaxed `AtomicU64` counters plus out-of-window GPU addresses by `view_want::Path` (logging the first 8 per path with region classification). In `sparse.rs`, iterating `staged.iter()` before `submit_dirty_batch` and calling `staged.clear()` unconditionally after recording `window_stats::uploaded(staged)` on `Ok` preserves cleanup without early-return leaks, and `by_window` excludes `LAZY` tiles cleanly under `lock_state()`. The 5 new unit tests verify 16-window and 4-window placement, traffic/outside deltas, line formatting, and lazy-tile exclusion. No scope creep, lock-order issues, or UB. performance: Paired 60 s retail smoke (title: 29640639): default (unset) 1654 frames (+13.1% vs 1c8b5514 baseline 1462 frames), 14630 MB peak commit (-8.8% vs 16043 MB), 0 removals, 0 crashes; opt-in `XCL_WINDOW_STATS=10` 1655 frames, 14604 MB peak commit, 0 removals, 0 crashes (live `xcl.log` confirmed startup banner, 10 s periodic lines for windows 0..3 and outside-every-window traffic, plus `views by address` outside-window entries). Default (`XCL_WINDOW_STATS` unset): ``` xcl-smoke v1 commit: 4e2d2887b4dedab58b3bdf6f5c8b1224980133f0 gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1654 (PresentX 1654) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14630 MB ``` Opt-in (`XCL_WINDOW_STATS=10`): ``` xcl-smoke v1 commit: 4e2d2887b4dedab58b3bdf6f5c8b1224980133f0 gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1655 (PresentX 1655) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14604 MB ``` verdict: safe to merge hardware / tool and model: NVIDIA GeForce RTX 4060 8 GB (driver 621.40), Intel Core i5-11400F, 32 GB RAM, Windows 11 Build 26200, Rust 1.100.1 MSVC, DXC 1.9.2602.17 / Antigravity (Gemini 4 Neon)
Foniass commented 2026-12-02 13:46:53 +00:00 (Migrated from github.com)

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


Follow-up review (head 4b7c148b, since 4e2d2887, diff read, not a merge-check; checks red):

  • Earlier points: unchanged. git range-diff shows the own commit identical to the previous one; this push only rebases the stack onto the current main.

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:7347447814 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3627#issuecomment-7347447814). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-02T13:46:53Z. --- Follow-up review (head 4b7c148b, since 4e2d2887, diff read, not a merge-check; checks red): - **Earlier points:** unchanged. `git range-diff` shows the own commit identical to the previous one; this push only rebases the stack onto the current `main`. New: none. AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
bmjask commented 2026-12-02 16:30:42 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T16:30:42Z.


@Prime1997 could you take a look at this one for review and merge? My automated review notes are above, if any.

<!-- greyfinch-sync:ivall/xcl:comment:7352049714 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3627#issuecomment-7352049714). Originally posted by [bmjask](https://github.com/bmjask) on 2026-12-02T16:30:42Z. --- @Prime1997 could you take a look at this one for review and merge? My automated review notes are above, if any.
Foniass commented 2026-12-02 21:04:22 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T21:04:22Z.


Follow-up review of 2580976a, since 4b7c148b (code reading only, not a merge-check; PR description red) · 1 medium

In short: This push reworks the PR's own commit:

  • XCL_WINDOW_STATS=0 now turns the stats off;
  • the stats read the UMA region only once it exists (uma::existing());
  • a range whose end runs past its window now counts as "outside every window".

The new end check also counts ranges that are inside the memory windows: ranges that cross between two adjacent sparse or view windows, and root views near a window's end, checked against an assumed 64 KiB. The smoke blocks name 4b7c148b, and the whole-suite GPU run predates this push (PR description is red).

Medium

  1. Ranges that cross between windows of the same region count as "outside every window".

    • given_in (window_stats.rs ~111) treats a range as inside only when its first and last byte fall in the same 4 GiB window index.
    • The sparse windows are one reservation, and a title's reservation can run across them (uma.rs ~440: "one contiguous range of 11.5 GiB"). GPU views can cross view windows too. A view or copy crossing a 4 GiB line inside a title reservation is then logged as "only its start does, in window 0".
    • want_root_views (bind.rs ~1615) passes ROOT_VIEW_BYTES (64 KiB), an assumed size, so every root view in the last 64 KiB before a 4 GiB line, or of the coherent window's committed bytes, is flagged the same way.
    • These false counts land in the number this PR exists to report (#3565).

    Fix: accept an end in the same run of adjacent windows of one kind, and check only the start of root views. Add a test with a range that crosses from window 0 into window 1.

Checked and fine
  • Earlier finding fixed: "KB up" counted uploads that never happen. It is now counted only when submit_dirty_batch returns Ok (sparse.rs ~4765).
  • Earlier finding fixed: "KB read back" counted skipped pages. It is now counted inside the branch that lands the page (~4270).
  • Earlier finding fixed: the counters had no test. Now traffic_adds_to_its_window_and_addresses_in_one_are_not_outside and mapped_bytes_add_up_per_window_without_lazy_tiles.
  • every returns None for 0 and for text that is not a number (zero_seconds_is_off).
  • on() and log() use uma::existing(), so the stats never create the UMA region.
  • The coherent-window case in the new test is right: a 2-byte range at end - 1 is counted, one at end - 2 is not.
  • given still returns early for address 0, and the end arithmetic cannot overflow.
  • Off by default; each hook costs one OnceLock load when off.

Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7358749051 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3627#issuecomment-7358749051). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-02T21:04:22Z. --- **Follow-up review** of `2580976a`, since `4b7c148b` (code reading only, not a merge-check; `PR description` red) · 1 medium **In short:** This push reworks the PR's own commit: - `XCL_WINDOW_STATS=0` now turns the stats off; - the stats read the UMA region only once it exists (`uma::existing()`); - a range whose end runs past its window now counts as "outside every window". The new end check also counts ranges that are inside the memory windows: ranges that cross between two adjacent sparse or view windows, and root views near a window's end, checked against an assumed 64 KiB. The smoke blocks name `4b7c148b`, and the whole-suite GPU run predates this push (`PR description` is red). #### Medium 1. **Ranges that cross between windows of the same region count as "outside every window".** - `given_in` (`window_stats.rs` ~111) treats a range as inside only when its first and last byte fall in the same 4 GiB window index. - The sparse windows are one reservation, and a title's reservation can run across them (`uma.rs` ~440: "one contiguous range of 11.5 GiB"). GPU views can cross view windows too. A view or copy crossing a 4 GiB line inside a title reservation is then logged as "only its start does, in window 0". - `want_root_views` (`bind.rs` ~1615) passes `ROOT_VIEW_BYTES` (64 KiB), an assumed size, so every root view in the last 64 KiB before a 4 GiB line, or of the coherent window's committed bytes, is flagged the same way. - These false counts land in the number this PR exists to report (#3565). Fix: accept an end in the same run of adjacent windows of one kind, and check only the start of root views. Add a test with a range that crosses from window 0 into window 1. <details><summary>Checked and fine</summary> - Earlier finding fixed: "KB up" counted uploads that never happen. It is now counted only when `submit_dirty_batch` returns `Ok` (`sparse.rs` ~4765). - Earlier finding fixed: "KB read back" counted skipped pages. It is now counted inside the branch that lands the page (~4270). - Earlier finding fixed: the counters had no test. Now `traffic_adds_to_its_window_and_addresses_in_one_are_not_outside` and `mapped_bytes_add_up_per_window_without_lazy_tiles`. - `every` returns `None` for `0` and for text that is not a number (`zero_seconds_is_off`). - `on()` and `log()` use `uma::existing()`, so the stats never create the UMA region. - The coherent-window case in the new test is right: a 2-byte range at `end - 1` is counted, one at `end - 2` is not. - `given` still returns early for address 0, and the end arithmetic cannot overflow. - Off by default; each hook costs one `OnceLock` load when off. </details> <sub>Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.</sub>
Royalflamejlh commented 2026-12-02 21:32:28 +00:00 (Migrated from github.com)

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


Right: the sparse windows hold one contiguous title reservation, and root views pass an assumed 64 KiB. Fixed at bdec29f9. A range is inside when its last byte lies in its start's window or in the windows of the same kind that run on from it without a gap (in_run, window_stats.rs). A root view is placed by its start alone. The test now has a range from window 0 into window 1 (inside), from sparse window 2 into the coherent window and past the last view window (both outside), and a 64 KiB root view at the coherent window's last byte (inside). It failed without the fix, 1 run under Wine.

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

<!-- greyfinch-sync:ivall/xcl:comment:7359424718 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3627#issuecomment-7359424718). Originally posted by [Royalflamejlh](https://github.com/Royalflamejlh) on 2026-12-02T21:32:28Z. --- Right: the sparse windows hold one contiguous title reservation, and root views pass an assumed 64 KiB. Fixed at `bdec29f9`. A range is inside when its last byte lies in its start's window or in the windows of the same kind that run on from it without a gap (`in_run`, `window_stats.rs`). A root view is placed by its start alone. The test now has a range from window 0 into window 1 (inside), from sparse window 2 into the coherent window and past the last view window (both outside), and a 64 KiB root view at the coherent window's last byte (inside). It failed without the fix, 1 run under Wine. AI use: Claude Code (Claude Opus 5.5) made the changes and wrote this reply.
Foniass commented 2026-12-02 21:33:33 +00:00 (Migrated from github.com)

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


Follow-up review of bdec29f9, since 2580976a (code reading only, not a merge-check; PR description red) · no new findings

In short: This push fixes the window-crossing count from my last review. A range now counts as inside when its last byte lies in the same window or in the adjacent windows of the same kind that run on from it (in_run, window_stats.rs). A root view, whose size is not known, is placed by its start only. The test covers ranges crossing 0→1, 2→3 and past the last window. The smoke blocks name 4b7c148b (PR description is red).

Checked and fine
  • Earlier finding fixed: ranges crossing between windows of the same region counted as outside. in_run accepts last in windows k..=end when every window in between has the same kind and is full-size (u.window(j).1 == WINDOW), so a reservation spanning sparse or view windows counts as inside.
  • Earlier finding fixed: root views near a window's end were checked against an assumed 64 KiB. Path::RootView now uses last = va.
  • The new test cases: a CBV crossing from sparse window 0 into 1 is not counted. One at the coherent window's end, one crossing 2→3 and one past window 10 are counted (3 constant buffer views in the expected line). A 64 KiB root view at the coherent end is not counted.
  • The earlier fixes (uploads and readbacks counted only when they happen, the counter tests, XCL_WINDOW_STATS=0, uma::existing()) are unchanged.

Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7359450412 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3627#issuecomment-7359450412). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-02T21:33:33Z. --- **Follow-up review** of `bdec29f9`, since `2580976a` (code reading only, not a merge-check; `PR description` red) · no new findings **In short:** This push fixes the window-crossing count from my last review. A range now counts as inside when its last byte lies in the same window or in the adjacent windows of the same kind that run on from it (`in_run`, `window_stats.rs`). A root view, whose size is not known, is placed by its start only. The test covers ranges crossing 0→1, 2→3 and past the last window. The smoke blocks name `4b7c148b` (`PR description` is red). <details><summary>Checked and fine</summary> - Earlier finding fixed: ranges crossing between windows of the same region counted as outside. `in_run` accepts `last` in windows `k..=end` when every window in between has the same kind and is full-size (`u.window(j).1 == WINDOW`), so a reservation spanning sparse or view windows counts as inside. - Earlier finding fixed: root views near a window's end were checked against an assumed 64 KiB. `Path::RootView` now uses `last = va`. - The new test cases: a CBV crossing from sparse window 0 into 1 is not counted. One at the coherent window's end, one crossing 2→3 and one past window 10 are counted (3 constant buffer views in the expected line). A 64 KiB root view at the coherent end is not counted. - The earlier fixes (uploads and readbacks counted only when they happen, the counter tests, `XCL_WINDOW_STATS=0`, `uma::existing()`) are unchanged. </details> <sub>Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.</sub>
Foniass commented 2026-12-03 02:33:59 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-03T02:33:59Z.


Follow-up review of 60b0c167, since bdec29f9 (code reading only, not a merge-check) · no new findings

In short: This push rebases onto main, where the sparse upload now builds UploadCopy jobs. The window statistics follow it: uploaded takes (address, bytes) pairs and is fed from jobs after submit_dirty_batch succeeds. Nothing else changed (git range-diff), and nothing blocks it.

Checked and fine
  • UploadCopy::window is the title address of the copy (sparse.rs ~4678, ~4840), so add(u, a, Traffic::Up, n) charges the same window as before.
  • Uploads are still counted only when submit_dirty_batch returns Ok (~4747-4749), so the earlier fix holds.
  • The window-run check and the root-view rule from the last push are unchanged.

Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7365607376 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3627#issuecomment-7365607376). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-03T02:33:59Z. --- **Follow-up review** of `60b0c167`, since `bdec29f9` (code reading only, not a merge-check) · no new findings **In short:** This push rebases onto `main`, where the sparse upload now builds `UploadCopy` jobs. The window statistics follow it: `uploaded` takes `(address, bytes)` pairs and is fed from `jobs` after `submit_dirty_batch` succeeds. Nothing else changed (`git range-diff`), and nothing blocks it. <details><summary>Checked and fine</summary> - `UploadCopy::window` is the title address of the copy (`sparse.rs` ~4678, ~4840), so `add(u, a, Traffic::Up, n)` charges the same window as before. - Uploads are still counted only when `submit_dirty_batch` returns `Ok` (~4747-4749), so the earlier fix holds. - The window-run check and the root-view rule from the last push are unchanged. </details> <sub>Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.</sub>
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/3627:upstream-pr/3627'
git switch 'upstream-pr/3627'

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/3627'
git switch 'upstream-pr/3627'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3627'
git switch 'upstream-pr/3627'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3627'
git switch 'main'
git merge --squash 'upstream-pr/3627'
git switch 'main'
git merge --ff-only 'upstream-pr/3627'
git switch 'main'
git merge 'upstream-pr/3627'
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!3627
No description provided.