Repository navigation
Conversation
…oes not reset g_px_dcu / g_px_dcc, the DM_NVN_DC_UNWRITTEN / DM_NVN_DC_COVERED latches of the diagnostic commits seedds#225 replaced (botw-fx has them, my-main does not)
…platform mac along a fixed route and reports frame-time percentiles A route is a line of the profile's new bench.tsv: the scripted input (DM_KEYS, seconds from the start) and the measured window, from when the scene is loaded. Each run starts from a copy of the same save and reads the host's per-frame rows (DM_NVN_TSV): frame time (start to start) and time on screen at p50 / p95 / p99 / max, frames longer than 1.5 frame times, dropped frames, GPU time p50 / p95, the game's speed against real time where the frame step logs it, and the [RED] lines. Variants (environment switches, or another host, shader libraries, rewritten modules or pipeline archive) run in turn, repeated, and are reported as medians with their range in results.md / results.json beside each run's log, frames.tsv and two screenshots at the same moments. Breath of the Wild has three routes: a save in Zora's Domain with the camera turning and Link walking (zora-pan), the same standing still, and a probe for the load time. Used for the baseline in issue seedds#159: main + seedds#76 + seedds#158 on an M2 Max at 900p and a 120 fps target, three variants, two runs each. docs/development.md ("A benchmark on the Mac") and dm/games/README.md describe it; dm/tools/tests/test_bench.py checks the window, the percentiles (nearest rank) and that every bench.tsv parses.
… variable frame step); at 60 or 30 the host matches the screen to the cap itself, and the forced 120 Hz link ran Breath of the Wild at 2.4 times real time at --fps 60
…GPUPROF=every:<n>), pass dumps every n frames (DM_NVN_PASSDUMP=every:<n>), and in-process A/B phases (DM_AB=<frames>) - DM_NVN_GPUPROF=every:<n> profiles the frames that are multiples of n, each reported on its own, for a phone run whose scene cannot be timed to a frame number. A render pass line now also gives what the pass loaded and stored of its attachments (KB, the bandwidth ledger's view, counted from the previous pass end whether that pass was profiled or not) and the Metal pixel formats of colour attachment 0 and of depth / stencil; the frame line gives the render passes and their attachment traffic. - DM_NVN_PASSDUMP=every:<n> dumps one frame in every n, halfway between two profiled frames. - DM_AB=<frames> alternates the switches set to ab in phases of that many frames, and prints an [ab] line per phase: GPU and frame time (p50 / p90 / mean without the phase's first quarter), attachment traffic and passes per frame. ab:<k,...>/<n> runs four configurations of two switches. DM_NVN_BARRIER=ab is its first switch.
…[:<frames>], or gpu:<ms>[:<after frame>] for the first frame after 60 frames in a row past <ms> of GPU time - The trace goes to its own folder, DM_GPU_CAPTURE_DIR, by default gpu_captures/ in the working directory (the app's Documents on iOS, the run folder on the Mac), as dm_<date>-<time>_f<frame>.gputrace. A trace takes 1.5-2 GB, so before each capture that folder alone is pruned to the newest DM_GPU_CAPTURE_KEEP (default 2, the new one included); nothing outside it is removed. - The setting is read again when it changes, so the Mac's DM_CTL "env DM_GPU_CAPTURE=..." can set it while the game runs. 60 frames in a row: a single long frame in a light scene fired the first iPhone capture. - It captures the Metal 4 queue: Metal refuses to capture a Metal 4 device. A run that may capture (DM_GPU_CAPTURE or MTL_CAPTURE_ENABLED) builds its pipelines through the MTLDevice, because Metal cannot capture pipelines made from bases and its Metal 4 to 3 conversion for the capture layer crashed on the pipeline archive. - iOS: DM_METAL_CAPTURE=1 when build_ipa.sh makes the project adds MetalCaptureEnabled to the app's Info.plist, without which iOS writes no GPU trace. The Mac needs MTL_CAPTURE_ENABLED=1 in the environment.
…log or an iPhone's log.txt Per-frame totals (sum, span, idle time between encoders, draws, attachment traffic), then the mean per frame of each pass shape (size, colours, depth, pixel formats) or, with --by class, of each size class relative to the frame's largest colour pass (full, half, quarter ... per axis; passes with four colours or more, a deferred renderer's G-buffer, apart), so the split holds for every game and resolution. --timeline <frame> lists one frame's encoders in GPU order with the gaps between them; --ab gives the medians of the DM_AB phases per configuration and their difference from the base. Tested on a synthetic log (dm/tools/tests/test_gpuprof.py).
…s, development.md), and a reference entry: GPU frame captures need pipelines built through the device 05-debugging.md gets a recipe for profiling one frame in every n on the iPhone through Documents/env.txt, reading the [gpuprof] lines with dm/tools/gpuprof.py, A/B phases in one run (DM_AB) and captures for Xcode's Metal debugger. The reference entry (shaders.md, Pipelines and caches) explains why a run that may capture builds its pipelines through the MTLDevice and captures the Metal 4 queue; symptom index updated, and a line under Breath of the Wild's "Found on this game".
…oes not reset g_px_dcu / g_px_dcc, the DM_NVN_DC_UNWRITTEN / DM_NVN_DC_COVERED latches of the diagnostic commits seedds#225 replaced (botw-fx has them, my-main does not)
…oes not reset g_px_dcu / g_px_dcc, the DM_NVN_DC_UNWRITTEN / DM_NVN_DC_COVERED latches of the diagnostic commits seedds#225 replaced (botw-fx has them, my-main does not)
Add periodic encoder profiles with attachment traffic and formats, alternating A/B measurement phases, bounded Metal trace capture, and gpuprof.py log summaries. Preserve main's offline pipeline-archive integration while adding the capture build setting. Close periodic samples at frame boundaries through the last committed shared-event fence, so every:1 reports without mixing frames or reusing an unresolved heap. Add 28 CPU checks of production profiling code and include them in CI; document the mechanism and update the symptom index. Validated with all 31 CI-style Python test files, the profiling regression, a Mac host build, and all 133 iOS source compiles. Profiling completion and heap ownership were checked with synthetic counter/event objects; no new real-GPU or gameplay validation. Co-authored-by: v0lumehi <aljic.zijad@gmail.com>
|
Landed on main as fb20bce, after #191's benchmark commit, with Included the periodic GPU profiles, A/B phases, bounded Metal captures, log summaries and documentation. Fixed Validation: 28 synthetic production-code profiling checks, all 31 CI-style Python test files, the Mac host build, and all 133 iOS source compiles passed. Focused tests passed again after rebasing onto latest main. The profiling checks use synthetic counters and completion events; actual Metal callback timing and real-GPU/gameplay behavior have not been newly validated. Closing because the implementation and fixes have landed directly on main. |
…oes not reset g_px_dcu / g_px_dcc, the DM_NVN_DC_UNWRITTEN / DM_NVN_DC_COVERED latches of the diagnostic commits seedds#225 replaced (botw-fx has them, my-main does not)
…oes not reset g_px_dcu / g_px_dcc, the DM_NVN_DC_UNWRITTEN / DM_NVN_DC_COVERED latches of the diagnostic commits seedds#225 replaced (botw-fx has them, my-main does not)
Add periodic encoder profiles with attachment traffic and formats, alternating A/B measurement phases, bounded Metal trace capture, and gpuprof.py log summaries. Preserve main's offline pipeline-archive integration while adding the capture build setting. Close periodic samples at frame boundaries through the last committed shared-event fence, so every:1 reports without mixing frames or reusing an unresolved heap. Add 28 CPU checks of production profiling code and include them in CI; document the mechanism and update the symptom index. Validated with all 31 CI-style Python test files, the profiling regression, a Mac host build, and all 133 iOS source compiles. Profiling completion and heap ownership were checked with synthetic counter/event objects; no new real-GPU or gameplay validation. Co-authored-by: v0lumehi <aljic.zijad@gmail.com>
GPU measurement tools for the device and the Mac
All switches are off by default.
DM_NVN_GPUPROF=every:<n>DM_NVN_PASSDUMP=every:<n>DM_AB=<frames>abalternate in phases of one run. An[ab]line per phase gives GPU / frame time p50 / p90 / mean and attachment traffic.DM_NVN_BARRIER=abis the first such switch.DM_GPU_CAPTURE=<frame>[:<n>]orgpu:<ms>[:<after>]gpu:<ms>fires after 60 frames in a row over<ms>. Traces go togpu_captures/(DM_GPU_CAPTURE_DIR), and only that folder is pruned to the newestDM_GPU_CAPTURE_KEEP.DM_METAL_CAPTURE=1addsMetalCaptureEnabledto the IPA; on the Mac,MTL_CAPTURE_ENABLED=1.dm/tools/gpuprof.py[gpuprof]and[ab]lines of a run log or an iPhonelog.txt: per-frame totals, the mean per pass shape or per size class (full / half / quarter of the largest colour pass, G-buffer-like passes apart), one frame's timeline with its gaps, and A/B medians.Two fixes in the capture code:
gpu:<ms>could fire in frame 0;Docs
docs/agents/05-debugging.md: "GPU time on the device", a recipe for profiling viaDocuments/env.txtand reading the lines.docs/agents/04-graphics.mdanddocs/development.md.docs/reference/shaders.md(GPU frame captures need pipelines built through the device), and the symptom index.Checked
dmhostfor three profiles, the iOS compile check and the tool tests (includingtest_gpuprof.pyon a synthetic log andtest_docs) pass.gpuprof.pyon a real Mac run log.DM_NVN_GPUPROF=every:300 DM_NVN_PASSDUMP=every:1200 DM_AB=300 DM_NVN_BARRIER=ab DM_GPU_CAPTURE=2400 MTL_CAPTURE_ENABLED=1):[gpuprof]frame lines every 300 frames, with the attachment ledger (e.g. in the world: 154 render passes, 446 MB loaded / 488 MB stored);[ab]lines for four alternating phases;gpu_captures/dm_<date>-<time>_f2400.gputrace. The folder held three olderdm_*.gputrace, another.gputraceand a text file: the two oldestdm_*were removed (keep 2, the new one included), the rest stayed;gpuprof.pyread the log (per-frame totals; the captured frame shows the capture's own stall as its span).