Skip to content

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

Merged
MoonEyes merged 6 commits into
ProjectLeonida:mainfrom
MoonEyes:docs/d3d12-measuring
Nov 30, 2026
Merged

MoonEyes merged 6 commits into
ProjectLeonida:mainfrom
MoonEyes:docs/d3d12-measuring

Conversation

@MoonEyes

Copy link
Copy Markdown
Collaborator

Claimed in the coordination issue as: DOCS-D3D12-MEASURING (#2570 (comment))

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

MoonEyes and others added 4 commits November 30, 2026 10:29
…_* variables

d3d12/docs/findings.md was reachable from d3d12/README.md alone, so a night of
runs repeated measurements it already holds. Index it, point AGENTS.md at it,
say how to measure (a switch by turns inside one run), and list the variables
the runtime names from its own sources: 415 of 669 were in no Markdown file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The launcher column saw one way of assigning of four, three kinds were wrong,
names read by turns through a constant, a function or asked_for! were missing,
and test modules with a brace in a raw string were cut short. measuring_fps.md
now says how to give LEONIDA_AB to the launcher and what GPU_TIMING and
PROFILE need.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@OreoFR

OreoFR commented Nov 30, 2026

Copy link
Copy Markdown
Collaborator

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

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

Copy link
Copy Markdown
Contributor

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.

tests/test_tool_stdout_encoding.py asks it of every tool. d3d12_run_fps.py came
in with ProjectLeonida#2594 without it, which left that test red on main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@merzleckeier

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Collaborator Author

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

@MoonEyes
MoonEyes merged commit 0568cd6 into ProjectLeonida:main Nov 30, 2026
5 checks passed
MoonEyes added a commit that referenced this pull request Nov 30, 2026
merzleckeier measured on #2708 that LEONIDA_GUARD_HOT and LEONIDA_SKIP_TRY_A
stay off on both sides when only LEONIDA_AB names them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

3 participants