Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
efa6c5e
fix(tools): preserve native provenance in title runs
Nov 17, 2026
80040dc
test(tools): place provenance cases beside related coverage
Nov 17, 2026
9d3a0f5
fix(tools): retain malformed native summary evidence
Nov 17, 2026
af1ed24
fix(tools): qualify title comparisons with recorded context
Nov 17, 2026
9837d92
fix(tools): distinguish incomplete short title observations
Nov 17, 2026
0c4a307
fix(tools): preserve per-run machine evidence
Nov 17, 2026
46274b6
fix(tools): integrate runtime staging with short observations
Nov 17, 2026
20028d4
chore(tools): refresh native provenance tests onto main
Nov 17, 2026
bf93dd3
chore(tools): retain refreshed provenance history in context comparisons
Nov 17, 2026
0896018
fix(tools): retain refreshed comparison prerequisite history
Nov 17, 2026
9371271
chore(tools): refresh per-run evidence with current comparison history
Nov 17, 2026
3828aba
fix(tools): report configured cache policy for title runs
Nov 17, 2026
ac1c4fa
chore(tools): compose cache and short-observation reports
Nov 17, 2026
c841798
test(tools): integrate current title and recipe coverage
Nov 19, 2026
d775fe7
test(tools): integrate current title and recipe coverage
Nov 19, 2026
ac2e5ba
test(tools): retain updated prerequisite history
Nov 19, 2026
ca76386
test(tools): integrate current title and recipe coverage
Nov 19, 2026
77cd766
test(tools): integrate current title and recipe coverage
Nov 19, 2026
3a3d744
test(tools): retain updated prerequisite history
Nov 19, 2026
fdfe260
test(tools): integrate current title and recipe coverage
Nov 19, 2026
e198b5d
test(tools): retain updated prerequisite history
Nov 19, 2026
d76906b
test(tools): retain updated prerequisite history
Nov 19, 2026
738c048
test(tools): retain updated prerequisite history
Nov 19, 2026
3b38a3d
test(tools): reflect platform cache capabilities in title comparisons
Nov 19, 2026
cc28a49
test(tools): provide runtime identity in end-to-end bisect fixture
Nov 19, 2026
dcd0b21
test(tools): retain prerequisite bisect fixture coverage
Nov 19, 2026
d82488b
test(tools): retain prerequisite bisect fixture coverage
Nov 19, 2026
934eb0b
test(tools): retain prerequisite bisect fixture coverage
Nov 19, 2026
0bc0e4c
test(tools): retain prerequisite bisect fixture coverage
Nov 19, 2026
50ec886
test(tools): retain prerequisite bisect fixture coverage
Nov 19, 2026
6406e32
Merge remote-tracking branch 'upstream/main' into codex/title-run-lau…
DonRyuzaki Nov 19, 2026
ed10f83
fix(tools): report title launch errors
DonRyuzaki Nov 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,9 @@ if(BUILD_TESTING)
add_test(NAME title_run_identity COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_title_run_identity.py)
set_tests_properties(title_run_identity PROPERTIES TIMEOUT 30)
add_test(NAME title_run_machines COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_title_run_machines.py)
set_tests_properties(title_run_machines PROPERTIES TIMEOUT 30)
add_test(NAME performance_compare COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_performance_compare.py)
set_tests_properties(performance_compare PROPERTIES TIMEOUT 20)
Expand All @@ -952,6 +955,18 @@ if(BUILD_TESTING)
add_test(NAME title_run COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_title_run.py)
set_tests_properties(title_run PROPERTIES TIMEOUT 60)

