docs: how to measure the D3D12 runtime's frame rates, and its LEONIDA_* variables (DOCS-D3D12-MEASURING) #2708

Merged
MoonEyes merged 6 commits from upstream-pr/2708 into main 2026-11-30 10:45:11 +00:00
MoonEyes commented 2026-11-30 09:58:23 +00:00 (Migrated from github.com)

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


Claimed in the coordination issue as: DOCS-D3D12-MEASURING (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7274934405)

What and why

d3d12/docs/findings.md holds most of what was measured of the D3D12 runtime's frame, but neither docs/README.md nor AGENTS.md names it. I tested about ten switches one night by separate runs without having read it.

  • docs/README.md and AGENTS.md (three lines, "Before you guess, look") point to it.
  • docs/measuring_fps.md: look first, turn a switch by turns inside one run (LEONIDA_AB, and how to give it to the launcher), what separate runs need, which log number means what, what to write before reporting a cause. Method only.
  • tools/d3d12_switches.py makes d3d12/docs/switches.md from the sources: 630 LEONIDA_* names with how each is read where that can be told, whether LEONIDA_AB can turn it, whether the launcher assigns it, whether the findings name it, and the sentence of the code's comment. It copies no value the launcher sets. No CI job keeps the page current; the page says so, and --check tells the difference.

AGENTS.md is changed, so this needs a maintainer's own look.

Tested

  • python -I tests/test_d3d12_switches.py: 19 tests OK (synthetic sources, plus one on the repository). Run at f98f4973e; the commit after it changes one sentence of the generated page, where --check gives 0.
  • tests/test_docs_*.py, test_ci_registration.py, test_text_write_line_endings.py: OK (Windows 11, at f98f4973e).
  • scripts/check_no_game_data.py on the six files: OK.
  • An independent AI review refused the first version (ten findings, among them a launcher column that was wrong for 43 names) and accepted the corrected one.

Not tested: the advice of measuring_fps.md on LEONIDA_AB, LEONIDA_GPU_TIMING and LEONIDA_PROFILE is read in the code and the findings. Four mouse settings have no sentence in the list. Two observations in the page are marked "seen once".

GPUs tested: n/a

AI-assisted: yes (Claude Code)

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 rule)

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5562995270 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2708). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-30T09:58:23Z. --- Claimed in the coordination issue as: `DOCS-D3D12-MEASURING` (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7274934405) ### What and why `d3d12/docs/findings.md` holds most of what was measured of the D3D12 runtime's frame, but neither `docs/README.md` nor `AGENTS.md` names it. I tested about ten switches one night by separate runs without having read it. - `docs/README.md` and `AGENTS.md` (three lines, "Before you guess, look") point to it. - `docs/measuring_fps.md`: look first, turn a switch by turns inside one run (`LEONIDA_AB`, and how to give it to the launcher), what separate runs need, which log number means what, what to write before reporting a cause. Method only. - `tools/d3d12_switches.py` makes `d3d12/docs/switches.md` from the sources: 630 `LEONIDA_*` names with how each is read where that can be told, whether `LEONIDA_AB` can turn it, whether the launcher assigns it, whether the findings name it, and the sentence of the code's comment. It copies no value the launcher sets. No CI job keeps the page current; the page says so, and `--check` tells the difference. `AGENTS.md` is changed, so this needs a maintainer's own look. ### Tested - `python -I tests/test_d3d12_switches.py`: 19 tests OK (synthetic sources, plus one on the repository). Run at `f98f4973e`; the commit after it changes one sentence of the generated page, where `--check` gives 0. - `tests/test_docs_*.py`, `test_ci_registration.py`, `test_text_write_line_endings.py`: OK (Windows 11, at `f98f4973e`). - `scripts/check_no_game_data.py` on the six files: OK. - An independent AI review refused the first version (ten findings, among them a launcher column that was wrong for 43 names) and accepted the corrected one. Not tested: the advice of `measuring_fps.md` on `LEONIDA_AB`, `LEONIDA_GPU_TIMING` and `LEONIDA_PROFILE` is read in the code and the findings. Four mouse settings have no sentence in the list. Two observations in the page are marked "seen once". GPUs tested: n/a AI-assisted: yes (Claude Code) ### 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 rule) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
OreoFR commented 2026-11-30 10:03:58 +00:00 (Migrated from github.com)

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


