Skip to content

Built-in benchmark, first version: scenes from a scratch save at the 30 fps cap - #278

Merged
mamcjr merged 4 commits into
mamcjr:mainfrom
Propinbo:benchmark-mvp
Nov 8, 2026
Merged

mamcjr merged 4 commits into
mamcjr:mainfrom
Propinbo:benchmark-mvp

Conversation

@Propinbo

@Propinbo Propinbo commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Part of #214.

What it does

Each scene runs from a scratch copy of the player's save, with position, time, Blood Moon and hearts edited in the copy. The runtime reboots in place, presses Continue, holds time and weather, turns the camera with the stick to the scene's angles, warms up, measures, and writes a report. It exits after the last scene. The original save and settings are only read.

title -> arrive (Link's X, Z, main field) -> settle 3 s -> camera (closed loop, 0.5 degrees)
  -> warm-up -> window -> check (Link still, camera, time, weather) -> report, next scene or exit

The warm-up lasts until 20 s pass without a compile or a draw skipped for one (at most 180 s), so the measurement window starts after a cold cache's burst of compiles. GPU p50 in the lab's first window from a cold cache was 26.78 to 27.06 ms, against 26.43 to 27.24 ms warm, apart from one warm 28.49. Frame pacing doesn't always match: 4 of 8 windows in cold-cache runs had 1294 to 1345 frames instead of 1351 (1% low 24.2 to 26.6 fps), while all 39 warm windows had 1351 (1% low at least 29.08 fps). The two cold-cache runs that started at thermal status 0 had none of these, the two that started at 2 had all four, and I don't know the cause.

1.9.0 only; other versions stop with unsupported version. No change in tools/patches.py, so GAMELIB_ID stays and nobody rebuilds. Without the variable each hook is one bool check.

How to turn it on

adb push tools/benchmark-scenes.txt /sdcard/Android/data/com.botwrecomp.android/files/scenes.txt
adb shell am start -n com.botwrecomp.android/com.botwrecompandroid.BOTWRecompAndroidActivity --es env LARECOMP_BENCHMARK=/sdcard/Android/data/com.botwrecomp.android/files/scenes.txt

The report goes to <scene file>.out/. It needs a save past the Great Plateau, on the main field. Without adb there is no way in the app: LARECOMP_* come only from the launch intent's env extra, and the settings file doesn't set them. Another app that can send that intent should work, but I haven't tried it.

Formats

Scene file (tools/benchmark-scenes.txt, scene_format 1):

format = 1
repeats = 3
warmup_s = 20
calm_s = 20
warmup_max_s = 180
window_s = 45

[scene]
name = hateno-lab
pos = 3777.5 356 2112.5
time = 90
weather = 0
yaw = -70.2
pitch = 0

report.json (report_format 1), one result, shortened. report.csv has one row per scene and repeat, frames.csv every frame. A scene gets ok, or harness_error with the step and the reason.

{"scene": "hateno-lab", "repeat": 0, "status": "ok", "load_s": 19.5, "warmup_s": 33.7,
 "frames": 1351, "fps": 30.0, "low_1pct_fps": 29.38, "low_01pct_fps": 29.26, "over_50ms": 0,
 "frame_ms": {"p50": 33.331, "p95": 33.777, "p99": 33.973},
 "gpu_ms": {"p50": 27.136, "p95": 33.026, "p99": 34.519},
 "cpu_ms": {"p50": 17.268, "p95": 20.343, "p99": 22.318},
 "skipped_building": 91, "shader_compiles": 2, "display_hz_end": 120.0,
 "power_start": {"thermal": 0, "plugged": 2}, "power_end": {"thermal": 0, "plugged": 2}}

The passport has GPU, driver, Android, model, SoC, APK version, commit (-dirty with uncommitted source changes, unknown where git can't say), Native or Recompiled, settings, shader cache size and power, with no serial numbers. shader_cache_at_start is cold if the SPIR-V cache missed during the first scene's load and warm-up, else warm.

How it was checked

SM-X730, Mali-G925, 1.9.0, 120 Hz, on USB. Three scenes × 3 repeats, one launch per mode, about 17 min each. 30.00 fps, 1351 frames per window, no frame over 50 ms, no harness_error. The report's numbers match a recomputation from frames.csv. These full runs are from the commit before the last one, which changes the report's statuses and fields, and has the warm-up wait on compile-related skips only. The last commit got the short runs below.

GPU p50 in ms:

Scene Recompiled Spread Native Spread
plateau 26.87, 26.81, 26.82 0.22% 26.80, 26.84, 26.80 0.15%
hateno-lab 27.24, 27.15, 27.07 0.60% 27.06, 27.12, 26.43 2.56%
hateno-village 26.84, 26.80, 26.88 0.30% 26.86, 26.85, 26.80 0.19%

From a cold shader cache, lab in Recompiled, 3 repeats, run twice:

Run Repeat 1 Repeat 2 Repeat 3
1 26.78 28.39 27.11
2 27.06 28.69 27.16

The 28.4-28.7 values are not a shader cache effect: the second run's window had no compile and no skipped draw. In these windows and one warm one, GPU time reaches about 31 ms for 15-25 s, and I don't know why. At this cap DVFS lowers clocks until the frame fits, so these numbers show repeatability and aren't a measure of GPU power.

shader_cache_at_start on the last commit, one lab window each: an empty cache in Recompiled gave cold, a warm cache in Recompiled and in Native gave warm. The commit field read 6a808ef920e6-dirty when built with changes and 08fb8f58dd80 when built from that commit.

Without the flag, against a stock v0.3.1-beta build, one 100 s run each, last 900 frames (this build is the commit before the last one):

Period p50 GPU p50 Over 50 ms
Stock R / this R 33.34 / 33.34 26.99 / 27.04 0 / 0
Stock N / this N 33.34 / 33.33 26.81 / 27.06 0 / 0

No extra files and no benchmark log lines.

Failure paths seen on the device: unreachable pitch, far position, event in the window and missing save each give harness_error at their step; a bad scene file and a scene file inside the save's folder stop with a message; a throwaway build with the version check flipped shows unsupported version and exits after OK. Hashes of the source save and of the player's save and settings were unchanged after the runs that used them.

Not tested: a real game version other than 1.9.0, a save in a shrine, several save slots, inverted camera options, a crash during a run, other devices and refresh rates. Hearts were checked on screenshots only.

Not in this version

  • Fast travel, and any movement: Link stands still, so world streaming while moving isn't measured.
  • fps_mode=4 and other passes without the cap: cap30 only.
  • Checks: oracles, image comparison, pass or fail against a threshold.
  • Hooks: no change in tools/patches.py, no calls into game functions.
  • Waiting for the device to cool: the thermal status is reported only, and it reached 3 in these runs.

Merge Danger

Door: two-way

Revert removes it. No save format, settings format or game code changes. A run updates the shader cache, like a normal session.

Blast Radius: small

With the flag off the new code is bool checks in rt_vfr_update, input_frame and vk_pace_frame, plus counters beside the existing ones in exec.c and shaders.c, and a git call on every build. The nativeDeviceStats JNI signature changes on both sides. With the flag on it writes to game memory at 1.9.0 addresses, on the scratch save's run.

Propinbo and others added 4 commits November 4, 2026 20:59
…eport

LARECOMP_BENCHMARK=<scene file> (off by default; 1.9.0 only, other versions stop
with "unsupported version"). The runtime copies the player's save to a scratch
folder, edits position, time, Blood Moon and hearts in the copy, reboots in place,
presses Continue, holds time (TimeMgr) and weather (world::Manager) from
rt_vfr_update, turns the camera with the stick using the camera's own angles, warms
up, measures at the 30 fps cap and writes report.json, report.csv and frames.csv.
No change in tools/patches.py, so GAMELIB_ID stays.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The warm-up now lasts until calm_s (20 s by default) pass without a compile or a
skipped draw, up to warmup_max_s (180 s). A window that still had some gets the
status cache_cold, with its numbers; the summary gives the median and spread for
clean repeats and for all measured ones. report.csv has the thermal status at the
window's start and end.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A scene file inside the save's folder is refused: the output would have gone into
the save. The run ends with exit(), so the pipeline cache is kept. Yaw, pitch and
position are range-checked, long paths refused. A window with no frames, or an
unreadable camera at its end, is a harness_error. The frame after a long one has no
GPU time: the pacer's has both frames in it. plugged is -1 until the first report.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…goes in the passport

A window's status no longer depends on the shader cache: each keeps its numbers,
skipped_building (draws skipped because their pipeline is still compiling) and
shader_compiles, with no verdict. The warm-up waits on those two only.
shader_cache_at_start in the passport is cold when the SPIR-V cache missed before
the first window, else warm.

The commit in the report is asked of git on every build, with -dirty for changes in
the sources, unknown where git can't say. It was set at configure time and went stale.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

2 participants