foreach(cache_policy_class CachePolicyFactsTests CachePolicyContextTests CachePolicyCliDefaultsTests
CachePolicyCliOverrideTests CachePolicyCliFlagsTests CachePolicyAggregateTests)
add_test(NAME title_run_cache_${cache_policy_class} COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_title_run_cache.py ${cache_policy_class})
set_tests_properties(title_run_cache_${cache_policy_class} PROPERTIES TIMEOUT 30)
endforeach()
foreach(observation_class ShortObservationTests LongObservationTests)
add_test(NAME title_run_observation_${observation_class} COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_title_run_observation.py ${observation_class})
set_tests_properties(title_run_observation_${observation_class} PROPERTIES TIMEOUT 30)
endforeach()
foreach(performance_capture_class WindowParsing CaptureEnvironment CompletedCapture InvalidSummaries InvalidTraces BoundsAndLinks LossEvidence)
add_test(NAME performance_capture_${performance_capture_class} COMMAND ${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/tools/tests/test_performance_capture.py ${performance_capture_class})
Expand Down
4 changes: 4 additions & 0 deletions docs/dev/PERFORMANCE_BISECT.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ The known-good revision must be an ancestor of the known-bad revision. The tool

Each tested revision runs `title_run.py` repeatedly with one measured run per invocation. The median FPS is compared with the good endpoint. A search stops instead of guessing if the bad endpoint is not slow enough, a run fails to render, the machine/title/content identity changes, or sample spread exceeds `max_spread_pct`.

Each sample requires clean native runtime provenance matching the requested commit as well as the clean source checkout. Native trace `commit`/`dirty` and run-report `anyps5.commit`/`modified` are checked together, including all recorded intervals. A missing, unknown, modified or conflicting identity stops the search. Historical title runners that omit native identity cannot provide a qualified sample; their saved metrics remain readable by the title-run comparison.

Machine identity comes from the measured run's `machine` record. A present but malformed or incomplete record never falls back to the batch aggregate. A legacy summary without that record can use global machine fields only when the actual file contains exactly one title and one run; a multi-title aggregate does not identify the measured run. This exception preserves older single-title recipes without treating reported identities as hardware attestation. The existing required machine fields are unchanged.

## Read the report

The command prints the first measured regression and its previous good commit. The optional JSON report records those commits, the supplied endpoints, the percentage threshold, the sample spread limit, the first-parent method, its monotonicity assumption, and every commit actually measured. `tested_commits` can be much smaller than `commits_between` because the search is logarithmic; it is not a claim that every commit was benchmarked.
Expand Down
6 changes: 5 additions & 1 deletion docs/dev/TRACING.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,18 @@ See [Build](BUILD.md#performance-trace) for the trace format, summary fields and

## Running titles repeatably

`python tools/title_run.py --games <directory> [ID ...]` relinks and runs extracted title packages found under `--games` (a directory holding `eboot.bin` and `sce_sys/param.json`) and writes `summary.json` and a fixed-format `summary.md` under `--out` (default `build/title-runs/<commit>-<time>-<unique>/`). Each title runs `--runs` times (default 2): the first with empty AnyPS5 and Mesa or NVIDIA shader caches, the next ones keeping them. AMD's Windows `VkCache` is not isolated. On Windows the title's windows open behind every other window, without focus and without being minimized, and can be brought forward from the taskbar; elsewhere run it under a virtual display if that matters. A run ends as `relink-failed`, `crashed`, `exited`, `stalled` (no present in the last 20 s, or too few presents for a frame to be dumped), `frame-unreadable` (the last dumped frame is truncated or not a 24- or 32-bit BMP), `blank` (the last frame is one colour) or `rendering`; the first, middle and last dumped frames are kept. A screen that presents only when its view changes stops after a few presents and is reported `stalled` although the title still answers input; pressing a button through `tools/pad_input.py` with `APS5_PAD_INPUT_FILE` set tells it apart from a stuck title. `--compare <summary.json>` lists regressions, improvements and missing titles against an earlier run, limited to the IDs given when there are any. Titles are prepared in `<out>/work/<ID>/`, the same path on every run, so a firewall prompt for a title that opens a port appears once; answering Cancel does not affect the run. An invocation locks `<out>/work/<ID>.lock` for each title it runs before touching anything, and refuses to start while another invocation with the same `--out` holds one of them. Per-title relink flags, run length and environment live in `tools/titles.json`. It also compares the last run of each title that both summaries hold by numbers: the FPS of the trace summary, the `averageFps` and `frameMs` percentiles (p50, p90 and p99) of `anyps5-report.json`, the `compiled`, `failed` and `cacheHits` shader counts, and the functions in `missing.functions` and the instructions in `shaders.unsupported`, each split into only before, only now and in both. A value the report does not hold reads `not recorded` on that side; the lists are partial when `truncated` is above zero. `--json` prints that comparison as JSON instead of the table. `--smoke` runs the titles marked `"smoke": true` in `tools/titles.json` instead of named IDs: a start-up check for changes to the relinker, the module loader or libc start-up, which can break every title at second 0 (#7665). The set is DriftCheck (PPSA98766, the smallest import table), DOOM (PPSA99666), Jelly5 (PPSA99505), SymphonyStation5 (PPSA17641), PS5SX2 (PPSA99203, `--trap-sdk-syscall-stubs` and the most libc imports) and VLC (PPSA85300, `--registry`). A `--module-dir` directory among a title's relink flags is staged for the relinker like `sce_module/`, so a Unity title lists `--module-dir Media/Modules --module-dir Media/Plugins` as [GAME_TESTING.md](GAME_TESTING.md) describes. A title's `pad` entry holds a controller timeline in the [`tools/pad_timeline.py` format](../user/INPUT_MAPPING.md#controller-timelines) (`events`, and optionally `repeat` and `gap_ms`); each run sets `APS5_PAD_INPUT_FILE` to `pad-input.txt` in the work directory and queues the timeline `after_s` seconds after start (default 5), since commands already in the file when the title first reads its controller are ignored. Each run reports `pad_queued_s`, or null when the title ended first. The timeline follows wall time, not frames, so the title's path differs between runs.
`python tools/title_run.py --games <directory> [ID ...]` relinks and runs extracted title packages found under `--games` (a directory holding `eboot.bin` and `sce_sys/param.json`) and writes `summary.json` and a fixed-format `summary.md` under `--out` (default `build/title-runs/<commit>-<time>-<unique>/`). Each title runs `--runs` times (default 2). Cold and Warm name the requested sequence: the work directory and default AnyPS5 and Mesa/NVIDIA cache paths start fresh, then are retained. Per-run `cache_policy` records the configured cache controls and explicit overrides, and the report shows their common or mixed configuration. Overrides and disable requests remain in the child environment; their caches are not cleared or certified cold. The comparison checks every recorded run policy and treats legacy or malformed policy as unknown; it does not measure driver cache hits or warmth. AMD's Windows `VkCache` is not isolated. On Windows the title's windows open behind every other window, without focus and without being minimized, and can be brought forward from the taskbar; elsewhere run it under a virtual display if that matters. A run ends as `relink-failed`, `launch-failed` (the OS rejected process startup), `crashed`, `exited`, `incomplete` (still running without a summary when the observation ends before 20 s), `stalled` (no present in the last 20 s, or too few presents for a frame to be dumped), `frame-unreadable` (the last dumped frame is truncated or not a 24- or 32-bit BMP), `blank` (the last frame is one colour) or `rendering`; the first, middle and last dumped frames are kept. An incomplete observation keeps its frames but records no measured FPS in the report or comparison and has no improvement or regression rank. Short runs with a completed summary retain their usual outcome; a clean early exit remains `exited`. A screen that presents only when its view changes stops after a few presents and is reported `stalled` although the title still answers input; pressing a button through `tools/pad_input.py` with `APS5_PAD_INPUT_FILE` set tells it apart from a stuck title. `--compare <summary.json>` lists regressions, improvements and missing titles against an earlier run, limited to the IDs given when there are any. Titles are prepared in `<out>/work/<ID>/`, the same path on every run, so a firewall prompt for a title that opens a port appears once; answering Cancel does not affect the run. An invocation locks `<out>/work/<ID>.lock` for each title it runs before touching anything, and refuses to start while another invocation with the same `--out` holds one of them. Per-title relink flags, run length and environment live in `tools/titles.json`. It also compares the last run of each title that both summaries hold by numbers: the FPS of the trace summary, the `averageFps` and `frameMs` percentiles (p50, p90 and p99) of `anyps5-report.json`, the `compiled`, `failed` and `cacheHits` shader counts, and the functions in `missing.functions` and the instructions in `shaders.unsupported`, each split into only before, only now and in both. A value the report does not hold reads `not recorded` on that side; the lists are partial when `truncated` is above zero. `--json` prints that comparison as JSON instead of the table. `--smoke` runs the titles marked `"smoke": true` in `tools/titles.json` instead of named IDs: a start-up check for changes to the relinker, the module loader or libc start-up, which can break every title at second 0 (#7665). The set is DriftCheck (PPSA98766, the smallest import table), DOOM (PPSA99666), Jelly5 (PPSA99505), SymphonyStation5 (PPSA17641), PS5SX2 (PPSA99203, `--trap-sdk-syscall-stubs` and the most libc imports) and VLC (PPSA85300, `--registry`). A `--module-dir` directory among a title's relink flags is staged for the relinker like `sce_module/`, so a Unity title lists `--module-dir Media/Modules --module-dir Media/Plugins` as [GAME_TESTING.md](GAME_TESTING.md) describes. A title's `pad` entry holds a controller timeline in the [`tools/pad_timeline.py` format](../user/INPUT_MAPPING.md#controller-timelines) (`events`, and optionally `repeat` and `gap_ms`); each run sets `APS5_PAD_INPUT_FILE` to `pad-input.txt` in the work directory and queues the timeline `after_s` seconds after start (default 5), since commands already in the file when the title first reads its controller are ignored. Each run reports `pad_queued_s`, or null when the title ended first. The timeline follows wall time, not frames, so the title's path differs between runs.

The summary's `build` records the source checkout. Each run's `native` keeps trace `commit`/`dirty` identities and run-report `anyps5.commit`/`modified` separately. Comparisons report whether this native evidence matches the clean source checkout, differs, is modified, conflicts or is unknown. Malformed and non-object summary protocol rows retain counts in `native.summary_errors` and cannot qualify as matched; valid metrics remain readable. Ordinary log records outside the summary protocol are ignored. Missing identity in an older summary remains unknown while its metrics stay readable. Matching describes the runtime's compiled identity metadata; it does not attest the bytes of every loaded library.

Keep `--out` outside extracted packages and inputs, including configured `--content` source files, outside `<out>/work/`; the runner checks for overlapping paths and aliases before clearing work. Title selection does not exclude other discovered packages from these checks. Module directories must be relative paths inside the package (`.` is allowed). On Linux, `/proc/self/fdinfo/` must be readable, and work directories cannot cross mount boundaries.

A title's `files` in `tools/titles.json` adds files to its prepared folders before each run. Each key is a path under `app0/`, `data/` or `download0/`, and each value is either `{"text": ...}`, written as given, or `{"content": <path>}`, copied from the directory passed with `--content`. Content is data that cannot be committed, such as a game's own data files. A title whose content is missing still runs, and `summary.md` lists it under `Ran without content`. vkQuake (PPSA99010) reads `quake/pak0.pak`, which is `id1/pak0.pak` from id Software's shareware `quake106.zip` (MD5 `5906e5998fc3d896ddaf5e6a62e03abb`). Its entry also turns off ray-traced shadows: their first compute pipelines take longer to build than the title waits for the GPU (#6118). Afterglow (PPSA47770) runs with `APS5_ASYNC_PIPELINE_WORDS=1000000`: the pipeline of a 95,468-byte pixel shader, about 2.5 million SPIR-V words, takes longer to build on the draw than the title waits for the submission to retire, and the title then exits with `submission retirement failed` on every start. VLC (PPSA85300) reads `vlc/testsrc2-720p.mp4`, made with `ffmpeg -f lavfi -i testsrc2=size=1280x720:rate=30 -f lavfi -i sine=frequency=440:sample_rate=48000 -t 20 -c:v libx264 -profile:v high -pix_fmt yuv420p -c:a aac -b:a 128k -movflags +faststart testsrc2-720p.mp4`, skips its first-run setup through `prefs.txt`, and plays the clip from its library with one Cross press. Ruffle Flash (PPSA68091) reads `ruffle/testsrc2.swf`, made with `ffmpeg -f lavfi -i testsrc2=size=640x360:rate=24 -t 20 -c:v flv1 -q:v 5 -an testsrc2.swf` (Sorenson H.263 frames; ffmpeg's JPEG-frame SWF stays on its first frame in Ruffle), and plays it from its library with one Cross press; its built-in demo is an empty 18-byte SWF.

`SDL_AUDIODRIVER` is inherited and defaults to `dummy` (silent); set it to `wasapi` or another SDL driver to exercise a title's audio path.

Each smoke run preserves its reported OS, GPU, driver and CPU in `machine`. The summary's `machine` contains only nonempty fields shared by every run; mixed or missing fields stay empty, and the Markdown lists per-run evidence. Comparison context uses the selected title's ordered `runMachines`, including cold and warm runs. Its scalar machine fields describe the last run, like the numeric pairs. Missing per-run fields, including older summaries with only a global machine record, remain unknown and cannot qualify an improvement or regression. These are reported identities, not hardware attestation; native build provenance is checked separately.

## CSV exports

- `tools/performance_csv.py <baseline> <candidate>` exports a performance comparison as CSV. Empty metric cells mean the value was not reported; `--require-matching-context` fails when the two captures differ in machine or scene, and `--spreadsheet-safe` escapes cells that spreadsheets would evaluate.
Expand Down
22 changes: 18 additions & 4 deletions tools/performance_bisect.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import tempfile
from pathlib import Path

import title_run_provenance

TOOLS_DIR = Path(__file__).resolve().parent
PLACEHOLDERS = ("worktree", "build_dir", "result_dir", "commit")
Expand Down Expand Up @@ -104,17 +105,30 @@ def sample_summary(path, title_id, commit):
built_commit = build.get("commit")
if not isinstance(built_commit, str) or not 7 <= len(built_commit) <= 40 or not commit.startswith(built_commit) or build.get("dirty") is not False:
raise ValueError(f"{path}: measured build is not the requested clean commit {commit}")
machine = summary.get("machine")
title = summary.get("titles", {}).get(title_id)
if not isinstance(machine, dict) or not isinstance(title, dict):
raise ValueError(f"{path}: title runner summary is missing machine or title data")
titles = summary.get("titles")
title = titles.get(title_id) if isinstance(titles, dict) else None
if not isinstance(title, dict):
raise ValueError(f"{path}: title runner summary is missing title data")
run_list = title.get("runs")
if not isinstance(run_list, list) or len(run_list) != 1 or not isinstance(run_list[0], dict):
raise ValueError(f"{path}: expected exactly one measured title run")
run = run_list[0]
fps = run.get("fps")
if run.get("outcome") != "rendering" or type(fps) not in (int, float) or not math.isfinite(fps) or fps <= 0:
raise ValueError(f"{path}: title did not render with a finite positive FPS measurement")
native = title_run_provenance.qualification(run, {"commit": commit, "dirty": False})
if native["status"] != "matched":
raise ValueError(f"{path}: native runtime provenance is {native['status']}; expected clean commit {commit}")
if "machine" in run:
machine = run["machine"]
if not isinstance(machine, dict) or any(not isinstance(machine.get(key), str) for key in ("os", "gpu", "driver", "cpu")):
raise ValueError(f"{path}: measured run has incomplete or malformed machine data")
if any(not machine[key].strip() for key in ("os", "gpu", "driver")):
raise ValueError(f"{path}: measured run has missing required machine data")
else:
machine = summary.get("machine")
if len(titles) != 1 or not isinstance(machine, dict):
raise ValueError(f"{path}: legacy machine data does not identify the measured run")
identity = {key: machine.get(key, "") for key in ("os", "gpu", "driver", "cpu")}
identity.update(title_id=title_id, title=title.get("name", ""), content_version=title.get("version", ""))
if any(not identity[key] for key in ("os", "gpu", "driver", "title")):
Expand Down
Loading
Loading