Memory: attribute heap growth with optional lightweight counters #3049

Open
Prime1997 wants to merge 3 commits from upstream-pr/3049 into main
Prime1997 commented 2026-11-27 17:54:28 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Prime1997 on 2026-11-27T17:54:28Z.


Process commit combines title storage, XCL allocations, shader compilation and driver memory. This existing PR attributes XCL's Rust heap and title heap allocations. The new XCL_HEAP_COUNT=2 mode keeps byte/count buckets without stack capture, the allocation-site table lock, snapshot buffers or Windows heap walks; mode 1 retains the detailed diagnostics. This is instrumentation, not a RAM or VRAM reduction.

Rebased onto main (2026-11-28). nvidia-dev was merged into main by #3203, so this PR now targets main and its branch was rebased onto main 765b2c5bfff6754e8c9886a73e188a86aca3c64c: head a209ad1f0ea884676a65a16a6769d5a0025a7343 (was e6e6b38160258e43b679f7245f43d61c983e7fae). The earlier head was a merge of nvidia-dev into the branch; that merge commit is gone and the three commits of this PR are replayed on main. Conflicts were the XCL_ACTIVITY paragraph of README.md and one line of host.rs. On the rebased head, on the same RTX 3060 Ti PC, debug profile: cargo check -p xcl --all-targets exited 0, and cargo test -p xcl --lib -- --test-threads=4 a_large_allocation_is_kept_with_its_place_until_it_is_freed about_one_small_allocation_in_sample_is_kept counters_only_do_not_retain_sites sizes_fall_in_their_class the_reports_own_buffer_is_not_reported heap_count gave 5 passed, 0 failed, 0 ignored, no SKIPPED. The whole suite and the paired title runs have not been rerun on this head; every other result below is from the earlier head. The rebase and its conflict resolution were done with Claude Code.

What is in it

  • Existing size buckets, sampled stacks, title allocation counters and optional detailed compiler/process-heap reporting are preserved.
  • Lightweight counters every 20 seconds with XCL_ACTIVITY=1; counts are concurrent samples, not an atomic process snapshot.
  • Current nvidia-dev is merged without rewriting the earlier commits. One new counters-only fixture is prepared.

Tested

  • Current PR head: e6e6b38160258e43b679f7245f43d61c983e7fae. Independent source review and git diff --check.

  • Combined integration d54d80e1bc9d070cbec4a619abb5f4b89880b2f5 compiled with cargo build --locked --release -p xcl --target-dir <isolated-target>: exit 0, 229.200 seconds. This is compilation of the combined candidate, not a build or runtime validation of this standalone PR. Zero tests executed; no GPU checks or smoke run.

  • The earlier description's suite and 60-second smoke results belong to f9d239bbdc5d2b8019ac58110e5752774a86eb2d; they are historical and do not validate this new head.

Regression run
Pending for this revision. No new smoke blocks are claimed.

Not tested
Standalone compilation, new fixture, full suite, gameplay performance and long-run memory behavior at this head. The existing detailed mode retains stack-attribution limitations around concurrent realloc/address reuse and may pause allocating threads during heap walks. The next local candidate selects counters-only mode 2.

AI use
The original contribution and earlier results were prepared with Claude Code (Claude Fable 5.2 and Claude Opus 5.5). Codex (GPT-6) added and independently source-reviewed the counters-only extension, reconciled current NVIDIA, compiled the combined candidate and prepared this update.

Optional contributor/test coordination: https://discord.gg/6B4TykyC4W

