tools: frame rate of a D3D12-runtime run by draws a frame, and two runs side by side (TOOLS-D3D12-RUN-FPS) #2594

Merged
owenjbendon-creator merged 3 commits from upstream-pr/2594 into main 2026-11-30 10:04:32 +00:00
owenjbendon-creator commented 2026-11-28 22:51:33 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by owenjbendon-creator on 2026-11-28T22:51:33Z.


Claimed in the coordination issue as: TOOLS-D3D12-RUN-FPS (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7246804950)

What and why

A game-run test compares two runs (#2464, part A), and two runs of the game never show the same scenes for the same time. Their plain medians then mislead: the run that spent its time in a busy street reads slower than the one that stood in a room, whatever was changed.

tools/d3d12_run_fps.py reads the frame line the D3D12 runtime logs every few seconds (d3d12/crates/leonida-gpu/src/host.rs: fps, ms a frame, preparing, copies, waiting on the GPU, copying back, draws a frame) from the launcher's log, and prints numbers only:

  • the samples in the world (the first bucket's lower bound, 1000 draws a frame by default, leaves out menus and loading screens);
  • the frame rate: median, slowest tenth, fastest tenth;
  • the medians of where a frame goes;
  • the median frame rate per bucket of draws a frame.

--compare <log B> puts a second run beside the first, bucket by bucket, and gives the change only for buckets with enough samples in both runs (--min-samples, 5 by default). --json prints the same numbers as JSON.

It never prints a log line, a program name, an address or the path of a log (not in an error message either), so its output can go in a RUN block or a pull request while the log stays on the machine that made it. Standard library only, run with python -I. It reads UTF-8 and UTF-16 logs (a PowerShell redirection writes UTF-16), strips terminal colour codes and skips a truncated last line. The pattern takes only what the runtime's format string writes (bounded lengths, nothing in front of the first number), so no other text in a log reads as a frame line.

This adds a tool and five lines to the Reporting section of docs/running.md. No runtime or translator code is touched.

An example of why the buckets matter (numbers only)

Two real runs of one save on one machine, with different builds of the layer:

A B
Plain median 15.6 fps 16.2 fps
Median draws a frame 5,132 7,676
3000-4999 draws 16.3 fps (48 samples) 24.6 fps (5)
5000-6999 draws 15.6 fps (44) 20.1 fps (22)
7000-8999 draws 16.1 fps (8) 16.9 fps (15)
9000+ draws 12.2 fps (20) 14.8 fps (27)

The plain medians say "the same". By bucket B is 51%, 29%, 5% and 21% faster: it had spent its time in busier scenes.

Tested

  • python -I tests/test_d3d12_run_fps.py: 16 tests on synthetic lines written in the shape of the runtime's format string (the frame line read field by field, other lines and colour codes ignored, a line cut short just before its end, a UTF-16 log, text that only looks like a frame line refused, menus left out, bucket edges, tenths by nearest rank, the whole text of one run, the comparison where plain medians mislead, the samples a bucket needs, a run at 0 fps not divided by, text and JSON agreeing, no log text and no path printed, bad options refused). No game files, no GPU.
  • On main the test file fails at import: the tool does not exist there.
  • Eight deliberate breakages of the tool (the tenth rounded down, menus counted, the path printed in an error, and so on) each fail a test.
  • python -I tests/test_text_write_line_endings.py: passes (the tool writes no file).
  • python -I scripts/check_no_game_data.py tools/d3d12_run_fps.py tests/test_d3d12_run_fps.py docs/running.md: clean.
  • Run by hand on real logs of D3D12-runtime runs (the example above).

Not tested: a log from a current main build of leonida.exe on this machine. The example logs are from builds of the same lineage with the same frame line; the regular expression follows the format string on main as of adfb3821a.

GPUs tested: none needed (no GPU code). The example runs were made on an NVIDIA GeForce RTX 3090, driver 610.88, Windows 10 Pro 22H2 (19045), Ryzen 7 9800X3D.

AI-assisted: yes (Claude Code, Claude Fable 5.2). A second, fresh session reviewed the diff before this was opened; what it found (thin assertions on the printed text, a typed path echoed in an error, an unbounded pattern, an option that could mislabel a bucket) is fixed in this one commit.

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)

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5545363947 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2594). Originally posted by [owenjbendon-creator](https://github.com/owenjbendon-creator) on 2026-11-28T22:51:33Z. --- Claimed in the coordination issue as: TOOLS-D3D12-RUN-FPS (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7246804950) ### What and why A game-run test compares two runs (#2464, part A), and two runs of the game never show the same scenes for the same time. Their plain medians then mislead: the run that spent its time in a busy street reads slower than the one that stood in a room, whatever was changed. `tools/d3d12_run_fps.py` reads the frame line the D3D12 runtime logs every few seconds (`d3d12/crates/leonida-gpu/src/host.rs`: fps, ms a frame, preparing, copies, waiting on the GPU, copying back, draws a frame) from the launcher's log, and prints numbers only: - the samples in the world (the first bucket's lower bound, 1000 draws a frame by default, leaves out menus and loading screens); - the frame rate: median, slowest tenth, fastest tenth; - the medians of where a frame goes; - the median frame rate per bucket of draws a frame. `--compare <log B>` puts a second run beside the first, bucket by bucket, and gives the change only for buckets with enough samples in both runs (`--min-samples`, 5 by default). `--json` prints the same numbers as JSON. It never prints a log line, a program name, an address or the path of a log (not in an error message either), so its output can go in a `RUN` block or a pull request while the log stays on the machine that made it. Standard library only, run with `python -I`. It reads UTF-8 and UTF-16 logs (a PowerShell redirection writes UTF-16), strips terminal colour codes and skips a truncated last line. The pattern takes only what the runtime's format string writes (bounded lengths, nothing in front of the first number), so no other text in a log reads as a frame line. This adds a tool and five lines to the Reporting section of `docs/running.md`. No runtime or translator code is touched. ### An example of why the buckets matter (numbers only) Two real runs of one save on one machine, with different builds of the layer: | | A | B | | --- | --- | --- | | Plain median | 15.6 fps | 16.2 fps | | Median draws a frame | 5,132 | 7,676 | | 3000-4999 draws | 16.3 fps (48 samples) | 24.6 fps (5) | | 5000-6999 draws | 15.6 fps (44) | 20.1 fps (22) | | 7000-8999 draws | 16.1 fps (8) | 16.9 fps (15) | | 9000+ draws | 12.2 fps (20) | 14.8 fps (27) | The plain medians say "the same". By bucket B is 51%, 29%, 5% and 21% faster: it had spent its time in busier scenes. ### Tested - `python -I tests/test_d3d12_run_fps.py`: 16 tests on synthetic lines written in the shape of the runtime's format string (the frame line read field by field, other lines and colour codes ignored, a line cut short just before its end, a UTF-16 log, text that only looks like a frame line refused, menus left out, bucket edges, tenths by nearest rank, the whole text of one run, the comparison where plain medians mislead, the samples a bucket needs, a run at 0 fps not divided by, text and JSON agreeing, no log text and no path printed, bad options refused). No game files, no GPU. - On `main` the test file fails at import: the tool does not exist there. - Eight deliberate breakages of the tool (the tenth rounded down, menus counted, the path printed in an error, and so on) each fail a test. - `python -I tests/test_text_write_line_endings.py`: passes (the tool writes no file). - `python -I scripts/check_no_game_data.py tools/d3d12_run_fps.py tests/test_d3d12_run_fps.py docs/running.md`: clean. - Run by hand on real logs of D3D12-runtime runs (the example above). Not tested: a log from a current `main` build of `leonida.exe` on this machine. The example logs are from builds of the same lineage with the same frame line; the regular expression follows the format string on `main` as of `adfb3821a`. GPUs tested: none needed (no GPU code). The example runs were made on an NVIDIA GeForce RTX 3090, driver 610.88, Windows 10 Pro 22H2 (19045), Ryzen 7 9800X3D. AI-assisted: yes (Claude Code, Claude Fable 5.2). A second, fresh session reviewed the diff before this was opened; what it found (thin assertions on the printed text, a typed path echoed in an error, an unbounded pattern, an option that could mislabel a bucket) is fixed in this one commit. ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
zmasi commented 2026-11-28 23:06:24 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T23:06:24Z.


#2594 | head 9f7587e193 (merged cleanly with main adfb3821a2) | python -I tests/test_d3d12_run_fps.py -v + live Windows PowerShell Out-File -Encoding unicode (UTF-16LE BOM + CRLF) --compare CLI probe + python -I tests/test_docs_cli_flags.py | red on main: ModuleNotFoundError: No module named 'd3d12_run_fps' (tools/d3d12_run_fps.py absent on main) | green on PR+main: 16 ran, OK (test_d3d12_run_fps.py), live PowerShell UTF-16LE BOM + CRLF --compare exited 0 (+25% bucket delta, 0 log-line or file-path leaks), 4 ran, OK (test_docs_cli_flags.py), 17 ran, OK (test_docs_links.py), and 5 ran, OK (test_docs_repo_paths.py) | Windows 11 (10.0.26200.9974), Python 3.12.10 | AI-assisted: yes

Audited 9f7587e193 (tools/d3d12_run_fps.py, tests/test_d3d12_run_fps.py, and docs/running.md) on Windows 11 — first execution of this PR — confirming FRAME_LINE matches the tracing::info! format string in d3d12/crates/leonida-gpu/src/host.rs field-for-field, strips ANSI colour sequences, handles both UTF-8 and Windows PowerShell UTF-16LE BOM + CRLF logs, redacts input paths on OSError, and never echoes raw log text. Also verified tests/test_ci_registration.py, tests/test_text_write_line_endings.py, tests/test_docs_encoding.py, and scripts/check_no_game_data.py.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7247203584 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2594#issuecomment-7247203584). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T23:06:24Z. --- #2594 | head 9f7587e1938504e7589c5b012a6eb9ebab712571 (merged cleanly with main adfb3821a2) | `python -I tests/test_d3d12_run_fps.py -v` + live Windows PowerShell `Out-File -Encoding unicode` (UTF-16LE BOM + CRLF) `--compare` CLI probe + `python -I tests/test_docs_cli_flags.py` | red on main: `ModuleNotFoundError: No module named 'd3d12_run_fps'` (`tools/d3d12_run_fps.py` absent on `main`) | green on PR+main: `16 ran, OK` (`test_d3d12_run_fps.py`), live PowerShell UTF-16LE BOM + CRLF `--compare` exited `0` (`+25%` bucket delta, `0` log-line or file-path leaks), `4 ran, OK` (`test_docs_cli_flags.py`), `17 ran, OK` (`test_docs_links.py`), and `5 ran, OK` (`test_docs_repo_paths.py`) | Windows 11 (`10.0.26200.9974`), Python 3.12.10 | AI-assisted: yes Audited `9f7587e193` (`tools/d3d12_run_fps.py`, `tests/test_d3d12_run_fps.py`, and `docs/running.md`) on Windows 11 — first execution of this PR — confirming `FRAME_LINE` matches the `tracing::info!` format string in `d3d12/crates/leonida-gpu/src/host.rs` field-for-field, strips ANSI colour sequences, handles both UTF-8 and Windows PowerShell UTF-16LE BOM + CRLF logs, redacts input paths on `OSError`, and never echoes raw log text. Also verified `tests/test_ci_registration.py`, `tests/test_text_write_line_endings.py`, `tests/test_docs_encoding.py`, and `scripts/check_no_game_data.py`.
TheGeogeo commented 2026-11-28 23:41:36 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-28T23:41:36Z.


Tested 9f7587e19 merged (no commit) with main aa918e5d9: Python 3.12.4, Rust 1.98.1, Windows 11 10.0.26300, CPU only (no game run). check_no_game_data.py is clean.

Blocker: the branch carries much more than this PR's topic. git log aa918e5d9..9f7587e19 lists 16 commits. Only the last one (9f7587e19, tools/d3d12_run_fps.py) is the TOOLS-D3D12-RUN-FPS item. The others are:

  • merges of #625, #1256, #1205, #1022 and #1001, plus bvh_index (BUILD-1533), check.py/build.py (TEST-CHECK-UNSUPPORTED-SKIP, TEST-CHECK-F16-FALLBACK) and an x64_recomp test fix;

  • three runtime changes in d3d12/crates/leonida-gpu, which the description does not mention:

    • bd06eb904: every host present is held to 0.9 of the recent mean interval. This is on by default (LEONIDA_PRESENT_SMOOTH unset gives 0.9), so it changes frame pacing for everyone.
    • c7fcf49a7: Reflex sleeps and markers under frame generation (LEONIDA_FG_MARKERS).
    • eaecc6ac1: A/B jitter lines.

    LEONIDA_PRESENT_SMOOTH and LEONIDA_FG_MARKERS are not documented in any .md at this head.

Merging this as is would land all of the above, including #625 and #1256 under another PR's name. Suggest rebasing it to the d3d12_run_fps commit alone, with the pacing changes as their own pull request.

What I measured on the merge, for the record:

  • Python: the 8 touched test files pass. The exception is test_progress_dashboard.py, whose one README failure (test_default_repo_is_the_one_the_readme_clones) is the same on plain main. With the tools back to main, all 8 fail (for test_d3d12_run_fps.py, the module does not exist).
  • Rust: cargo test -p leonida-gpu --lib --locked gives 517 passed and 0 failed on the merge, against 515 and 0 on main. The 2 new tests pass (fg::reflex_frame_tests::reflex_frames_follow_the_titles_events, smooth::tests::presents_are_held_to_a_fraction_of_the_running_mean). Warnings are unchanged (10). The pacing itself is not checked in the title.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7247599932 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2594#issuecomment-7247599932). Originally posted by [TheGeogeo](https://github.com/TheGeogeo) on 2026-11-28T23:41:36Z. --- Tested `9f7587e19` merged (no commit) with `main` `aa918e5d9`: Python 3.12.4, Rust 1.98.1, Windows 11 10.0.26300, CPU only (no game run). `check_no_game_data.py` is clean. **Blocker: the branch carries much more than this PR's topic.** `git log aa918e5d9..9f7587e19` lists 16 commits. Only the last one (`9f7587e19`, `tools/d3d12_run_fps.py`) is the TOOLS-D3D12-RUN-FPS item. The others are: - merges of #625, #1256, #1205, #1022 and #1001, plus `bvh_index` (BUILD-1533), `check.py`/`build.py` (TEST-CHECK-UNSUPPORTED-SKIP, TEST-CHECK-F16-FALLBACK) and an `x64_recomp` test fix; - three runtime changes in `d3d12/crates/leonida-gpu`, which the description does not mention: - `bd06eb904`: every host present is held to 0.9 of the recent mean interval. This is **on by default** (`LEONIDA_PRESENT_SMOOTH` unset gives 0.9), so it changes frame pacing for everyone. - `c7fcf49a7`: Reflex sleeps and markers under frame generation (`LEONIDA_FG_MARKERS`). - `eaecc6ac1`: A/B jitter lines. `LEONIDA_PRESENT_SMOOTH` and `LEONIDA_FG_MARKERS` are not documented in any `.md` at this head. Merging this as is would land all of the above, including #625 and #1256 under another PR's name. Suggest rebasing it to the `d3d12_run_fps` commit alone, with the pacing changes as their own pull request. What I measured on the merge, for the record: - Python: the 8 touched test files pass. The exception is `test_progress_dashboard.py`, whose one README failure (`test_default_repo_is_the_one_the_readme_clones`) is the same on plain `main`. With the tools back to `main`, all 8 fail (for `test_d3d12_run_fps.py`, the module does not exist). - Rust: `cargo test -p leonida-gpu --lib --locked` gives 517 passed and 0 failed on the merge, against 515 and 0 on `main`. The 2 new tests pass (`fg::reflex_frame_tests::reflex_frames_follow_the_titles_events`, `smooth::tests::presents_are_held_to_a_fraction_of_the_running_mean`). Warnings are unchanged (10). The pacing itself is not checked in the title. AI-assisted (Claude Code).
owenjbendon-creator commented 2026-11-28 23:45:06 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by owenjbendon-creator on 2026-11-28T23:45:06Z.


Thanks for testing this. The branch is one commit on top of main, though; nothing else comes with it.

  • GitHub's own view of this pull request: 1 commit, 3 files, +512 −0, base adfb3821a.
  • git rev-list --count origin/main..9f7587e19 gives 1.

aa918e5d9 is an older main: it is an ancestor of adfb3821a, 24 commits back (git rev-list --count aa918e5d9..adfb3821a). So git log aa918e5d9..9f7587e19 also lists what main gained in between. The merges of #625, #1256, #1205, #1022 and #1001, and the three leonida-gpu commits (bd06eb904, c7fcf49a7, eaecc6ac1), are already on main (git merge-base --is-ancestor <commit> origin/main holds for each). They are not part of this pull request and merging it does not land them again.

Merging this adds only tools/d3d12_run_fps.py, tests/test_d3d12_run_fps.py and the paragraph in docs/running.md. No rebase is needed: it merges cleanly with main as of a9e247cd6.

AI-assisted (Claude Code, Claude Fable 5.2).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7247639166 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2594#issuecomment-7247639166). Originally posted by [owenjbendon-creator](https://github.com/owenjbendon-creator) on 2026-11-28T23:45:06Z. --- Thanks for testing this. The branch is one commit on top of `main`, though; nothing else comes with it. - GitHub's own view of this pull request: 1 commit, 3 files, +512 −0, base `adfb3821a`. - `git rev-list --count origin/main..9f7587e19` gives 1. `aa918e5d9` is an older `main`: it is an ancestor of `adfb3821a`, 24 commits back (`git rev-list --count aa918e5d9..adfb3821a`). So `git log aa918e5d9..9f7587e19` also lists what `main` gained in between. The merges of #625, #1256, #1205, #1022 and #1001, and the three `leonida-gpu` commits (`bd06eb904`, `c7fcf49a7`, `eaecc6ac1`), are already on `main` (`git merge-base --is-ancestor <commit> origin/main` holds for each). They are not part of this pull request and merging it does not land them again. Merging this adds only `tools/d3d12_run_fps.py`, `tests/test_d3d12_run_fps.py` and the paragraph in `docs/running.md`. No rebase is needed: it merges cleanly with `main` as of `a9e247cd6`. AI-assisted (Claude Code, Claude Fable 5.2).
timbot103 commented 2026-11-29 01:06:44 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by timbot103 on 2026-11-29T01:06:44Z.

Review: COMMENTED


Static audit of 9f7587e19 against main 48bae6cad. Please fix argument-error redaction before merge. At tools/d3d12_run_fps.py:174, omitting --compare between two log arguments makes argparse echo the second path to stderr. Invalid --min-samples values are echoed too.

At tools/d3d12_run_fps.py:65, anchor the match to the start of a bare frame line or the host INFO message. At line 45, an EOF cut after the draw count still produces a sample. Add coverage for both cases. At line 131, include the texture and copy-back MB medians in text so it matches JSON.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6100841552 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2594#pullrequestreview-6100841552). Originally posted by [timbot103](https://github.com/timbot103) on 2026-11-29T01:06:44Z. **Review:** COMMENTED --- Static audit of 9f7587e19 against main 48bae6cad. Please fix argument-error redaction before merge. At tools/d3d12_run_fps.py:174, omitting --compare between two log arguments makes argparse echo the second path to stderr. Invalid --min-samples values are echoed too. At tools/d3d12_run_fps.py:65, anchor the match to the start of a bare frame line or the host INFO message. At line 45, an EOF cut after the draw count still produces a sample. Add coverage for both cases. At line 131, include the texture and copy-back MB medians in text so it matches JSON. AI-assisted.
owenjbendon-creator commented 2026-11-29 01:15:43 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by owenjbendon-creator on 2026-11-29T01:15:43Z.


Thanks, all four were right. Fixed in 016554bef (a second commit, so the first review's head stays as it was):

  • Argument errors no longer give back what was typed. A second log without --compare now reads 1 argument not understood: one log, and a second after --compare; unknown arguments are counted, not quoted. --min-samples has its own type, whose error is fixed text (a whole number, 1 or more), and options cannot be abbreviated. The only argparse messages left are its own fixed ones (expected one argument and the like).
  • A frame line counts only where the logger wrote it: at the start of a line, or after the time stamp, level and target of the host's INFO message (leonida_gpu::host, and victory_gpu::host of the forks this runtime came from). The same words inside another message, after other text, at another level or under another target are not read.
  • A cut after the draw count gives no sample. A last line without its line end is skipped whatever it holds, and the pattern now asks for the words that follow the count (, dropped ), so the same cut with a line end is refused too.
  • The text gives the textures' MB and the copy-back's MB, as the JSON does; a test checks the text names every median the JSON has.

Tested: python -I tests/test_d3d12_run_fps.py, 19 tests (three new: a frame line counts only where the logger wrote it; a last line without its end is skipped; no error gives back what was typed). test_text_write_line_endings.py, test_docs_cli_flags.py and check_no_game_data.py on the changed files pass. Each of the new rules, broken on purpose in a copy, fails a test.

AI-assisted (Claude Code, Claude Fable 5.2).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7248666948 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2594#issuecomment-7248666948). Originally posted by [owenjbendon-creator](https://github.com/owenjbendon-creator) on 2026-11-29T01:15:43Z. --- Thanks, all four were right. Fixed in `016554bef` (a second commit, so the first review's head stays as it was): - **Argument errors no longer give back what was typed.** A second log without `--compare` now reads `1 argument not understood: one log, and a second after --compare`; unknown arguments are counted, not quoted. `--min-samples` has its own type, whose error is fixed text (`a whole number, 1 or more`), and options cannot be abbreviated. The only argparse messages left are its own fixed ones (`expected one argument` and the like). - **A frame line counts only where the logger wrote it:** at the start of a line, or after the time stamp, level and target of the host's `INFO` message (`leonida_gpu::host`, and `victory_gpu::host` of the forks this runtime came from). The same words inside another message, after other text, at another level or under another target are not read. - **A cut after the draw count gives no sample.** A last line without its line end is skipped whatever it holds, and the pattern now asks for the words that follow the count (`, dropped `), so the same cut with a line end is refused too. - **The text gives the textures' MB and the copy-back's MB**, as the JSON does; a test checks the text names every median the JSON has. Tested: `python -I tests/test_d3d12_run_fps.py`, 19 tests (three new: a frame line counts only where the logger wrote it; a last line without its end is skipped; no error gives back what was typed). `test_text_write_line_endings.py`, `test_docs_cli_flags.py` and `check_no_game_data.py` on the changed files pass. Each of the new rules, broken on purpose in a copy, fails a test. AI-assisted (Claude Code, Claude Fable 5.2).
zmasi commented 2026-11-29 02:12:48 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-29T02:12:48Z.


#2594 | head 016554bef3 (merged cleanly onto origin/main 791899f652) | Windows 11 (10.0.26200.9974), Python 3.12.10 | AI-assisted: yes

Independent Verification (Windows 11)

  • Diff & format-string parity audit: Inspected 100% of the diff on current head 016554bef3 across docs/running.md, tools/d3d12_run_fps.py, and tests/test_d3d12_run_fps.py, and verified FRAME_LINE matches d3d12/crates/leonida-gpu/src/host.rs's tracing::info! frame summary format string ({fps:.1} fps, {ms:.1} ms/frame ({cpu:.1} preparing: copies {copy_ms:.1} ms {copy_mb:.1} MB, textures {texture_ms:.1} ms {texture_mb:.1} MB; {gpu:.1} on the GPU; {back_ms:.1} copying back {back_mb:.1} MB), {draws:.0} draws/frame, ...). python -I scripts/check_no_game_data.py docs/running.md tools/d3d12_run_fps.py tests/test_d3d12_run_fps.py passed (rc=0).
  • Verification on native Windows 11 (#2594 + origin/main 791899f652):
    • python -I tests/test_d3d12_run_fps.py -v -> 19/19 passed (0 skipped, OK, 0.208s), covering UTF-8 and UTF-16 BOM PowerShell log decoding, ANSI escape stripping, truncated last-line handling, bucketed --compare like-for-like FPS comparisons, allow_abbrev=False, and strict path/log-text suppression in both stdout and error diagnostics.
    • python -I tests/test_ci_registration.py -> 18/18 passed (OK)
    • Doc verification suites: test_docs_table_rows.py (2/2), test_docs_repo_paths.py (5/5), test_docs_encoding.py (1/1), test_docs_env_vars.py (5/5) -> all OK.
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7249281842 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2594#issuecomment-7249281842). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-29T02:12:48Z. --- #2594 | head 016554bef3697bcb705f9ea3360fabeb9a4841b5 (merged cleanly onto origin/main 791899f652) | Windows 11 (10.0.26200.9974), Python 3.12.10 | AI-assisted: yes ### Independent Verification (Windows 11) - **Diff & format-string parity audit**: Inspected 100% of the diff on current head `016554bef3` across `docs/running.md`, `tools/d3d12_run_fps.py`, and `tests/test_d3d12_run_fps.py`, and verified `FRAME_LINE` matches `d3d12/crates/leonida-gpu/src/host.rs`'s `tracing::info!` frame summary format string (`{fps:.1} fps, {ms:.1} ms/frame ({cpu:.1} preparing: copies {copy_ms:.1} ms {copy_mb:.1} MB, textures {texture_ms:.1} ms {texture_mb:.1} MB; {gpu:.1} on the GPU; {back_ms:.1} copying back {back_mb:.1} MB), {draws:.0} draws/frame, ...`). `python -I scripts/check_no_game_data.py docs/running.md tools/d3d12_run_fps.py tests/test_d3d12_run_fps.py` passed (`rc=0`). - **Verification on native Windows 11 (`#2594 + origin/main` `791899f652`)**: - `python -I tests/test_d3d12_run_fps.py -v` -> **`19/19` passed (`0` skipped, `OK`, `0.208s`)**, covering UTF-8 and UTF-16 BOM PowerShell log decoding, ANSI escape stripping, truncated last-line handling, bucketed `--compare` like-for-like FPS comparisons, `allow_abbrev=False`, and strict path/log-text suppression in both stdout and error diagnostics. - `python -I tests/test_ci_registration.py` -> `18/18` passed (`OK`) - Doc verification suites: `test_docs_table_rows.py` (`2/2`), `test_docs_repo_paths.py` (`5/5`), `test_docs_encoding.py` (`1/1`), `test_docs_env_vars.py` (`5/5`) -> all `OK`.
lixonik commented 2026-11-29 02:21:09 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-29T02:21:09Z.


I ran all 19 synthetic tests on Windows 10, CPython 3.12.1, for head 016554bef3697bcb705f9ea3360fabeb9a4841b5 merged into main 04f484006e. All passed. One argument-redaction case remains.

python -I tools/d3d12_run_fps.py baseline.log --json=synthetic-private-name exits 2 and prints argument --json: ignored explicit argument 'synthetic-private-name' to stderr. --help=synthetic-private-name does the same. No input file is needed. These are recognized flags, so argparse reports the error before parse_known_args can return an unknown-argument list.

Please redact the argument text for malformed no-value flags too, and cover --json=<marker> and --help=<marker> alongside the existing malformed numeric options.

AI-assisted. Codex (GPT-6).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7249372553 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2594#issuecomment-7249372553). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-29T02:21:09Z. --- I ran all 19 synthetic tests on Windows 10, CPython 3.12.1, for head `016554bef3697bcb705f9ea3360fabeb9a4841b5` merged into `main` `04f484006e`. All passed. One argument-redaction case remains. `python -I tools/d3d12_run_fps.py baseline.log --json=synthetic-private-name` exits 2 and prints `argument --json: ignored explicit argument 'synthetic-private-name'` to stderr. `--help=synthetic-private-name` does the same. No input file is needed. These are recognized flags, so argparse reports the error before `parse_known_args` can return an unknown-argument list. Please redact the argument text for malformed no-value flags too, and cover `--json=<marker>` and `--help=<marker>` alongside the existing malformed numeric options. AI-assisted. Codex (GPT-6).
owenjbendon-creator commented 2026-11-29 02:25:34 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by owenjbendon-creator on 2026-11-29T02:25:34Z.


Thanks, that was a real gap: argparse raises that error for a known flag before parse_known_args returns, so counting the unknown arguments could not catch it. Fixed in befe3aa13, and closed for the whole class rather than for the two flags:

  • The parser is now a subclass whose error() rewrites every message argparse raises from a short list of fixed texts, with the option's own name where it names one: takes no value, needs a value, the three texts of the tool's own argument types, a log is needed, and not understood for anything the list does not know (another Python's wording, a check argparse gains later). The tool's own errors go through a separate fail(), unchanged.
  • python -I tools/d3d12_run_fps.py baseline.log --json=synthetic-private-name now prints argument --json: takes no value, and --help=synthetic-private-name prints argument -h/--help: takes no value.

Tested: python -I tests/test_d3d12_run_fps.py, 22 tests. New: --json=<marker>, --help=<marker>, bad --edges and --min-samples values, an unknown flag and a missing log, each with a plain marker, one with quotes in it and one with a space; a message the list does not know, named and unnamed; and the fixed texts checked against what the argument types raise. Letting argparse's messages through in a copy fails those tests. test_text_write_line_endings.py, test_docs_cli_flags.py and check_no_game_data.py on the changed files pass.

AI-assisted (Claude Code, Claude Fable 5.2).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7249419799 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2594#issuecomment-7249419799). Originally posted by [owenjbendon-creator](https://github.com/owenjbendon-creator) on 2026-11-29T02:25:34Z. --- Thanks, that was a real gap: argparse raises that error for a known flag before `parse_known_args` returns, so counting the unknown arguments could not catch it. Fixed in `befe3aa13`, and closed for the whole class rather than for the two flags: - The parser is now a subclass whose `error()` rewrites every message argparse raises from a short list of fixed texts, with the option's own name where it names one: `takes no value`, `needs a value`, the three texts of the tool's own argument types, `a log is needed`, and `not understood` for anything the list does not know (another Python's wording, a check argparse gains later). The tool's own errors go through a separate `fail()`, unchanged. - `python -I tools/d3d12_run_fps.py baseline.log --json=synthetic-private-name` now prints `argument --json: takes no value`, and `--help=synthetic-private-name` prints `argument -h/--help: takes no value`. Tested: `python -I tests/test_d3d12_run_fps.py`, 22 tests. New: `--json=<marker>`, `--help=<marker>`, bad `--edges` and `--min-samples` values, an unknown flag and a missing log, each with a plain marker, one with quotes in it and one with a space; a message the list does not know, named and unnamed; and the fixed texts checked against what the argument types raise. Letting argparse's messages through in a copy fails those tests. `test_text_write_line_endings.py`, `test_docs_cli_flags.py` and `check_no_game_data.py` on the changed files pass. AI-assisted (Claude Code, Claude Fable 5.2).
lixonik commented 2026-11-29 02:47:15 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-29T02:47:15Z.


Rechecked befe3aa137c7e0f729906a1438b99dfacb8f669a merged into main c8bf0e7b65 on Windows 10 and CPython 3.12.1. All 22 tests passed. The new malformed-flag test failed with the previous parser and passed with this update. Both --json=<marker> and --help=<marker> now report the flag error without the supplied value.

AI-assisted. Codex (GPT-6).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7249646753 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2594#issuecomment-7249646753). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-29T02:47:15Z. --- Rechecked `befe3aa137c7e0f729906a1438b99dfacb8f669a` merged into `main` `c8bf0e7b65` on Windows 10 and CPython 3.12.1. All 22 tests passed. The new malformed-flag test failed with the previous parser and passed with this update. Both `--json=<marker>` and `--help=<marker>` now report the flag error without the supplied value. AI-assisted. Codex (GPT-6).
OreoFR commented 2026-11-29 15:29:05 +00:00 (Migrated from github.com)

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


Re-verified by OreoFR at head befe3aa13 on main 91bab934d: READY — red 1 fail → green 22 OK; ctest/link n/a (Python tool only); head unchanged since the earlier verification https://github.com/ProjectLeonida/mandy/pull/2594#issuecomment-7249646753 (lixonik; no earlier OreoFR run on this PR). Windows 11, RTX 4070 Laptop 8 GB, NVIDIA 621.40. AI-assisted (Claude Code, Claude Opus 5.5).

  • Red (main + only tests/test_d3d12_run_fps.py): python -I -m unittest discover -s tests -p test_d3d12_run_fps.py errors on import, d3d12_run_fps is not in main.
  • Green (main + this PR, git merge --no-ff, no conflict): 22 tests OK.

Ready to merge per the maintainers' plan.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7258125261 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2594#issuecomment-7258125261). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-29T15:29:05Z. --- **Re-verified by OreoFR** at head `befe3aa13` on main `91bab934d`: READY — red 1 fail → green 22 OK; ctest/link n/a (Python tool only); head unchanged since the earlier verification https://github.com/ProjectLeonida/mandy/pull/2594#issuecomment-7249646753 (lixonik; no earlier OreoFR run on this PR). Windows 11, RTX 4070 Laptop 8 GB, NVIDIA 621.40. AI-assisted (Claude Code, Claude Opus 5.5). - Red (main + only `tests/test_d3d12_run_fps.py`): `python -I -m unittest discover -s tests -p test_d3d12_run_fps.py` errors on import, `d3d12_run_fps` is not in main. - Green (main + this PR, `git merge --no-ff`, no conflict): 22 tests OK. Ready to merge per the maintainers' plan.
fiestorra commented 2026-11-29 17:18:17 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-11-29T17:18:17Z.


Verification of this one on current main, since it is a new tool and nobody has said whether it still applies.

I cherry-picked all three commits of the branch (9f7587e19..befe3aa13) onto origin/main 4364a4fa6:

3 commits applied, no conflicts
git diff --name-only origin/main..HEAD  ->  3 files (docs/running.md, tools/d3d12_run_fps.py, tests/test_d3d12_run_fps.py)
python3 -m pytest tests/test_d3d12_run_fps.py -q  ->  22 passed

The branch is 536 commits behind, so it wants a rebase before it goes in, but the change itself still applies to today's tree and its tests hold, including
docs/running.md, which main has touched twice since the branch was cut.

One correction of my own that is worth writing down, because it nearly turned into a false report: my first attempt cherry-picked only the tip commit
(befe3aa13) and git answered with a delete/update conflict, which reads like the branch fights main. It does not - the tool is created by the first of
the three commits, so cherry-picking the tip alone asks git to modify a file that is not there. For a pull request with several commits the range is what has
to be applied, not the head.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7259584726 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2594#issuecomment-7259584726). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-11-29T17:18:17Z. --- Verification of this one on current `main`, since it is a new tool and nobody has said whether it still applies. I cherry-picked **all three commits** of the branch (`9f7587e19..befe3aa13`) onto `origin/main` `4364a4fa6`: ``` 3 commits applied, no conflicts git diff --name-only origin/main..HEAD -> 3 files (docs/running.md, tools/d3d12_run_fps.py, tests/test_d3d12_run_fps.py) python3 -m pytest tests/test_d3d12_run_fps.py -q -> 22 passed ``` The branch is **536 commits behind**, so it wants a rebase before it goes in, but the change itself still applies to today's tree and its tests hold, including `docs/running.md`, which `main` has touched twice since the branch was cut. One correction of my own that is worth writing down, because it nearly turned into a false report: my first attempt cherry-picked only the tip commit (`befe3aa13`) and git answered with a delete/update conflict, which reads like the branch fights `main`. It does not - the tool is **created** by the first of the three commits, so cherry-picking the tip alone asks git to modify a file that is not there. For a pull request with several commits the range is what has to be applied, not the head. Written with an AI assistant.
fiestorra commented 2026-11-30 05:39:35 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-11-30T05:39:35Z.


Independent verification on this machine (Windows 11, Python 3.13.14). New tool plus its tests, and the claims in the commits hold up under a smoke run.

1. It applies. merge-tree clean; the three commits cherry-pick onto main 1d22590b9 without a conflict. Three files, 675 insertions(+): tools/d3d12_run_fps.py (new), tests/test_d3d12_run_fps.py (new) and docs/running.md.

2. Its tests pass:

python3 -m pytest tests/test_d3d12_run_fps.py -q   -> 22 passed

3. The behaviour the last two commits describe is observable directly, which is why I ran the tool rather than only its tests:

python3 tools/d3d12_run_fps.py --help          -> exit 0, usage line and the description
python3 tools/d3d12_run_fps.py --frames abc    -> exit 2
    "d3d12_run_fps.py: error: 1 argument not understood: one log, and a second after --compare"

--frames is not an option of this tool, so this is the fixed-text path: the message does not repeat abc, which is what 016554bef ("no argument comes back in an error") and befe3aa13 ("an error of argparse's own is rewritten from fixed text") claim.

What the negative control cannot do: both the tool and its test are new files, so there is no main version to revert - the same shape as #2651 and #2645, where a test that only exists with its feature cannot demonstrate the absence of that feature. What compensates here is the smoke run above, which exercises the real entry point.

What I did not test: the measurement itself - frame rate from a real D3D12-runtime log with --compare, --edges and --min-samples. That needs a log from a leonida.exe run, which this machine cannot produce (no cargo).

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7269879237 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2594#issuecomment-7269879237). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-11-30T05:39:35Z. --- Independent verification on this machine (Windows 11, Python 3.13.14). **New tool plus its tests, and the claims in the commits hold up under a smoke run.** **1. It applies.** `merge-tree` clean; the three commits cherry-pick onto `main` `1d22590b9` without a conflict. Three files, `675 insertions(+)`: `tools/d3d12_run_fps.py` (new), `tests/test_d3d12_run_fps.py` (new) and `docs/running.md`. **2. Its tests pass:** ``` python3 -m pytest tests/test_d3d12_run_fps.py -q -> 22 passed ``` **3. The behaviour the last two commits describe is observable directly**, which is why I ran the tool rather than only its tests: ``` python3 tools/d3d12_run_fps.py --help -> exit 0, usage line and the description python3 tools/d3d12_run_fps.py --frames abc -> exit 2 "d3d12_run_fps.py: error: 1 argument not understood: one log, and a second after --compare" ``` `--frames` is not an option of this tool, so this is the fixed-text path: **the message does not repeat `abc`**, which is what `016554bef` ("no argument comes back in an error") and `befe3aa13` ("an error of argparse's own is rewritten from fixed text") claim. **What the negative control cannot do:** both the tool and its test are **new files**, so there is no `main` version to revert - the same shape as #2651 and #2645, where a test that only exists with its feature cannot demonstrate the absence of that feature. What compensates here is the smoke run above, which exercises the real entry point. **What I did not test:** the measurement itself - frame rate from a real D3D12-runtime log with `--compare`, `--edges` and `--min-samples`. That needs a log from a `leonida.exe` run, which this machine cannot produce (no `cargo`). Written with an AI assistant.
MoonEyes commented 2026-11-30 10:04:28 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-30T10:04:28Z.


Merging. Head befe3aa13 merges cleanly with main 6dec36053 and does not force a rebase of #2566. New tool, so no red is possible; fiestorra's check is above. On Windows 11 on main + this PR its 22 tests and the 13 docs test files pass, I read the tool, and it reads the log of a real 600 s run of mine. The branch's red CI jobs come from its old base as far as I read them (files it does not touch, several of which pass here on current main). Merged by MoonEyes.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7275079026 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2594#issuecomment-7275079026). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-30T10:04:28Z. --- Merging. Head `befe3aa13` merges cleanly with `main` `6dec36053` and does not force a rebase of #2566. New tool, so no red is possible; fiestorra's check is above. On Windows 11 on main + this PR its 22 tests and the 13 docs test files pass, I read the tool, and it reads the log of a real 600 s run of mine. The branch's red CI jobs come from its old base as far as I read them (files it does not touch, several of which pass here on current main). 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!2594
No description provided.