tools: d3d12_ab_compare reads an A/B of the D3D12 runtime (D3D12-AB-COMPARE) #2783
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!2783
Loading…
Reference in a new issue
No description provided.
Delete branch "d3d12-ab-compare"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Pull request successfully merged and closed
Claimed in the coordination issue as: D3D12-AB-COMPARE (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7289787850)
Depends on: #2782 for gate run folders (
summary.json). Logs work without it. #2779 adds theA/B countersline thatphasesreads when present.What and why
docs/measuring_fps.mdtells how to read an A/B: neighbouring pairs, the effect with its standard error, and ABBA after a throwaway run. But the scripts it named (ab_pair.py,ab_eff.py) were never in the repository, so everyone computed it by hand. Testers' verdicts from two runs a side turned out to be noise (enlighted on the bridge).tools/d3d12_ab_compare.py(standard library, reusingtools/d3d12_run_fps.py's reader):abba A:<run> B:<run> B:<run> A:<run> ...takes the runs in the order they ran: a gate folder, whosesummary.jsongives the world median of the presents and leaves out runs that did not PASS, or a log, whose frame lines at 1,000 draws a frame or more count as the world.phases <log>does the same inside oneLEONIDA_ABrun, per switch: blocks of 2^s phases off and on, one difference per pair of blocks. It covers the median frame time and every counter of theA/B countersline (#2779). It leaves out a pair whose draws a frame differ by more than a tenth (a change of scene, not of the switch);--keep-draw-jumpskeeps it.plan --pairs 4 [--switch]prints a balanced order: two warm-ups, then a discarded run that ends on the first measured side, then ABBA.--json. Numbers only: never a log line, a path or an argument's text.docs/measuring_fps.mdsections 2 and 3 now point to it instead of to the missing scripts.Tested
On Windows 11:
tests/test_d3d12_ab_compare.py, 13 tests, all passing, on synthetic numbers and logs:phaseswith counters, and a scene change left out;planorders;The file runs in the standard-library CI loop.
test_d3d12_run_fps.py,test_docs_design_rows.py,test_ci_registration.py,check_no_game_data.pyandgit diff --checkare clean.GPUs tested: n/a (a standard-library tool; checked on Windows 11 Pro 10.0.26300).
AI-assisted: yes
Checklist
mainand merges cleanly.docs/design.md, with how it was confirmed. (Not applicable.)Verified by OreoFR on macOS 27.2.1, Apple M5, Python 3.12.16,
main0f86bd594merged with head76b543a09.tests/test_d3d12_ab_compare.py13 passed. Red (main+ only the test): 1 error at import, as expected for a new tool.python -I scripts/check_no_game_data.pyontools/d3d12_ab_compare.pyanddocs/measuring_fps.md: clean.main):tests/test_docs_repo_paths.py::DocsRepoPaths::test_docs_name_existing_paths,('docs/measuring_fps.md:67', 'scripts/game-gate.ps1'). That script comes from #2782, which is not merged, so this PR depends on it: eitherDepends on: #2782in the body and merge after it, or drop the path from line 67 here.AI-assisted: Claude Code
Thanks for the Mac run.
test_docs_repo_pathsfailed here too:docs/measuring_fps.mdnamedscripts/game-gate.ps1, which only #2782 adds. Fixed in c05f43403 by naming the game gate's run folders instead (doc and the tool's docstring), so this PR stays independent of #2782.On Windows at c05f43403:
tests/test_docs_repo_paths.pyOK,tests/test_docs_cli_flags.pyOK,tests/test_d3d12_ab_compare.pyOK (13),scripts/check_no_game_data.pyon the changed files OK, merge with currentmainclean.Re-checked by OreoFR on the new head
c05f43403merged withmain0f86bd594(macOS 27.2.1, Apple M5, Python 3.12.16):tests/test_d3d12_ab_compare.py13 passed;tests/test_docs_*.py57 passed, 133 subtests passed (thetest_docs_repo_pathsfailure is gone, and the PR no longer depends on #2782);check_no_game_data.pyon the three changed files: clean. Not covered: a real A/B log from the game.AI-assisted: Claude Code
CI
checkandlinux-python-and-viewerfailed ontests/test_tool_stdout_encoding.py:tools/d3d12_ab_compare.py's__main__block did not seterrors="replace"on stdout. Fixed in e4318f01f with the same guard astools/d3d12_run_fps.py. On Windows:test_tool_stdout_encoding.pyOK,test_d3d12_ab_compare.py13 OK, merge with currentmainclean.Re-checked by OreoFR on the new head
e4318f01fmerged withmaind8ca18240(macOS 27.2.1, Apple M5, Python 3.12.16):tests/test_d3d12_ab_compare.py13 passed;tests/test_tool_stdout_encoding.py4 passed (the new stdout guard);tests/test_docs_*.py57 passed.AI-assisted: Claude Code
Verified by MoonEyes (another person than the author) on head
e4318f01fmerged withmaind8ca18240: Windows 11, Python 3.14.tests/test_d3d12_ab_compare.py13 OK. Docs andtest_tool_stdout_encodingOK. Red: the test does not import without the new tool. No game run from me (#2782 was run by enlight3d on an RTX 3090).AI-assisted (Claude Code).
Merging. Head
e4318f01fmerges cleanly withmaind8ca18240and does not force a rebase of #2566. Tool and doc, not the runtime; checked by OreoFR and MoonEyes on this head. Merged by MoonEyes.AI-assisted (Claude Code).
RUN (independent run on Windows, #2783 head e4318f01f, tested as it is; it merges cleanly into main 407f71a23 per
git merge-tree --write-tree. CI on e4318f01f: change-scope, check, linux-python-and-viewer, no-game-data and semantic-tests all pass. Since 76b543a09, the head I tested first, only one sentence ofdocs/measuring_fps.md, the module docstring, and the 4-line stdout guard in the__main__block oftools/d3d12_ab_compare.pychanged. The verdict and pairing code is the same.)Commands, from the repository root,
python -I(Python 3.13.12), at low priority:python -I -m unittest discover -s tests -p test_d3d12_ab_compare.pyon e4318f01f: 13 tests OK.python -I -m unittest discover -s tests -p test_tool_stdout_encoding.pyon e4318f01f: 4 tests OK. On c05f43403, without the guard,test_every_main_block_reconfigures_stdoutfails and namestools/d3d12_ab_compare.py, so the guard is what that test asks for.ImportError, nod3d12_ab_compare).lo > 0 or hi < 0condition removed):test_a_drift_alone_in_an_unbalanced_order_is_no_effectfails. Caught on 76b543a09 and again on e4318f01f.e["agree"] >= e["k"] - 1condition removed, so one odd pair no longer blocks "B faster"/"B slower"). All 13 tests still pass, on 76b543a09 and on e4318f01f. No test covers the "all pairs but one agree in sign" rule that the PR anddocs/measuring_fps.mddescribe. That is a gap in coverage, not a bug seen. A test with 4 balanced pairs whose interval leaves 0 out but where two pairs go the other way would close it.test_d3d12_run_fps.py(the reader this tool reuses) 22 OK.Real data (RTX 3090, leonida.exe, in the order the runs ran):
abbaread three of our A/B series of 2 runs per side: the lot C split (main against two halves reverted), LEONIDA_REAPER=0 against default, and #2753's switch off against on. Its per-run median frame times match my own analysis (for example 63.2 ms for the run I measured at 15.8 fps). It answered 'not enough runs' for all three (2 pairs, under its 4), which agrees with what those series could support: no established difference between arms in any of them.plan --pairs 3gives warm-ups and throwaway runs per side, then A B B A A B. (Those real-data runs used 76b543a09. Between 76b543a09 and e4318f01f,git diffshows only the doc sentence, the docstring and the stdout guard, none of which touches reading, pairing or the verdict, so they still hold.)Machine: Windows 11 Pro 26300, i9-13900K, 64 GB, RTX 3090 24 GB, NVIDIA 621.40.