<!-- greyfinch-sync:ivall/xcl:issue:5530973607 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3049). Originally posted by [Prime1997](https://github.com/Prime1997) on 2026-11-27T17:54:28Z. --- Process commit combines title storage, XCL allocations, shader compilation and driver memory. This existing PR attributes XCL's Rust heap and title heap allocations. The new `XCL_HEAP_COUNT=2` mode keeps byte/count buckets without stack capture, the allocation-site table lock, snapshot buffers or Windows heap walks; mode 1 retains the detailed diagnostics. This is instrumentation, not a RAM or VRAM reduction. **Rebased onto main (2026-11-28).** `nvidia-dev` was merged into `main` by #3203, so this PR now targets `main` and its branch was rebased onto `main` `765b2c5bfff6754e8c9886a73e188a86aca3c64c`: head `a209ad1f0ea884676a65a16a6769d5a0025a7343` (was `e6e6b38160258e43b679f7245f43d61c983e7fae`). The earlier head was a merge of `nvidia-dev` into the branch; that merge commit is gone and the three commits of this PR are replayed on `main`. Conflicts were the `XCL_ACTIVITY` paragraph of README.md and one line of `host.rs`. On the rebased head, on the same RTX 3060 Ti PC, debug profile: `cargo check -p xcl --all-targets` exited 0, and `cargo test -p xcl --lib -- --test-threads=4 a_large_allocation_is_kept_with_its_place_until_it_is_freed about_one_small_allocation_in_sample_is_kept counters_only_do_not_retain_sites sizes_fall_in_their_class the_reports_own_buffer_is_not_reported heap_count` gave 5 passed, 0 failed, 0 ignored, no SKIPPED. The whole suite and the paired title runs have not been rerun on this head; every other result below is from the earlier head. The rebase and its conflict resolution were done with Claude Code. **What is in it** - Existing size buckets, sampled stacks, title allocation counters and optional detailed compiler/process-heap reporting are preserved. - Lightweight counters every 20 seconds with `XCL_ACTIVITY=1`; counts are concurrent samples, not an atomic process snapshot. - Current nvidia-dev is merged without rewriting the earlier commits. One new counters-only fixture is prepared. **Tested** - Current PR head: `e6e6b38160258e43b679f7245f43d61c983e7fae`. Independent source review and `git diff --check`. - Combined integration [`d54d80e1bc9d070cbec4a619abb5f4b89880b2f5`](https://github.com/Prime1997/xcl/commit/d54d80e1bc9d070cbec4a619abb5f4b89880b2f5) compiled with `cargo build --locked --release -p xcl --target-dir <isolated-target>`: exit 0, 229.200 seconds. This is compilation of the combined candidate, not a build or runtime validation of this standalone PR. Zero tests executed; no GPU checks or smoke run. - The earlier description's suite and 60-second smoke results belong to `f9d239bbdc5d2b8019ac58110e5752774a86eb2d`; they are historical and do not validate this new head. **Regression run** Pending for this revision. No new smoke blocks are claimed. **Not tested** Standalone compilation, new fixture, full suite, gameplay performance and long-run memory behavior at this head. The existing detailed mode retains stack-attribution limitations around concurrent realloc/address reuse and may pause allocating threads during heap walks. The next local candidate selects counters-only mode 2. **AI use** The original contribution and earlier results were prepared with Claude Code (Claude Fable 5.2 and Claude Opus 5.5). Codex (GPT-6) added and independently source-reviewed the counters-only extension, reconciled current NVIDIA, compiled the combined candidate and prepared this update. Optional contributor/test coordination: https://discord.gg/6B4TykyC4W
andrewDoing commented 2026-11-27 20:21:08 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by andrewDoing on 2026-11-27T20:21:08Z.


I found a reporting self-allocation on head 1d46e4b64b03e84286947151c6586111c7d84d8a using the production Counting allocator and lines(2) in a standalone native Windows probe.

Probe payload Total live line Large-allocation line
No payload 0 MB / 0 allocations 7 MB / 1 allocation
One live 1 MiB payload 1 MB 8 MB / 2 allocations; the 7 MB site ranks first

The Vec<Site>::with_capacity(65536) created for the snapshot is itself tracked before the large-site snapshot, so it appears as a live large allocation even though the totals were sampled earlier. A local candidate excluding that snapshot buffer's address from the large-site walk reported 0 MB with no payload and 1 MB for the single-payload case.

This is a synthetic diagnostic-accuracy test, not evidence of a title memory increase or GPU impact. I did not test concurrent mutation, saturation, or a retail run.

AI use: OpenAI Codex with GPT-6.2 Astra built and ran the probe; Codex reviewed and prepared this report.

<!-- greyfinch-sync:ivall/xcl:comment:7227417850 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3049#issuecomment-7227417850). Originally posted by [andrewDoing](https://github.com/andrewDoing) on 2026-11-27T20:21:08Z. --- I found a reporting self-allocation on head `1d46e4b64b03e84286947151c6586111c7d84d8a` using the production `Counting` allocator and `lines(2)` in a standalone native Windows probe. | Probe payload | Total live line | Large-allocation line | | --- | --- | --- | | No payload | 0 MB / 0 allocations | 7 MB / 1 allocation | | One live 1 MiB payload | 1 MB | 8 MB / 2 allocations; the 7 MB site ranks first | The `Vec<Site>::with_capacity(65536)` created for the snapshot is itself tracked before the large-site snapshot, so it appears as a live large allocation even though the totals were sampled earlier. A local candidate excluding that snapshot buffer's address from the large-site walk reported 0 MB with no payload and 1 MB for the single-payload case. This is a synthetic diagnostic-accuracy test, not evidence of a title memory increase or GPU impact. I did not test concurrent mutation, saturation, or a retail run. AI use: OpenAI Codex with GPT-6.2 Astra built and ran the probe; Codex reviewed and prepared this report.
JJAutoCompare commented 2026-11-27 20:57:24 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-27T20:57:24Z.


Tested

CPU-only on Windows 11 build 26200, Ryzen 7 3800X, and Rust 1.100.0 MSVC debug. I verified that the standalone fixture's heap_count.rs was byte-for-byte the Git blob at 1d46e4b64b03e84286947151c6586111c7d84d8a, then reran the pinned heap-phases.exe with XCL_HEAP_COUNT=1. Only the six worker payloads used Counting. The observer sampled live() between synchronized phases.

Phase Raw live bytes Raw live allocations
Before allocation 0 0
Both workers' payloads live 1,126,783 6
First worker's payloads released 1,057,023 3
Both workers' payloads released 0 0

One fixture check passed, with zero failures, ignores, or skips. The native process exited 0. The logging wrapper initially mistook the skipped=0 tally for a skip. I verified the recorded native exit and tally separately.

Not tested

Diagnostic formatting or self-allocation, observation during concurrent mutation, other allocator paths, the workspace suite, GPU or retail runs, and performance.

AI use

T3 Code / Codex (gpt-6.2-sol) wrote the fixture, independently reran it, and drafted this report.

<!-- greyfinch-sync:ivall/xcl:comment:7227996487 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3049#issuecomment-7227996487). Originally posted by [JJAutoCompare](https://github.com/JJAutoCompare) on 2026-11-27T20:57:24Z. --- **Tested** CPU-only on Windows 11 build 26200, Ryzen 7 3800X, and Rust 1.100.0 MSVC debug. I verified that the standalone fixture's `heap_count.rs` was byte-for-byte the Git blob at `1d46e4b64b03e84286947151c6586111c7d84d8a`, then reran the pinned `heap-phases.exe` with `XCL_HEAP_COUNT=1`. Only the six worker payloads used `Counting`. The observer sampled `live()` between synchronized phases. | Phase | Raw live bytes | Raw live allocations | | --- | ---: | ---: | | Before allocation | 0 | 0 | | Both workers' payloads live | 1,126,783 | 6 | | First worker's payloads released | 1,057,023 | 3 | | Both workers' payloads released | 0 | 0 | One fixture check passed, with zero failures, ignores, or skips. The native process exited 0. The logging wrapper initially mistook the `skipped=0` tally for a skip. I verified the recorded native exit and tally separately. **Not tested** Diagnostic formatting or self-allocation, observation during concurrent mutation, other allocator paths, the workspace suite, GPU or retail runs, and performance. **AI use** T3 Code / Codex (`gpt-6.2-sol`) wrote the fixture, independently reran it, and drafted this report.
Prime1997 commented 2026-11-27 21:21:15 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Prime1997 on 2026-11-27T21:21:15Z.


Thanks, confirmed and fixed in f9d239bb: the snapshot is now copied by snapshot_into, which skips the snapshot buffer's own address. The test the_reports_own_buffer_is_not_reported keeps the buffer as the switch would and checks that it's left out while another large allocation is reported; it fails without the fix. The suite and the smoke for the new head are in the description.

AI use: Claude Code (Claude Opus 5.5) wrote the fix and this reply; Prime posted it.

<!-- greyfinch-sync:ivall/xcl:comment:7228367644 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3049#issuecomment-7228367644). Originally posted by [Prime1997](https://github.com/Prime1997) on 2026-11-27T21:21:15Z. --- Thanks, confirmed and fixed in f9d239bb: the snapshot is now copied by `snapshot_into`, which skips the snapshot buffer's own address. The test `the_reports_own_buffer_is_not_reported` keeps the buffer as the switch would and checks that it's left out while another large allocation is reported; it fails without the fix. The suite and the smoke for the new head are in the description. AI use: Claude Code (Claude Opus 5.5) wrote the fix and this reply; Prime posted it.
andrewDoing commented 2026-11-27 21:26:15 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by andrewDoing on 2026-11-27T21:26:15Z.


I reran the same standalone native Windows Counting + lines(2) probe from my earlier report against updated head f9d239bbdc5d2b8019ac58110e5752774a86eb2d, with a freshly built binary.

The empty payload now reports 0 MiB / 0 large sites (previously 7 MiB / 1 site). One live 1 MiB payload reports 1 MiB / 1 large site (previously 8 MiB / 2 sites), and the total live lines remain 0 and 1 MiB respectively. This verifies the reported self-allocation case; concurrent mutation, saturation, and retail behavior were not tested.

AI use: OpenAI Codex with GPT-6.2 Astra ran the probe; Codex reviewed and prepared this report.

<!-- greyfinch-sync:ivall/xcl:comment:7228442646 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3049#issuecomment-7228442646). Originally posted by [andrewDoing](https://github.com/andrewDoing) on 2026-11-27T21:26:15Z. --- I reran the same standalone native Windows `Counting` + `lines(2)` probe from my earlier report against updated head `f9d239bbdc5d2b8019ac58110e5752774a86eb2d`, with a freshly built binary. The empty payload now reports **0 MiB / 0 large sites** (previously 7 MiB / 1 site). One live 1 MiB payload reports **1 MiB / 1 large site** (previously 8 MiB / 2 sites), and the total live lines remain 0 and 1 MiB respectively. This verifies the reported self-allocation case; concurrent mutation, saturation, and retail behavior were not tested. AI use: OpenAI Codex with GPT-6.2 Astra ran the probe; Codex reviewed and prepared this report.
Prime1997 commented 2026-11-28 12:06:50 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Prime1997 on 2026-11-28T12:06:50Z.


Failed interactive integration result for d54d80e1bc9d070cbec4a619abb5f4b89880b2f5, containing this PR's change together with the other memory/removal repairs. This was not a standalone test of e6e6b38160258e43b679f7245f43d61c983e7fae and does not establish which change caused or prevented a symptom.

  • RTX 3060 Ti 8 GiB, 32 GiB system RAM, release, about 402 seconds with 126 read-only monitoring samples. XCL ended the title itself with 0x887a0005 (DEVICE_REMOVED); no external stop or automated inputs.
  • Peak process commit: 22,994 MiB; peak resident process-tree RAM: 15.79 GiB. Peak DXGI local usage: 6,839 MiB; all 196 console memory lines were below their simultaneous local budget, with minimum headroom 218 MiB. Sampling cannot rule out a transient overrun.
  • Last positive presentation interval was observed around 173 seconds. Audio/diagnostic activity continued during the later rendering stall.
  • DRED state was UNKNOWN. Both page-fault output and breadcrumbs returned 0x887a0004 (unsupported), so there is no reliable GPU fault location. System commit still had 34,764 MiB headroom at removal; no out-of-memory result was established.

Counters-only mode2 ran throughout. Between observations at 12:00:39 and 12:03:19 UTC, process commit rose from 19,977 to 22,880 MiB while Rust live allocations fell from 1,051 to 766 MiB. The increase is outside the Rust live payload count; native/driver/title allocations and allocator-retained capacity remain unseparated. No expensive stack capture or Windows heap walks were enabled.

This run does not justify merge approval or a claim that RAM growth/device removal is fixed. Full standalone validation and matching main/head smoke reports remain outstanding. No builds or synthetic GPU tests ran during gameplay. Logs, hashes, counter samples and source/installed-data preservation checks are retained locally.

AI use: OpenAI Codex (GPT-6) launched the prepared candidate at the user's request, monitored existing logs and read-only counters, and prepared this report; a separate Codex agent reviewed the log evidence.

Optional contributor/test coordination: https://discord.gg/gK3y7WRRY

<!-- greyfinch-sync:ivall/xcl:comment:7239002701 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3049#issuecomment-7239002701). Originally posted by [Prime1997](https://github.com/Prime1997) on 2026-11-28T12:06:50Z. --- Failed interactive integration result for [`d54d80e1bc9d070cbec4a619abb5f4b89880b2f5`](https://github.com/Prime1997/xcl/commit/d54d80e1bc9d070cbec4a619abb5f4b89880b2f5), containing this PR's change together with the other memory/removal repairs. This was not a standalone test of `e6e6b38160258e43b679f7245f43d61c983e7fae` and does not establish which change caused or prevented a symptom. - RTX 3060 Ti 8 GiB, 32 GiB system RAM, release, about 402 seconds with 126 read-only monitoring samples. XCL ended the title itself with `0x887a0005` (DEVICE_REMOVED); no external stop or automated inputs. - Peak process commit: 22,994 MiB; peak resident process-tree RAM: 15.79 GiB. Peak DXGI local usage: 6,839 MiB; all 196 console memory lines were below their simultaneous local budget, with minimum headroom 218 MiB. Sampling cannot rule out a transient overrun. - Last positive presentation interval was observed around 173 seconds. Audio/diagnostic activity continued during the later rendering stall. - DRED state was UNKNOWN. Both page-fault output and breadcrumbs returned `0x887a0004` (unsupported), so there is no reliable GPU fault location. System commit still had 34,764 MiB headroom at removal; no out-of-memory result was established. Counters-only mode2 ran throughout. Between observations at 12:00:39 and 12:03:19 UTC, process commit rose from 19,977 to 22,880 MiB while Rust live allocations fell from 1,051 to 766 MiB. The increase is outside the Rust live payload count; native/driver/title allocations and allocator-retained capacity remain unseparated. No expensive stack capture or Windows heap walks were enabled. This run does not justify merge approval or a claim that RAM growth/device removal is fixed. Full standalone validation and matching main/head smoke reports remain outstanding. No builds or synthetic GPU tests ran during gameplay. Logs, hashes, counter samples and source/installed-data preservation checks are retained locally. AI use: OpenAI Codex (GPT-6) launched the prepared candidate at the user's request, monitored existing logs and read-only counters, and prepared this report; a separate Codex agent reviewed the log evidence. Optional contributor/test coordination: https://discord.gg/gK3y7WRRY
vasanex commented 2026-11-29 04:23:16 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by vasanex on 2026-11-29T04:23:16Z.


merge-check
base: fa204595a488c60c6c5f905244f0172072c9c2a9
head: a209ad1f0ea884676a65a16a6769d5a0025a7343
merge: clean (clashes with #3050 in host.rs: whichever lands second needs a rebase)
build: cargo build --workspace -> ok
tests: not run alone; in a stack of 11 of your PRs on this base: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2650 passed, 1 failed, 49 ignored; SKIPPED: 27 lines; failing: #3123's private_physical_pages_reach_the_gpu_on_mapping only. Alone: gpu::recomp::dxc:: heap_count:: hle::kernelx:: host:: 102 passed, 0 failed, 1 ignored.
review: the counters are opt-in, but the #[global_allocator] wrapper is installed for every run (lib.rs:43); off, it costs one relaxed load per allocation. Notes: the site table is a static of 65,536 slots (heap_count.rs:37/52), about 7 MiB of writable image even when off (not measured here) - could be allocated in mode 1 only; mode 1 takes a global spinlock without backoff inside the allocator (:76), a hang if the holder is suspended (thread dumps, SuspendThread); comments in host.rs/lib.rs name mode 1 only. Mode 2 was run in three 150 s load runs (see performance); mode 1 was not exercised.
performance: 60 s smoke of the merged tree (1b59ba0d), switch off: 1687 frames, peak commit 17239 MB, 0 removals, 0 crashes (base 1629-1689 frames, 16065-16596 MB; commit is noisy in this series, a tree identical to the base showed 19938 MB). Mode 2 in three 150 s load runs (this PR alone, with #3091, with #3047): a line every 20 s, XCL's own heap 993 -> 2150 MB over a load, 0 removals, 0 crashes, 2824 / 2277 / 2073 frames against 2014 on the base without the PR - no cost visible. In two of the three runs the activity lines (all of them, not only the heap line) stopped 20-25 s before the end while the process ran on; the two runs without the counter logged to the end. Three runs do not show whether that is the counter.
verdict: not yet: this check is on fa204595 and stale - needs a rerun on current main; open from review: the "not kept: table full" label counts cumulative insertion misses (bmjask). The two cache findings do not apply on main since e62a02ff (#3447); still a draft; description check red
hardware / tool and model: RTX 3080 10 GB 621.40, Ryzen 9 7950X, Windows 11 26200 / Claude Code (Claude Opus 5.5, Claude Fable 5.2)

Edited 2026-11-29 (twice): first to "not yet" after Kalmarv's merge-check, then corrected - see my two replies below.

How this was run: the suite ran once on the 11 of your PRs that build on this base, merged together (#3047 #3048 #3049 #3091 #3092 #3103 #3104 #3105 #3107 #3123 #3125; a local tree, only #3125 needed a resolution in README and the sparse.rs test module); the base alone gave 2608 passed, 0 failed, 49 ignored with the same 27 SKIPPED lines (21 no wave64, 3 refused per-lane f16/f32 forms, 2 heap windows opt-in, 1 driver cache needs Developer Mode). This PR alone was merged onto the base, built (cargo build --workspace, then release), its modules' lib tests run (debug), and smoke-run once for 60 s (scripts/smoke.ps1, retail title, front end, XCL_PREPARE=0). The smoke numbers are for my local merged tree, not a clean-head block for the description. Load runs: 150 s, the save loaded with A presses, XCL_PREPARE=0, after one warm-up, one run per arm; on this 10 GB card main is over the video memory budget while loading, and presents stop after 94-125 s in every arm.

AI use: Claude Code (Claude Opus 5.5 and Claude Fable 5.2) ran the builds, tests and title runs, reviewed the diff and wrote this; the code points cited were checked against the merged tree.

<!-- greyfinch-sync:ivall/xcl:comment:7250621541 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3049#issuecomment-7250621541). Originally posted by [vasanex](https://github.com/vasanex) on 2026-11-29T04:23:16Z. --- ```text merge-check base: fa204595a488c60c6c5f905244f0172072c9c2a9 head: a209ad1f0ea884676a65a16a6769d5a0025a7343 merge: clean (clashes with #3050 in host.rs: whichever lands second needs a rebase) build: cargo build --workspace -> ok tests: not run alone; in a stack of 11 of your PRs on this base: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2650 passed, 1 failed, 49 ignored; SKIPPED: 27 lines; failing: #3123's private_physical_pages_reach_the_gpu_on_mapping only. Alone: gpu::recomp::dxc:: heap_count:: hle::kernelx:: host:: 102 passed, 0 failed, 1 ignored. review: the counters are opt-in, but the #[global_allocator] wrapper is installed for every run (lib.rs:43); off, it costs one relaxed load per allocation. Notes: the site table is a static of 65,536 slots (heap_count.rs:37/52), about 7 MiB of writable image even when off (not measured here) - could be allocated in mode 1 only; mode 1 takes a global spinlock without backoff inside the allocator (:76), a hang if the holder is suspended (thread dumps, SuspendThread); comments in host.rs/lib.rs name mode 1 only. Mode 2 was run in three 150 s load runs (see performance); mode 1 was not exercised. performance: 60 s smoke of the merged tree (1b59ba0d), switch off: 1687 frames, peak commit 17239 MB, 0 removals, 0 crashes (base 1629-1689 frames, 16065-16596 MB; commit is noisy in this series, a tree identical to the base showed 19938 MB). Mode 2 in three 150 s load runs (this PR alone, with #3091, with #3047): a line every 20 s, XCL's own heap 993 -> 2150 MB over a load, 0 removals, 0 crashes, 2824 / 2277 / 2073 frames against 2014 on the base without the PR - no cost visible. In two of the three runs the activity lines (all of them, not only the heap line) stopped 20-25 s before the end while the process ran on; the two runs without the counter logged to the end. Three runs do not show whether that is the counter. verdict: not yet: this check is on fa204595 and stale - needs a rerun on current main; open from review: the "not kept: table full" label counts cumulative insertion misses (bmjask). The two cache findings do not apply on main since e62a02ff (#3447); still a draft; description check red hardware / tool and model: RTX 3080 10 GB 621.40, Ryzen 9 7950X, Windows 11 26200 / Claude Code (Claude Opus 5.5, Claude Fable 5.2) ``` Edited 2026-11-29 (twice): first to "not yet" after Kalmarv's merge-check, then corrected - see my two replies below. How this was run: the suite ran once on the 11 of your PRs that build on this base, merged together (#3047 #3048 #3049 #3091 #3092 #3103 #3104 #3105 #3107 #3123 #3125; a local tree, only #3125 needed a resolution in README and the `sparse.rs` test module); the base alone gave 2608 passed, 0 failed, 49 ignored with the same 27 `SKIPPED` lines (21 no wave64, 3 refused per-lane f16/f32 forms, 2 heap windows opt-in, 1 driver cache needs Developer Mode). This PR alone was merged onto the base, built (`cargo build --workspace`, then release), its modules' lib tests run (debug), and smoke-run once for 60 s (`scripts/smoke.ps1`, retail title, front end, `XCL_PREPARE=0`). The smoke numbers are for my local merged tree, not a clean-head block for the description. Load runs: 150 s, the save loaded with A presses, `XCL_PREPARE=0`, after one warm-up, one run per arm; on this 10 GB card main is over the video memory budget while loading, and presents stop after 94-125 s in every arm. AI use: Claude Code (Claude Opus 5.5 and Claude Fable 5.2) ran the builds, tests and title runs, reviewed the diff and wrote this; the code points cited were checked against the merged tree.
thehollowedone commented 2026-11-29 04:28:01 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-29T04:28:01Z.


Independent Windows check of #3049 head a209ad1f against its parent 765b2c5b. RTX 3080 Ti / NVIDIA 621.35, Ryzen 7 9800X3D, Windows 11 build 26300, rustc 1.99.1, DXC 1.8.2502.11. Both checkouts were clean for the results below.

cargo build --offline --locked -j 4 --workspace passed on the PR head. cargo test --offline --locked -j 4 --workspace --no-fail-fast -- --test-threads=4: 2,596 passed, 3 failed, 49 ignored; 26 GPU SKIPPED notices (those skips are included in Cargo's pass counts). The failing cases were console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk, a_preparation_worker_also_builds_a_split_programs_whole_form, and test_title_draws_with_a_root_signature_under_the_debug_layer. I reran the first two separately on the exact parent; both failed there too (0 passed, 1 failed each, no skips). The debug-layer title test passed alone on the PR head (1 passed, 0 failed, no skips), so its full-suite failure is not attributed to this change. These results do not establish a passing whole suite or merge readiness.

The new XCL_HEAP_COUNT=2 test currently calls added(..., false) directly. I added a disposable child-isolated test that sets the environment before the test process starts, then uses the production Counting allocator to allocate, reallocate and free a 2→3 MiB buffer. It checked exact byte/count deltas, absence of a retained stack site, and the two-line counters-only report. cargo test --offline --locked -j 4 -p xcl --lib heap_count::tests::counters_only_mode_uses_the_actual_allocator_path -- --exact --test-threads=1 --nocapture: 1 passed, 0 failed, 0 ignored, no skip. This is a test-only candidate, not part of the clean PR-head suite.

Passing test-only candidate diff
diff --git a/crates/xcl/src/heap_count.rs b/crates/xcl/src/heap_count.rs
index be4538e0..aa147eff 100644
--- a/crates/xcl/src/heap_count.rs
+++ b/crates/xcl/src/heap_count.rs
@@ -401,6 +401,44 @@ mod tests {
         removed(p, 3 << 20, false);
     }
 
+    #[test]
+    fn counters_only_mode_uses_the_actual_allocator_path() {
+        const CHILD: &str = "XCL_TEST_HEAP_COUNTERS_CHILD";
+        if std::env::var_os(CHILD).is_none() {
+            let output = std::process::Command::new(std::env::current_exe().unwrap())
+                .args(["--exact", "heap_count::tests::counters_only_mode_uses_the_actual_allocator_path", "--nocapture"])
+                .env(CHILD, "1")
+                .env("XCL_HEAP_COUNT", "2")
+                .output().unwrap();
+            assert!(output.status.success(), "{}{}", String::from_utf8_lossy(&output.stdout), String::from_utf8_lossy(&output.stderr));
+            return;
+        }
+        assert!(on());
+        assert!(!detailed());
+        let layout = Layout::from_size_align(2 << 20, 16).unwrap();
+        let c = class(layout.size());
+        let before_bytes = BYTES[c].load(Ordering::Relaxed);
+        let before_count = COUNT[c].load(Ordering::Relaxed);
+        unsafe {
+            let p = Counting.alloc(layout);
+            assert!(!p.is_null());
+            assert_eq!(BYTES[c].load(Ordering::Relaxed), before_bytes + layout.size());
+            assert_eq!(COUNT[c].load(Ordering::Relaxed), before_count + 1);
+            assert!(locked(|t| t.iter().all(|s| s.ptr != p as usize)));
+            let q = Counting.realloc(p, layout, 3 << 20);
+            assert!(!q.is_null());
+            assert_eq!(BYTES[c].load(Ordering::Relaxed), before_bytes + (3 << 20));
+            assert_eq!(COUNT[c].load(Ordering::Relaxed), before_count + 1);
+            assert!(locked(|t| t.iter().all(|s| s.ptr != q as usize)));
+            let rows = lines(2).unwrap();
+            assert_eq!(rows.len(), 2, "counters-only mode must skip detailed heap walks");
+            drop(rows);
+            Counting.dealloc(q, Layout::from_size_align(3 << 20, 16).unwrap());
+        }
+        assert_eq!(BYTES[c].load(Ordering::Relaxed), before_bytes);
+        assert_eq!(COUNT[c].load(Ordering::Relaxed), before_count);
+    }
+
     #[test]
     fn a_large_allocation_is_kept_with_its_place_until_it_is_freed() {
         // (straight at the table: the switch is the process's, read once)

I did not run paired clean-commit title smoke, a long memory-attribution run, AMD or Intel. AI use: Codex (GPT-6.2 Sol) ran the tests and wrote this report; Codex (GPT-6.2 Sol) independently reviewed the counters-only path.

<!-- greyfinch-sync:ivall/xcl:comment:7250668973 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3049#issuecomment-7250668973). Originally posted by [thehollowedone](https://github.com/thehollowedone) on 2026-11-29T04:28:01Z. --- Independent Windows check of [#3049 head `a209ad1f`](https://github.com/xcl-dev/xcl/commit/a209ad1f0ea884676a65a16a6769d5a0025a7343) against its [parent `765b2c5b`](https://github.com/xcl-dev/xcl/commit/765b2c5bfff6754e8c9886a73e188a86aca3c64c). RTX 3080 Ti / NVIDIA 621.35, Ryzen 7 9800X3D, Windows 11 build 26300, rustc 1.99.1, DXC 1.8.2502.11. Both checkouts were clean for the results below. `cargo build --offline --locked -j 4 --workspace` passed on the PR head. `cargo test --offline --locked -j 4 --workspace --no-fail-fast -- --test-threads=4`: **2,596 passed, 3 failed, 49 ignored; 26 GPU SKIPPED notices** (those skips are included in Cargo's pass counts). The failing cases were `console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk`, `a_preparation_worker_also_builds_a_split_programs_whole_form`, and `test_title_draws_with_a_root_signature_under_the_debug_layer`. I reran the first two separately on the exact parent; both failed there too (0 passed, 1 failed each, no skips). The debug-layer title test passed alone on the PR head (1 passed, 0 failed, no skips), so its full-suite failure is not attributed to this change. These results do **not** establish a passing whole suite or merge readiness. The new `XCL_HEAP_COUNT=2` test currently calls `added(..., false)` directly. I added a disposable child-isolated test that sets the environment before the test process starts, then uses the production `Counting` allocator to allocate, reallocate and free a 2→3 MiB buffer. It checked exact byte/count deltas, absence of a retained stack site, and the two-line counters-only report. `cargo test --offline --locked -j 4 -p xcl --lib heap_count::tests::counters_only_mode_uses_the_actual_allocator_path -- --exact --test-threads=1 --nocapture`: **1 passed, 0 failed, 0 ignored, no skip**. This is a test-only candidate, not part of the clean PR-head suite. <details><summary>Passing test-only candidate diff</summary> ```diff diff --git a/crates/xcl/src/heap_count.rs b/crates/xcl/src/heap_count.rs index be4538e0..aa147eff 100644 --- a/crates/xcl/src/heap_count.rs +++ b/crates/xcl/src/heap_count.rs @@ -401,6 +401,44 @@ mod tests { removed(p, 3 << 20, false); } + #[test] + fn counters_only_mode_uses_the_actual_allocator_path() { + const CHILD: &str = "XCL_TEST_HEAP_COUNTERS_CHILD"; + if std::env::var_os(CHILD).is_none() { + let output = std::process::Command::new(std::env::current_exe().unwrap()) + .args(["--exact", "heap_count::tests::counters_only_mode_uses_the_actual_allocator_path", "--nocapture"]) + .env(CHILD, "1") + .env("XCL_HEAP_COUNT", "2") + .output().unwrap(); + assert!(output.status.success(), "{}{}", String::from_utf8_lossy(&output.stdout), String::from_utf8_lossy(&output.stderr)); + return; + } + assert!(on()); + assert!(!detailed()); + let layout = Layout::from_size_align(2 << 20, 16).unwrap(); + let c = class(layout.size()); + let before_bytes = BYTES[c].load(Ordering::Relaxed); + let before_count = COUNT[c].load(Ordering::Relaxed); + unsafe { + let p = Counting.alloc(layout); + assert!(!p.is_null()); + assert_eq!(BYTES[c].load(Ordering::Relaxed), before_bytes + layout.size()); + assert_eq!(COUNT[c].load(Ordering::Relaxed), before_count + 1); + assert!(locked(|t| t.iter().all(|s| s.ptr != p as usize))); + let q = Counting.realloc(p, layout, 3 << 20); + assert!(!q.is_null()); + assert_eq!(BYTES[c].load(Ordering::Relaxed), before_bytes + (3 << 20)); + assert_eq!(COUNT[c].load(Ordering::Relaxed), before_count + 1); + assert!(locked(|t| t.iter().all(|s| s.ptr != q as usize))); + let rows = lines(2).unwrap(); + assert_eq!(rows.len(), 2, "counters-only mode must skip detailed heap walks"); + drop(rows); + Counting.dealloc(q, Layout::from_size_align(3 << 20, 16).unwrap()); + } + assert_eq!(BYTES[c].load(Ordering::Relaxed), before_bytes); + assert_eq!(COUNT[c].load(Ordering::Relaxed), before_count); + } + #[test] fn a_large_allocation_is_kept_with_its_place_until_it_is_freed() { // (straight at the table: the switch is the process's, read once) ``` </details> I did not run paired clean-commit title smoke, a long memory-attribution run, AMD or Intel. AI use: Codex (GPT-6.2 Sol) ran the tests and wrote this report; Codex (GPT-6.2 Sol) independently reviewed the counters-only path.
thehollowedone commented 2026-11-29 05:40:22 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-29T05:40:22Z.


At #3049 head a209ad1f, the detailed heap report labels UNTRACKED as large allocations “not kept: table full.” The counter actually increments when a kept large or sampled-small allocation misses its 64-slot probe window, and it never decrements on free. An otherwise empty table given 65 kept addresses with the same initial slot would record one miss; that count would remain after all 65 were freed. It does not establish that the table is full or that a large allocation is still live.

For memory investigations, I suggest reporting this separately as cumulative site insertion misses after 64 probes, including both size groups. The small logging-only diff below also corrects the counter comment. It does not change allocation behavior, the counter, or the memory budget. This is a source review and candidate wording; I did not run a build or synthetic collision test for it.

Candidate diagnostic wording diff
diff --git a/crates/xcl/src/heap_count.rs b/crates/xcl/src/heap_count.rs
index be4538e0..124ca26e 100644
--- a/crates/xcl/src/heap_count.rs
+++ b/crates/xcl/src/heap_count.rs
@@ -51,7 +51,7 @@ struct Sites(std::cell::UnsafeCell<[Site; SLOTS]>);
 unsafe impl Sync for Sites {}
 static SITES: Sites = Sites(std::cell::UnsafeCell::new([Site { ptr: 0, size: 0, frames: [0; FRAMES] }; SLOTS]));
 static LOCK: AtomicBool = AtomicBool::new(false);
-/// large allocations the full table had no slot for
+/// cumulative large or sampled-small site insertions that missed within 64 probes
 static UNTRACKED: AtomicUsize = AtomicUsize::new(0);
 
 fn class(size: usize) -> usize {
@@ -333,11 +333,10 @@ pub fn lines(top: usize) -> Option<Vec<String>> {
         let total: usize = sites.iter().map(|s| s.1 .0).sum();
         out.push(if large {
             format!(
-                "XCL's own heap, large allocations: {} MB in {} from {} places ({} not kept: table full); xcl.exe at {base:#x}",
+                "XCL's own heap, large allocations: {} MB in {} from {} places; xcl.exe at {base:#x}",
                 total >> 20,
                 alive.iter().filter(|s| s.size >= LARGE).count(),
-                sites.len(),
-                UNTRACKED.load(Ordering::Relaxed)
+                sites.len()
             )
         } else {
             format!("XCL's own heap, small allocations: about {} MB, from 1 in {SAMPLE} of them kept ({} from {} places)", total >> 20, sites.iter().map(|s| s.1 .1).sum::<usize>(), sites.len())
@@ -351,6 +350,10 @@ pub fn lines(top: usize) -> Option<Vec<String>> {
             }
         }
     }
+    let missed = UNTRACKED.load(Ordering::Relaxed);
+    if missed != 0 {
+        out.push(format!("XCL's own heap: {missed} cumulative site insertion misses after 64 probes (large and sampled-small allocations)"));
+    }
     Some(out)
 }
 

AI use: Codex (GPT-6.2 Sol) checked the source and wrote this report and wording diff; Codex (GPT-6.2 Astra) independently reviewed the counter semantics.

<!-- greyfinch-sync:ivall/xcl:comment:7251391391 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3049#issuecomment-7251391391). Originally posted by [thehollowedone](https://github.com/thehollowedone) on 2026-11-29T05:40:22Z. --- At [#3049 head `a209ad1f`](https://github.com/xcl-dev/xcl/commit/a209ad1f0ea884676a65a16a6769d5a0025a7343), the detailed heap report labels `UNTRACKED` as large allocations “not kept: table full.” The counter actually increments when a kept **large or sampled-small** allocation misses its 64-slot probe window, and it never decrements on free. An otherwise empty table given 65 kept addresses with the same initial slot would record one miss; that count would remain after all 65 were freed. It does not establish that the table is full or that a large allocation is still live. For memory investigations, I suggest reporting this separately as **cumulative site insertion misses after 64 probes**, including both size groups. The small logging-only diff below also corrects the counter comment. It does not change allocation behavior, the counter, or the memory budget. This is a source review and candidate wording; I did not run a build or synthetic collision test for it. <details><summary>Candidate diagnostic wording diff</summary> ```diff diff --git a/crates/xcl/src/heap_count.rs b/crates/xcl/src/heap_count.rs index be4538e0..124ca26e 100644 --- a/crates/xcl/src/heap_count.rs +++ b/crates/xcl/src/heap_count.rs @@ -51,7 +51,7 @@ struct Sites(std::cell::UnsafeCell<[Site; SLOTS]>); unsafe impl Sync for Sites {} static SITES: Sites = Sites(std::cell::UnsafeCell::new([Site { ptr: 0, size: 0, frames: [0; FRAMES] }; SLOTS])); static LOCK: AtomicBool = AtomicBool::new(false); -/// large allocations the full table had no slot for +/// cumulative large or sampled-small site insertions that missed within 64 probes static UNTRACKED: AtomicUsize = AtomicUsize::new(0); fn class(size: usize) -> usize { @@ -333,11 +333,10 @@ pub fn lines(top: usize) -> Option<Vec<String>> { let total: usize = sites.iter().map(|s| s.1 .0).sum(); out.push(if large { format!( - "XCL's own heap, large allocations: {} MB in {} from {} places ({} not kept: table full); xcl.exe at {base:#x}", + "XCL's own heap, large allocations: {} MB in {} from {} places; xcl.exe at {base:#x}", total >> 20, alive.iter().filter(|s| s.size >= LARGE).count(), - sites.len(), - UNTRACKED.load(Ordering::Relaxed) + sites.len() ) } else { format!("XCL's own heap, small allocations: about {} MB, from 1 in {SAMPLE} of them kept ({} from {} places)", total >> 20, sites.iter().map(|s| s.1 .1).sum::<usize>(), sites.len()) @@ -351,6 +350,10 @@ pub fn lines(top: usize) -> Option<Vec<String>> { } } } + let missed = UNTRACKED.load(Ordering::Relaxed); + if missed != 0 { + out.push(format!("XCL's own heap: {missed} cumulative site insertion misses after 64 probes (large and sampled-small allocations)")); + } Some(out) } ``` </details> AI use: Codex (GPT-6.2 Sol) checked the source and wrote this report and wording diff; Codex (GPT-6.2 Astra) independently reviewed the counter semantics.
Kalmarv commented 2026-11-29 22:38:30 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-29T22:38:30Z.


merge-check
base: beeb81be4b (mergeable cleanly on current main)
head: a209ad1f0e
merge: clean
build: cargo check -p xcl --all-targets -> ok
tests: non-GPU lib tests of touched modules (heap_count 5 passed, host 2 passed). Full workspace suite and GPU tests not run.
review: (1) Adding note_heap to crates/xcl/src/gpu/recomp/dxc.rs (which is in build.rs TRANSLATOR_SOURCES) changes XCL_TRANSLATOR_SOURCE_ID, invalidating the translated-DXIL cache and native preparation key for all users on first run (measured +76 s to first present on a warm cache: 140.9 vs 64.4 s; driver blobs still hit). Suggest registering the DXC heap from outside dxc.rs. (2) XCL_HEAP_COUNT is not in shaders.rs warm_settings() ignore list, so enabling the diagnostic changes the warm settings key. Allocator implementation itself looks sound (one relaxed load when off).
performance: one relaxed load per allocation when off, plus the one-time cache invalidation noted above. Tested in a combined 600 s retail run on main beeb81be + 13 PRs (warm cache, defaults) vs baseline: presents/2 s 3.27 vs 3.29, peak commit 35,016 vs 35,767 MB, local video memory 14.19-14.76 vs 14.32-14.95 GB, 0 pipeline waits >= 1 s vs 5, 0 device removals, 0 crashes. Combined result across all 13 PRs, not isolated to this PR.
verdict: not yet: dxc.rs edit invalidates translated-DXIL caches; XCL_HEAP_COUNT missing from warm_settings() ignore list; full suite not run.
hardware / tool and model: NVIDIA GeForce RTX 5070 Ti, driver 32.0.16.1074, AMD Ryzen 9 9950X, Windows 11 Pro 26200 / Claude Code (claude-opus-5-5)

<!-- greyfinch-sync:ivall/xcl:comment:7263834779 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3049#issuecomment-7263834779). Originally posted by [Kalmarv](https://github.com/Kalmarv) on 2026-11-29T22:38:30Z. --- merge-check base: beeb81be4b7e96fce26a54615be9ee170474c19e (mergeable cleanly on current main) head: a209ad1f0ea884676a65a16a6769d5a0025a7343 merge: clean build: cargo check -p xcl --all-targets -> ok tests: non-GPU lib tests of touched modules (heap_count 5 passed, host 2 passed). Full workspace suite and GPU tests not run. review: (1) Adding note_heap to crates/xcl/src/gpu/recomp/dxc.rs (which is in build.rs TRANSLATOR_SOURCES) changes XCL_TRANSLATOR_SOURCE_ID, invalidating the translated-DXIL cache and native preparation key for all users on first run (measured +76 s to first present on a warm cache: 140.9 vs 64.4 s; driver blobs still hit). Suggest registering the DXC heap from outside dxc.rs. (2) XCL_HEAP_COUNT is not in shaders.rs warm_settings() ignore list, so enabling the diagnostic changes the warm settings key. Allocator implementation itself looks sound (one relaxed load when off). performance: one relaxed load per allocation when off, plus the one-time cache invalidation noted above. Tested in a combined 600 s retail run on main beeb81be + 13 PRs (warm cache, defaults) vs baseline: presents/2 s 3.27 vs 3.29, peak commit 35,016 vs 35,767 MB, local video memory 14.19-14.76 vs 14.32-14.95 GB, 0 pipeline waits >= 1 s vs 5, 0 device removals, 0 crashes. Combined result across all 13 PRs, not isolated to this PR. verdict: not yet: dxc.rs edit invalidates translated-DXIL caches; XCL_HEAP_COUNT missing from warm_settings() ignore list; full suite not run. hardware / tool and model: NVIDIA GeForce RTX 5070 Ti, driver 32.0.16.1074, AMD Ryzen 9 9950X, Windows 11 Pro 26200 / Claude Code (claude-opus-5-5)
bmjask commented 2026-11-29 22:45:56 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-11-29T22:45:56Z.

Review: COMMENTED


Critical review of current head a209ad1f. Diagnostic accuracy issue: the detailed heap report calls UNTRACKED large allocations 'not kept: table full', but the counter is a cumulative insertion miss after a 64-slot probe and can include sampled-small allocations; it remains nonzero after those allocations are freed. This can falsely explain current commit growth. Please label it as cumulative site insertion misses (both size groups), or maintain a true live count. The source analysis includes a 65-address example. This is an instrumentation fix, not a RAM reduction. No local Windows run.

<!-- greyfinch-sync:ivall/xcl:review:6105200570 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3049#pullrequestreview-6105200570). Originally posted by [bmjask](https://github.com/bmjask) on 2026-11-29T22:45:56Z. **Review:** COMMENTED --- Critical review of current head `a209ad1f`. **Diagnostic accuracy issue:** the detailed heap report calls `UNTRACKED` large allocations 'not kept: table full', but the counter is a cumulative insertion miss after a 64-slot probe and can include sampled-small allocations; it remains nonzero after those allocations are freed. This can falsely explain current commit growth. Please label it as cumulative site insertion misses (both size groups), or maintain a true live count. The [source analysis](https://github.com/xcl-dev/xcl/pull/3049) includes a 65-address example. This is an instrumentation fix, not a RAM reduction. No local Windows run.
vasanex commented 2026-11-29 23:00:20 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by vasanex on 2026-11-29T23:00:20Z.


@Kalmarv both findings hold at a209ad1f, and they change my verdict from yesterday's merge-check (comment) from "safe to merge" to "not yet". I had missed both.

  • Translator source id. The PR's one line in gpu/recomp/dxc.rs (heap_count::note_heap("DXC", …)) is in a file build.rs lists in TRANSLATOR_SOURCES, so the translated-DXIL cache of every user is rebuilt once after the merge, for a diagnostic that is off by default. Confirmed by reading the tree; I did not measure the cost (your +76 s to the first present on a warm cache).
  • Warm settings key. XCL_HEAP_COUNT is not in warm_settings()'s ignore list in shaders.rs, so turning the counter on changes the warm key. My three mode-2 load runs had the switch set, so their frame counts were taken under another warm key than the base run I compared them with – that comparison ("no cost visible") is weaker than I wrote.

What I reported about the allocator itself (one relaxed load per allocation when off, the 65,536-slot site table, the spinlock in mode 1) stands. I have edited the verdict line of my merge-check to match.

Not tested: a rerun with the heap registered from outside dxc.rs and the switch in the ignore list.

RTX 3080 10 GB (621.40), Ryzen 9 7950X, Windows 11 26200. AI use: Claude Code (Claude Fable 5.2) read the tree and wrote this; read and posted by me.

<!-- greyfinch-sync:ivall/xcl:comment:7264117740 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3049#issuecomment-7264117740). Originally posted by [vasanex](https://github.com/vasanex) on 2026-11-29T23:00:20Z. --- @Kalmarv both findings hold at `a209ad1f`, and they change my verdict from yesterday's merge-check ([comment](https://github.com/xcl-dev/xcl/pull/3049#issuecomment-7250621541)) from "safe to merge" to "not yet". I had missed both. - **Translator source id.** The PR's one line in `gpu/recomp/dxc.rs` (`heap_count::note_heap("DXC", …)`) is in a file `build.rs` lists in `TRANSLATOR_SOURCES`, so the translated-DXIL cache of every user is rebuilt once after the merge, for a diagnostic that is off by default. Confirmed by reading the tree; I did not measure the cost (your +76 s to the first present on a warm cache). - **Warm settings key.** `XCL_HEAP_COUNT` is not in `warm_settings()`'s ignore list in `shaders.rs`, so turning the counter on changes the warm key. My three mode-2 load runs had the switch set, so their frame counts were taken under another warm key than the base run I compared them with – that comparison ("no cost visible") is weaker than I wrote. What I reported about the allocator itself (one relaxed load per allocation when off, the 65,536-slot site table, the spinlock in mode 1) stands. I have edited the verdict line of my merge-check to match. Not tested: a rerun with the heap registered from outside `dxc.rs` and the switch in the ignore list. RTX 3080 10 GB (621.40), Ryzen 9 7950X, Windows 11 26200. AI use: Claude Code (Claude Fable 5.2) read the tree and wrote this; read and posted by me.
vasanex commented 2026-11-29 23:26:39 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by vasanex on 2026-11-29T23:26:39Z.


Correction to my reply above – I checked the wrong tree.

I wrote that both of @Kalmarv's findings "hold at a209ad1f". They do in the PR's own tree and at the base of that merge-check (beeb81be), but not for this PR merged onto current main, which is what matters:

  • main since e62a02ff (#3447, merged 29 November 20:19Z) no longer lists gpu/recomp/dxc.rs in build.rs's TRANSLATOR_SOURCES, so the PR's one line there does not change the translator source id any more;
  • the same commit turned warm_settings() into an allow-list of translation switches, so XCL_HEAP_COUNT cannot change the warm key. (Only legacy_warm_settings, used to migrate a saved library, still has an ignore list.)

Read in a worktree of main 53e85fb1; nothing was run. So neither point is a reason against merging onto current main, and my change of verdict to "not yet" for those two reasons was wrong. What remains open from the reviews is @bmjask's point about the "not kept: table full" label (a cumulative miss count, not a live one), and that nobody has run the suite on this PR merged onto current main – my merge-check is on fa204595 and stale. I have edited its verdict line to say that instead.

AI use: Claude Code (Claude Fable 5.2) found the mistake and wrote this; read and posted by me.

<!-- greyfinch-sync:ivall/xcl:comment:7264464363 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3049#issuecomment-7264464363). Originally posted by [vasanex](https://github.com/vasanex) on 2026-11-29T23:26:39Z. --- Correction to my reply above – I checked the wrong tree. I wrote that both of @Kalmarv's findings "hold at `a209ad1f`". They do in the PR's own tree and at the base of that merge-check (`beeb81be`), but not for this PR merged onto **current** `main`, which is what matters: - `main` since `e62a02ff` (#3447, merged 29 November 20:19Z) no longer lists `gpu/recomp/dxc.rs` in `build.rs`'s `TRANSLATOR_SOURCES`, so the PR's one line there does not change the translator source id any more; - the same commit turned `warm_settings()` into an allow-list of translation switches, so `XCL_HEAP_COUNT` cannot change the warm key. (Only `legacy_warm_settings`, used to migrate a saved library, still has an ignore list.) Read in a worktree of `main` `53e85fb1`; nothing was run. So neither point is a reason against merging onto current `main`, and my change of verdict to "not yet" for those two reasons was wrong. What remains open from the reviews is @bmjask's point about the "not kept: table full" label (a cumulative miss count, not a live one), and that nobody has run the suite on this PR merged onto current `main` – my merge-check is on `fa204595` and stale. I have edited its verdict line to say that instead. AI use: Claude Code (Claude Fable 5.2) found the mistake and wrote this; read and posted by me.
tiagonleal commented 2026-11-30 12:11:49 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by tiagonleal on 2026-11-30T12:11:49Z.


Test report for the counters, from a world run. RTX 5070 Ti 16 GB (617.42), Ryzen 7 9800X3D, 32 GB RAM, this PR's head a209ad1f merged onto main 9dfbe3ea, release, XCL_HEAP_COUNT=2, a retail title with XCL_HEAP_WINDOWS=1 XCL_UMA_WINDOWS=16. One run of 330 s; it entered the world and ran to the time limit with no device removal.

About 60 s after world entry the counters give 2.47 GB for XCL's own Rust heap in 4.2 M allocations (0.92 GB under 4 KiB, 0.39 GB under 64 KiB, 0.78 GB under 1 MiB) and 0 MB for the title through the process heap.

Two other runs of the same binary without this PR put that next to the process heap as a whole:

  • A read-only VirtualQueryEx census of xcl.exe at 141 s: 39.3 GB private commit, of which 5.7 to 5.9 GB is 363 to 373 private read-write regions of about 16 MiB each. A second census at 157 s in another run gave the same split.
  • A local counters-only patch that prints HeapSummary for each heap of GetProcessHeaps (not submitted): the default process heap goes from 2.5 GB at 91 s to 5.1 GB at 114 s, which is world entry, is at 5.7 GB allocated and 6.2 GB committed at 157 s, and reaches 6.6 GB at 328 s.

So on this card about 3 GB of the default process heap in the world belongs to neither XCL's Rust heap nor the title. I have no call stacks for it; the D3D12 runtime and the NVIDIA driver are the callers left, and that part is a guess. It is one run per counter, so read the sizes as rough.

If mode 2 could also print the HeapSummary of the default heap (allocated and committed) on the memory by owner line, that line would explain about 6 of the roughly 10.5 GB it shows as other commit here. Mode 1 already walks that heap, and this would be the cheap version of it.

Also seen in the census and not explained by any owner: 788 private write-combined regions of 4 MiB, 3.2 GB in total.

AI use: Claude Code (Claude Opus 5.5 ran the runs, wrote the census script and the local patch and read the logs, Claude Fable 5.2 wrote this).

  • Tiago
<!-- greyfinch-sync:ivall/xcl:comment:7278093202 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3049#issuecomment-7278093202). Originally posted by [tiagonleal](https://github.com/tiagonleal) on 2026-11-30T12:11:49Z. --- Test report for the counters, from a world run. RTX 5070 Ti 16 GB (617.42), Ryzen 7 9800X3D, 32 GB RAM, this PR's head `a209ad1f` merged onto `main` `9dfbe3ea`, release, `XCL_HEAP_COUNT=2`, a retail title with `XCL_HEAP_WINDOWS=1 XCL_UMA_WINDOWS=16`. One run of 330 s; it entered the world and ran to the time limit with no device removal. About 60 s after world entry the counters give 2.47 GB for XCL's own Rust heap in 4.2 M allocations (0.92 GB under 4 KiB, 0.39 GB under 64 KiB, 0.78 GB under 1 MiB) and 0 MB for the title through the process heap. Two other runs of the same binary without this PR put that next to the process heap as a whole: - A read-only `VirtualQueryEx` census of xcl.exe at 141 s: 39.3 GB private commit, of which 5.7 to 5.9 GB is 363 to 373 private read-write regions of about 16 MiB each. A second census at 157 s in another run gave the same split. - A local counters-only patch that prints `HeapSummary` for each heap of `GetProcessHeaps` (not submitted): the default process heap goes from 2.5 GB at 91 s to 5.1 GB at 114 s, which is world entry, is at 5.7 GB allocated and 6.2 GB committed at 157 s, and reaches 6.6 GB at 328 s. So on this card about 3 GB of the default process heap in the world belongs to neither XCL's Rust heap nor the title. I have no call stacks for it; the D3D12 runtime and the NVIDIA driver are the callers left, and that part is a guess. It is one run per counter, so read the sizes as rough. If mode 2 could also print the `HeapSummary` of the default heap (allocated and committed) on the `memory by owner` line, that line would explain about 6 of the roughly 10.5 GB it shows as `other` commit here. Mode 1 already walks that heap, and this would be the cheap version of it. Also seen in the census and not explained by any owner: 788 private write-combined regions of 4 MiB, 3.2 GB in total. AI use: Claude Code (Claude Opus 5.5 ran the runs, wrote the census script and the local patch and read the logs, Claude Fable 5.2 wrote this). - Tiago
Foniass commented 2026-12-01 05:51:10 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:51:10Z.


Review (head a209ad1f, diff read, not a merge-check; draft, so not built or run):

  • About 7 MiB in the image whether or not it's on. The SITES table (heap_count.rs ~52, 65,536 x 112 B) sits in xcl.exe even without XCL_HEAP_COUNT, and writable image pages are probably charged to commit at load. Comparing peak commit with main, or allocating the table on first use in detailed mode, would settle it.
  • Realloc race in detailed mode (~193-197): removed(p) runs after System.realloc has freed p, so another thread that gets p first can lose its record (the description admits this).
  • The cost of mode 2 (two atomic adds per allocation on counters sharing about two cache lines, from every thread) isn't measured, and counting runs whenever XCL_HEAP_COUNT is set even without XCL_ACTIVITY, the only thing that prints the counters.
  • No full-suite run and no smoke runs for this head. The 4 failing CI tests (pipeline_library / warm_library) also failed on main's own run that day.

Fine: the title counter's add and subtract match (total == HeapSize(raw)), the variable is read without allocating, stacks are captured outside the lock, the diagnostics are their own PR, and with the counters off the cost is one relaxed load and a branch per allocation.

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

<!-- greyfinch-sync:ivall/xcl:comment:7302206605 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3049#issuecomment-7302206605). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T05:51:10Z. --- Review (head a209ad1f, diff read, not a merge-check; draft, so not built or run): - **About 7 MiB in the image whether or not it's on.** The `SITES` table (`heap_count.rs` ~52, 65,536 x 112 B) sits in `xcl.exe` even without `XCL_HEAP_COUNT`, and writable image pages are probably charged to commit at load. Comparing peak commit with main, or allocating the table on first use in detailed mode, would settle it. - **Realloc race in detailed mode** (~193-197): `removed(p)` runs after `System.realloc` has freed `p`, so another thread that gets `p` first can lose its record (the description admits this). - The cost of mode 2 (two atomic adds per allocation on counters sharing about two cache lines, from every thread) isn't measured, and counting runs whenever `XCL_HEAP_COUNT` is set even without `XCL_ACTIVITY`, the only thing that prints the counters. - No full-suite run and no smoke runs for this head. The 4 failing CI tests (`pipeline_library` / `warm_library`) also failed on main's own run that day. Fine: the title counter's add and subtract match (`total` == `HeapSize(raw)`), the variable is read without allocating, stacks are captured outside the lock, the diagnostics are their own PR, and with the counters off the cost is one relaxed load and a branch per allocation. AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Foniass commented 2026-12-01 17:13:09 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T17:13:09Z.


Test report (not a merge-check: draft, PR description red)
base: b2b1f109d2
head: a209ad1f0e
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2907 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none
review: not repeated here; my review of this same head is at https://github.com/xcl-dev/xcl/pull/3049#issuecomment-7302206605, and its findings stand. This run adds what reading couldn't: whether the change merges, builds and passes the whole suite on current main.
performance: no smoke run.
assessment: merges, builds and passes the whole suite on current main (0 failed, its new tests included); the findings in my review stand
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5

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

<!-- greyfinch-sync:ivall/xcl:comment:7318947135 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3049#issuecomment-7318947135). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T17:13:09Z. --- Test report (not a merge-check: draft, `PR description` red) base: b2b1f109d27e746a62ec95b04dd1f9924452e682 head: a209ad1f0ea884676a65a16a6769d5a0025a7343 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2907 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none review: not repeated here; my review of this same head is at https://github.com/xcl-dev/xcl/pull/3049#issuecomment-7302206605, and its findings stand. This run adds what reading couldn't: whether the change merges, builds and passes the whole suite on current main. performance: no smoke run. assessment: merges, builds and passes the whole suite on current main (0 failed, its new tests included); the findings in my review stand hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5 AI-written and posted by Foniass without a human check of each point.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3049:upstream-pr/3049'
git switch 'upstream-pr/3049'

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