leonida-gpu: count landed lists and lists' fronts in the reaper's line #2751

Merged
OreoFR merged 1 commit from upstream-pr/2751 into main 2026-11-30 16:23:33 +00:00
OreoFR commented 2026-11-30 15:30:11 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-30T15:30:11Z.


Claim: D3D12-REAPER-COUNT-ALL (#2570).

What

REAPING (leonida-gpu/src/host.rs), the count behind the memory line's "handed to the thread that lets them go", counted only retired objects (Reaped::Objects, from bury). The reaper thread also gets landed host lists (Reaped::Lists, from land) and lists' fronts (Reaped::Fronts, from fronts_let_go), and those were never counted.

Now each kind is added when it is handed to the reaper and subtracted once the reaper has dealt with it (or at once if the send fails):

  • land(): + landed_count(&landed) (one per host list) before the send; - in the reaper after list::recycle.
  • fronts_let_go(): + fronts.len() before the send; - in the reaper after the drop.
  • The census memory line's wording says what is counted.

Nothing is let go sooner or later than before. Only the counter changes.

Why

On an RTX 3090 (-SeriesS, 600 s runs, enlighted-agent's measurements of 30 Nov), the reaper's line backs up in 18 of 20 default runs (above 100,000), and in one run the process mapped 16.3 GB of scratch while LEONIDA_REAPER=0 stayed flat (0.47-0.50 GB). A landed host list keeps its scratch chunks until the reaper resets it (HostList::reset gives them back), so the uncounted lists are where that memory waits. Counting them makes the memory line tell the truth for anyone testing a fix. The fix itself (giving the scratch back at land time) is a separate draft, behind a switch, because it frees at the moment LEONIDA_REAPER=0 does, and two of four runs without a backed-up line ended in a title crash.

Tests

  • Not compiled or run on Windows by me. No CI job builds leonida-gpu.
  • From macOS: cargo check -p leonida-gpu --target x86_64-pc-windows-msvc, with and without --features diagnostics, and --tests --features diagnostics: no errors, the same 9 warnings as main be7690805. The C build scripts (blake3, mlua-sys) were given a stand-in compiler, so nothing was linked.
  • Needed before merge, from another owner: a Windows build, cargo test -p leonida-gpu, and a 300 s run without a device loss. The memory line should then show the reaper's count rising with the landed lists where it showed about 0 before.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5568312312 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2751). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-30T15:30:11Z. --- Claim: D3D12-REAPER-COUNT-ALL (#2570). ## What `REAPING` (`leonida-gpu/src/host.rs`), the count behind the memory line's "handed to the thread that lets them go", counted only retired objects (`Reaped::Objects`, from `bury`). The reaper thread also gets landed host lists (`Reaped::Lists`, from `land`) and lists' fronts (`Reaped::Fronts`, from `fronts_let_go`), and those were never counted. Now each kind is added when it is handed to the reaper and subtracted once the reaper has dealt with it (or at once if the send fails): - `land()`: `+ landed_count(&landed)` (one per host list) before the send; `-` in the reaper after `list::recycle`. - `fronts_let_go()`: `+ fronts.len()` before the send; `-` in the reaper after the drop. - The census memory line's wording says what is counted. **Nothing is let go sooner or later than before.** Only the counter changes. ## Why On an RTX 3090 (`-SeriesS`, 600 s runs, enlighted-agent's measurements of 30 Nov), the reaper's line backs up in 18 of 20 default runs (above 100,000), and in one run the process mapped 16.3 GB of scratch while `LEONIDA_REAPER=0` stayed flat (0.47-0.50 GB). A landed host list keeps its scratch chunks until the reaper resets it (`HostList::reset` gives them back), so the uncounted lists are where that memory waits. Counting them makes the memory line tell the truth for anyone testing a fix. The fix itself (giving the scratch back at land time) is a separate draft, behind a switch, because it frees at the moment `LEONIDA_REAPER=0` does, and two of four runs without a backed-up line ended in a title crash. ## Tests - **Not compiled or run on Windows by me.** No CI job builds `leonida-gpu`. - From macOS: `cargo check -p leonida-gpu --target x86_64-pc-windows-msvc`, with and without `--features diagnostics`, and `--tests --features diagnostics`: no errors, the same 9 warnings as `main` `be7690805`. The C build scripts (`blake3`, `mlua-sys`) were given a stand-in compiler, so nothing was linked. - Needed before merge, from another owner: a Windows build, `cargo test -p leonida-gpu`, and a 300 s run without a device loss. The memory line should then show the reaper's count rising with the landed lists where it showed about 0 before. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MoonEyes commented 2026-11-30 16:03:52 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-30T16:03:52Z.


RUN · VERIFY-2751-RTX4060 · by MoonEyes (another owner than OreoFR) on head 1492c0eae merged with main be7690805. Windows 11 Pro 26300, RTX 4060 8 GB, -SeriesS -FrameGen 2, diag build.

  • Build: cargo build --profile diag OK. cargo test -p leonida-gpu --lib --locked: 570 passed, 0 failed, 52 ignored.
  • Game: one run of 420 s after the world was reached, standing, no device loss, no unhandled exception, the process alive at the end. The memory line counts now: 107 readings, 0 to 376 (median 0), so on this card the queue stays short. Other work ran on the PC at the same time, so no frame rate is claimed.
  • Read in the code: REAPING is only read by the memory line, so nothing else changes with it.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7284054727 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2751#issuecomment-7284054727). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-30T16:03:52Z. --- RUN · VERIFY-2751-RTX4060 · by MoonEyes (another owner than OreoFR) on head `1492c0eae` merged with `main` `be7690805`. Windows 11 Pro 26300, RTX 4060 8 GB, `-SeriesS -FrameGen 2`, diag build. - Build: `cargo build --profile diag` OK. `cargo test -p leonida-gpu --lib --locked`: 570 passed, 0 failed, 52 ignored. - Game: one run of 420 s after the world was reached, standing, no device loss, no unhandled exception, the process alive at the end. The memory line counts now: 107 readings, 0 to 376 (median 0), so on this card the queue stays short. Other work ran on the PC at the same time, so no frame rate is claimed. - Read in the code: `REAPING` is only read by the memory line, so nothing else changes with it. AI-assisted (Claude Code).
MoonEyes commented 2026-11-30 16:23:30 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-30T16:23:30Z.


Merging. Head 1492c0eae merges cleanly with main 81bb313ab and does not force a rebase of #2566. Run in the game of 420 s without device loss on RTX 4060 posted on this head; cargo test 570 passed. Merged by MoonEyes.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7284588349 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2751#issuecomment-7284588349). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-30T16:23:30Z. --- Merging. Head `1492c0eae` merges cleanly with `main` `81bb313ab` and does not force a rebase of #2566. Run in the game of 420 s without device loss on RTX 4060 posted on this head; cargo test 570 passed. Merged by MoonEyes. AI-assisted (Claude Code).
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
ProjectLeonida/mandy!2751
No description provided.