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>
6.0 KiB
Measuring frame rates of the D3D12 runtime
How to find out whether a change or a switch moves the frame of the Rust D3D12 runtime (d3d12/), and how not to fool
yourself. It is about method; the measurements are in d3d12/docs/findings.md and the list
of switches in d3d12/docs/switches.md.
1. Look first
Search findings.md for the switch or the function you have in mind, on a fresh main.
Many switches have been measured there, with the card, the scene, the method and the spread. On the night of
2026-11-29 several runs on two PCs went into LEONIDA_COPYBACK_ELIDE, whose entry already said "not usable here".
2. Turn the switch inside one run
LEONIDA_AB=<seconds>,<switch>[,<switch>..] turns switches on and off every so many seconds while the title runs, so
both sides are measured in one scene, at one cache temperature, beside the same programs
(ab.rs):
- It needs a build with
diagnostics(the oned3d12/scripts/build-nvidia.ps1makes) and more than one second a phase. - Up to eight switches; switch number n is on in the phases whose number has bit n, so every combination comes round.
- A switch named there no longer goes by its own variable. Only switches the code reads that way follow it; for any other name the phases are logged and nothing changes, so check the name in switches.md or the code before you believe a "no difference".
- Not every switch may be turned in play:
findings.mdhas one that ends the title (LEONIDA_ASYNC_SUBMIT). - Each phase ends with a line
A/B phase <n> bits <b> on [...]: frames, mean, median, p90, draws a frame, the card's idle and busy time a frame and the submitting thread's work a frame. The first second of a phase is left out.
Phases of 3.5 to 4 s worked there. The idle camera goes round views of about 24 s with different draw counts, so phases
of 15 s measured the views rather than the switch. Standing, findings.md cuts the phases into stretches where the draw count
jumps, leaves out the first phase of a stretch and fits a level for each stretch; walking, it takes the mean of the differences of
neighbouring phases. Give the effect with its standard error. The scripts it names for this (ab_pair.py, ab_eff.py) are not in
the repository.
That gave about 0.2 to 0.8 ms of spread for a standing run of some minutes and 1 to 2 ms for a walking one. Two separate runs of one setting differed by 7 ms in one of its tables (75.0 and 82.1 ms).
3. When only separate runs will do
A change of code, or a switch that cannot be turned in play, needs separate runs:
- The same save for every start. The title rewrites its autosave, so keep a copy and put it back before each start (and the player's own back afterwards).
- Alternate (A B B A), in one sitting, with a throwaway run first: one PC's first measured run after a warm-up came out slowest in both series it was looked for in (2026-11-30; not explained).
- After a translator change, or on a new build, play a while first. Until its pipelines are made, a run measures that.
- The same programs in the background, and nothing heavy beside it: no compiler, no test suite.
findings.mdhas one build at 16.2 to 17.3 and then 12.8 frames a second; what had changed was the programs that start with Windows. - Check every run for the state you think it was in: it reached the world, it did not stay in the menu, it did not end early. A run that stayed in the menu shows 60.
- With two runs a side, do not claim a difference smaller than the spread between runs of the same side.
4. Which number means what
- Frame time, not only frames a second. The line
leonida_gpu::host: <n> fps, <ms> ms/frame (...)counts rendered frames. With frame generation the screen shows more; say which you mean, or measure with-NoFrameGen. - Report the median and a low percentile, and leave the menu and the loading out.
- A sum over all threads is not a part of the frame. "All threads", "list calls ... ms", the process's CPU time and a whole-process profile add up work that runs side by side. They can exceed the frame many times over.
- A thread that waits because it has nothing to do costs nothing. The relay line says its thread waits "beside the submitting thread"; what other threads lost to it is in the line about settles.
- Draws "left out on purpose" are not missing pipelines; the line gives both counts.
- The frame stands at the longest of its walls (the card, the submitting thread, the title). Work taken off another one does not show. Cards and CPUs differ: say the card, driver, CPU, memory, profile, resolution, scene and commit.
5. Where a frame goes
All in builds with diagnostics; each costs something, so do not read frame rates from the same run.
| Tool | What it answers |
|---|---|
LEONIDA_TIMELINE=<file> (with LEONIDA_TIMELINE_AT, LEONIDA_TIMELINE_FRAMES) |
A trace of a few frames for chrome://tracing or Perfetto, and a text summary with the chain of work and waits each present came out of: the tool for "what does the frame wait for". |
LEONIDA_PROFILE=<from>,<to>,<ms>,<file> (with LEONIDA_PROFILE_ONLY=<thread name>) |
Stack samples by thread, waits included, from inside the process. Do not name the title's own threads: findings.md has a run that ended that way. |
LEONIDA_GPU_TIMING=1 |
The commands' time on the card. |
Windows Performance Recorder works too (it needs an administrator). Wait until it says that the trace was saved before you open the file.
6. Before you report a cause
- Write the prediction and what would refute it before the run.
- Say MEASURED (with n), READ IN CODE or ASSUMED.
- Try to refute it: if this were the cause, what else would have to be true? Is it on the submitting thread's chain?
- Post numbers only: no logs, captures, shader or pipeline names that are not already in the repository, addresses of the title, or other game data.