Checked by OreoFR on macOS 27.2.1, Apple M5, Python 3.12.16, main 4014af7fe, PR head bf85962d4. MEASURED:

  • red (main + only tests/test_d3d12_switches.py): fails at import, ModuleNotFoundError: No module named 'd3d12_switches' (the tool is new).
  • green (main + this PR): tests/test_d3d12_switches.py 19/19 OK (python3.12 -I); tools/d3d12_switches.py --check d3d12/docs/switches.md exits 0, so the committed table matches what the tool generates from the code on this tree; --help works.
  • The 13 tests/test_docs_*.py files pass on main + this PR.
  • Merges cleanly with main, and on top of main + #2566. (A merge-tree of main+this PR against #2566 reports a conflict in tests/semantic/test_interp_computed_ij_fallback.py, a file this PR does not touch: an artifact of the older merge base, not a real conflict.)

Not covered: whether every switch's one-line description in switches.md is right (that is a read of each switch's code, not a test).

AI-assisted: Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7275067620 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2708#issuecomment-7275067620). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-30T10:03:58Z. --- Checked by OreoFR on macOS 27.2.1, Apple M5, Python 3.12.16, main 4014af7fe, PR head bf85962d4. MEASURED: - red (main + only `tests/test_d3d12_switches.py`): fails at import, `ModuleNotFoundError: No module named 'd3d12_switches'` (the tool is new). - green (main + this PR): `tests/test_d3d12_switches.py` **19/19 OK** (`python3.12 -I`); `tools/d3d12_switches.py --check d3d12/docs/switches.md` exits 0, so the committed table matches what the tool generates from the code on this tree; `--help` works. - The 13 `tests/test_docs_*.py` files pass on main + this PR. - Merges cleanly with main, and on top of main + #2566. (A merge-tree of main+this PR against #2566 reports a conflict in `tests/semantic/test_interp_computed_ij_fallback.py`, a file this PR does not touch: an artifact of the older merge base, not a real conflict.) Not covered: whether every switch's one-line description in `switches.md` is right (that is a read of each switch's code, not a test). AI-assisted: Claude Code
merzleckeier commented 2026-11-30 10:21:01 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-30T10:21:01Z.


Measured A/B guide caveat. I merged bf85962d4 onto 454df8e95 (tree 745f850c9). The 19 switch-table tests passed and a fresh --out matched the committed Markdown byte for byte.

docs/measuring_fps.md §2 says, “A switch named there no longer goes by its own variable.” This holds for direct boolean overrides, but some entries marked A/B: yes still need their own values. I compiled the unchanged ab parser and lookup, watch::hot_rest, and pipeline::skip_tried in a small Rust harness with controlled phase bits and a synthetic pipeline hash. I also ran the actual play-nvidia.ps1 with a synthetic child process to check what reached it.

How the launcher receives the settings GUARD_HOT, off → on Matching synthetic pipeline skipped, off → on
A/B names and LEONIDA_PORT_GUARD=1 in -More 0 → 0 ms false → false
Same -More, with the two switch values set only in the parent environment 0 → 0 ms false → false
Also pass LEONIDA_GUARD_HOT=37 and a synthetic value for LEONIDA_SKIP_TRY_A in -More 0 → 37 ms false → true

The unrelated synthetic pipeline stayed enabled in every phase. Suggested wording for §2: “Direct on/off switches use the A/B phase as their value. Some switches use the phase to enable a configured value or list. Pass those values alongside LEONIDA_AB in -More.”

