Skip to content

gate: summary.json gets the run's memory peaks (D3D12-GATE-MEMORY-PEAKS) - #2810

Merged
MoonEyes merged 1 commit into
ProjectLeonida:mainfrom
TheGeogeo:d3d12-gate-memory-peaks
Dec 1, 2026
Merged

MoonEyes merged 1 commit into
ProjectLeonida:mainfrom
TheGeogeo:d3d12-gate-memory-peaks

Conversation

@TheGeogeo

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: D3D12-GATE-MEMORY-PEAKS (#2570 (comment))

What and why

Testers asked for memory figures in the gate's summary.json (#2782): without them they cannot use the gate daily. A memory pile-up has also taken a 3090's Windows down twice. This is the first of three PRs: the peaks here, then a safety stop, then a time series.

tools/game_gate.py now reads two lines the runtime already writes every 5 s in builds with diagnostics (the gate's builds):

  • the memory line (memory: N MB private (...; the PC has ... MB free and ... MB left to commit));
  • the video memory line (video memory as the system counts it, ...: the card's own: budget ... MB, in use ... MB, ...). This is DXGI's count for the process, so it works on any card.

From them it writes a memory block:

  • the private bytes at their most, and when;
  • the most of them in physical memory;
  • the least the PC had left to commit, and when;
  • the card's video memory in use at its most, and when, with the budget the system gave then;
  • the seconds spent over that budget;
  • the most of the PC's memory shared with the card in use.

A build without diagnostics gives source: null and no peaks. The five runtime strings it reads join the contract test, so a reworded line fails the test. docs/game_gate.md describes the block.

Tested

On Windows 11 Pro 10.0:

  • tests/test_game_gate.py: 23 tests OK. The two new ones (peaks and times from synthetic lines, including time over budget; no lines gives nulls) fail with main's game_gate.py.

  • The contract test finds the new strings in copystat.rs and host.rs.

  • The docs tests and scripts/check_no_game_data.py on the changed files are clean.

  • On a real run: I re-summarized a copy of a 124 s gate run from this week's ABBA validation (RTX 3080 10 GB, driver 32.0.16.2140, Series S profile). The block read 37 memory lines:

    • private 24,222 MB at most;
    • video memory 6,806 MB in use at most, against a budget of 8,835 MB, never over it;
    • shared memory 7,102 MB in use at most;
    • the PC had 267 MB left to commit at its lowest.

    A separate sampler on that run saw private bytes of 23 to 24 GB. nvidia-smi showed 7.4 to 7.8 GB, because it counts the whole card.

GPUs tested: NVIDIA GeForce RTX 3080 10 GB, driver 32.0.16.2140

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

Testers could not use the gate daily without memory figures, and a memory pile-up took a 3090's Windows
down twice. The parser now reads the runtime's memory line and video memory line (every 5 s in builds with
diagnostics) and writes a memory block: the private bytes at their most and when, the most of them in
physical memory, the least the PC had left to commit and when, the card's video memory in use at its most
and when with the budget then, the seconds over that budget, and the most shared memory in use. The video
memory is what the system counts for the process, so it works on any card. The five runtime strings it reads
join the contract test.
@OreoFR

OreoFR commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Verified by OreoFR on macOS 27.2.1, Apple M5, Python 3.12, head f806537a8, main b7a1be296. CPU only, no game.

MEASURED

  • Red (main + only this PR's tests/test_game_gate.py): 2 failed, 21 passed. The failures are the two new tests, test_memory_peaks_come_from_the_runtimes_memory_lines and test_a_build_without_memory_lines_gives_no_memory_peaks.
  • Green (main + this PR, merge-tree): 23 passed.

READ IN CODE

  • The phrases the parser reads exist on main where SOURCES says they are:
    • memory: … MB private (… MB of it in memory; the PC has … MB free and … MB left to commit); host copies… at leonida-gpu/src/copystat.rs:860-861;
    • h.log_video_memory("with the memory line") at copystat.rs:752;
    • video memory as the system counts it, …: the card's own: budget … MB, in use … MB at host.rs:13641.
      The contract test that passes on green covers the rest.
  • memory_block() returns all-None with source: None when a run has no memory lines (a build without diagnostics). That is the second new test.
  • vram_over_budget_s adds up each video line's interval to the next one while in-use is above budget. The last line has no successor, so time over budget after the final line isn't counted. That's at most one 5 s step, and it's fine for a peak summary; just worth knowing when reading short runs.

ASSUMED

  • The real 124 s run figures (24.2 GB private, 6.8 / 8.8 GB VRAM) are from your RTX 3080. Not reproduced here.

AI-assisted: Claude Code

@fiestorra

Copy link
Copy Markdown
Contributor

Verified on Windows, with the control that matters: the tests fail when the change is reverted.

Cherry-picked onto main d920d850d in a clean worktree, Python 3.13.14:

python -m pytest tests/test_game_gate.py -q with this pull request: 23 passed with tools/game_gate.py from main: 2 failed

So the new tests are tied to the change and not to each other's fixtures. No part of this needed a GPU, a display or game data, which is what the gate tests are built for.

What I could not test: the script against a real run folder - game-abba.ps1 drives one, and this machine has the game but not the gate harness the other contributors used, so the shape is proven and the run is not.

AI-assisted: yes - DeepSeek v4.1 (flash), applied and ran both arms on the machine above.

Written with an AI assistant.

@MoonEyes

MoonEyes commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Merging. Head f806537a8 merges cleanly with main aefb25084 and does not force a rebase of #2566. CI green on this head. Red/green by OreoFR (macOS) and fiestorra (Windows) on it; I ran it on main + PR (Windows, Python 3.14): 23 tests OK, the two new ones error without the change, docs tests OK. A parser of the runtime's own memory lines: nothing in the game changes, no in-game run needed. Merged by MoonEyes.

AI-assisted (Claude Code).

@MoonEyes
MoonEyes merged commit f918e51 into ProjectLeonida:main Dec 1, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants