tools/tune_gpu.py tests execution strategies and then tries combinations around the fastest candidates.
It searches NVN storage ordering, descriptor sets versus descriptor buffers, Vulkan recording, guest thread scheduling
and buffer memory paths. Storage ordering only competes when the log confirms that the NVN loader is active.
It searches compiler worker counts when the logs show compilation. Resolution, shadows, filtering and effects stay fixed. Async pipelines stay off,
so a candidate cannot win by skipping draws. It does not edit source code or apply settings.
python3 tools/tune_gpu.py GAME --script '15000:1,25000:1' --out /local/scratch/gpu-search --reset-save
python3 tools/tune_gpu.py GAME --state SLOT --warmup 20 --seconds 60 --out /local/scratch/gpu-search
Use a quiet scene with a fixed camera and no combat. Use the input script that reaches it. The default run lasts 90 seconds and measures after 55 seconds. Keep at least 20 seconds after warmup. A state must restore gameplay and present frames. A successful state-load message alone does not qualify a run. Python 3.10 or later and Pillow are required.
The first run warms caches. Screening tries up to 12 configurations. Two finalists and the baseline then get two
fresh runs each, in shuffled order. --trials, --finalists and --confirm set those budgets. --plan prints the
initial candidates without starting a game. --base key=value sets the starting configuration, such as
--base vk_record=0. The search disables frame limits and VSync to measure throughput. It also disables diagnostic
GPU profiling and buffer counters during timing. Do not build or run another game during the search.
The score combines mean presentation time with excess time in frames over 50 ms. Lower is better. Boot and loading frames before warmup do not count. A candidate must finish, present frames in the measured window, and produce a nonblank screenshot at the reference resolution. It must beat baseline in every confirmation round, by more than the larger of 3 percent or the measured noise margin. A failed confirmation disqualifies it.
results.json holds every result and rejection. winner.json gives the fastest confirmed configuration, its launch
command and screenshots. The image check screens for large differences. It cannot prove correct rendering. Inspect
the finalist screenshots before applying the recommendation. --reference IMAGE supplies a known-good scene image,
and --image-error adjusts the normalized pixel-error limit for small animation changes. Do not relax it to accept
different camera views. A changed view changes the workload and cannot establish an optimization win. If nothing beats the
baseline consistently, the recommendation keeps the baseline.
With --reset-save, the standard GAME_data/save folder is copied into the output directory before the search,
restored before each run, and restored on normal exit or interruption. The backup remains in original-save for
recovery after a machine failure. Without that option, the game can update its saves normally. Keep the output local.
Made from docs/history/gpu-hotpath-bench.md at 69237645142c. GPL-3.0-or-later.