CachyOS, PowerShell 7.4.21, Rust 1.97.1, synthetic inputs. AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7275469704 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2708#issuecomment-7275469704). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-30T10:21:01Z. --- **Measured A/B guide caveat.** I merged `bf85962d4` onto `454df8e95` (tree `745f850c9`). The 19 switch-table tests passed and a fresh `--out` matched the committed Markdown byte for byte. `docs/measuring_fps.md` §2 says, “A switch named there no longer goes by its own variable.” This holds for direct boolean overrides, but some entries marked **A/B: yes** still need their own values. I compiled the unchanged `ab` parser and lookup, `watch::hot_rest`, and `pipeline::skip_tried` in a small Rust harness with controlled phase bits and a synthetic pipeline hash. I also ran the actual `play-nvidia.ps1` with a synthetic child process to check what reached it. | How the launcher receives the settings | `GUARD_HOT`, off → on | Matching synthetic pipeline skipped, off → on | | --- | --- | --- | | A/B names and `LEONIDA_PORT_GUARD=1` in `-More` | 0 → 0 ms | false → false | | Same `-More`, with the two switch values set only in the parent environment | 0 → 0 ms | false → false | | Also pass `LEONIDA_GUARD_HOT=37` and a synthetic value for `LEONIDA_SKIP_TRY_A` in `-More` | 0 → 37 ms | false → true | The unrelated synthetic pipeline stayed enabled in every phase. Suggested wording for §2: “Direct on/off switches use the A/B phase as their value. Some switches use the phase to enable a configured value or list. Pass those values alongside `LEONIDA_AB` in `-More`.” CachyOS, PowerShell 7.4.21, Rust 1.97.1, synthetic inputs. AI-assisted with OpenAI Codex.
merzleckeier commented 2026-11-30 10:30:16 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-30T10:30:16Z.


Independent stdout encoding check of 6a321e5db. I merged it onto 012b79a67 (tree 140e655db) and ran the CLI entry points under Python 3.14.10 on CachyOS, forcing redirected stdout to ASCII, CP1252, CP932 and UTF-8 with strict error handling before each tool started.

d3d12_switches.py --out to a path containing U+E9C3 wrote the correct Markdown in every run. The preceding revision then hit UnicodeEncodeError and exited 1 on ASCII, CP1252 and CP932 while printing the status line. The current revision exited 0 on all four encodings, replacing only the unencodable character in the status line.

d3d12_run_fps.py --compare produced byte-identical text and JSON before and after the change across all four encodings, using separate synthetic UTF-8 and UTF-16 logs in non-ASCII paths. The 4 stdout-encoding, 19 switch-table and 22 FPS tests all passed. AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7275688674 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2708#issuecomment-7275688674). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-30T10:30:16Z. --- **Independent stdout encoding check of `6a321e5db`.** I merged it onto `012b79a67` (tree `140e655db`) and ran the CLI entry points under Python 3.14.10 on CachyOS, forcing redirected stdout to ASCII, CP1252, CP932 and UTF-8 with strict error handling before each tool started. `d3d12_switches.py --out` to a path containing U+E9C3 wrote the correct Markdown in every run. The preceding revision then hit `UnicodeEncodeError` and exited 1 on ASCII, CP1252 and CP932 while printing the status line. The current revision exited 0 on all four encodings, replacing only the unencodable character in the status line. `d3d12_run_fps.py --compare` produced byte-identical text and JSON before and after the change across all four encodings, using separate synthetic UTF-8 and UTF-16 logs in non-ASCII paths. The 4 stdout-encoding, 19 switch-table and 22 FPS tests all passed. AI-assisted with OpenAI Codex.
MoonEyes commented 2026-11-30 10:45:08 +00:00 (Migrated from github.com)

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


Merging at the owner's request (MoonEyes), AGENTS.md lines included. Head 6a321e5db merges cleanly with main 012b79a67, its CI is green, and OreoFR (on bf85962d4) and merzleckeier checked it. On main + this PR on Windows 11 the tool's 19 tests, test_tool_stdout_encoding.py (red on main since #2594) and the docs tests I ran pass.

Not settled by this merge: merzleckeier's caveat on section 2 of docs/measuring_fps.md (some names marked A/B still need their own value). It is right to raise and gets a follow-up.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7276029608 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2708#issuecomment-7276029608). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-30T10:45:08Z. --- Merging at the owner's request (MoonEyes), `AGENTS.md` lines included. Head `6a321e5db` merges cleanly with `main` `012b79a67`, its CI is green, and OreoFR (on `bf85962d4`) and merzleckeier checked it. On `main` + this PR on Windows 11 the tool's 19 tests, `test_tool_stdout_encoding.py` (red on `main` since #2594) and the docs tests I ran pass. Not settled by this merge: merzleckeier's caveat on section 2 of `docs/measuring_fps.md` (some names marked A/B still need their own value). It is right to raise and gets a follow-up. 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!2708
No description provided.