Skip to content

profile: print the per-frame decomposition in the profile report - #5045

Merged
jakildev merged 1 commit into
masterfrom
claude/4951-per-frame-decomposition
Nov 12, 2026
Merged

jakildev merged 1 commit into
masterfrom
claude/4951-per-frame-decomposition

Conversation

@jakildev

Copy link
Copy Markdown
Owner

Summary

  • writeProfileReport writes a --- Frame decomposition --- section: the mean recorded frame split into INPUT / UPDATE / RENDER system CPU, GPU (command-buffer spans mean), Pacing (offscreen pacer sleep) and Remainder, each in ms per frame and as a share of the Frame time mean, closing with a Frame row. Rows are computed in whole thousandths, so the printed rows add up to the printed frame mean exactly.
  • No valid GPU frame timing (OpenGL supported=0, or no valid frame) prints the GPU row as unavailable and marks the remainder includes GPU time; a missing pacing sample reads 0; a negative remainder prints as it is.
  • The pacer's sample name moves to IRProfile::kOffscreenPacingPhase in profile_report.hpp; the Metal pacer and the report share it (engine/profile/ does not depend on engine/render/).
  • compare_perf_runs.py parses the section into CellReport.frame_split (None for an older report, never zeros); repeat_profile.py adds a frame split <term> row per term to summary.md; scripts/perf/README.md describes the section and what the remainder contains.

Test plan

  • fleet-run IrredenEngineTest --gtest_filter='ProfileReport*': 17/17 pass (7 new ProfileReportDecomposition cases).
  • python3 scripts/perf/test_profile_parser.py: 29 tests OK; python3 scripts/perf/test_repeat_profile.py: 61 tests OK.
  • ruff check scripts/ clean; fleet-build --target format-changed clean; python3 scripts/lint_comment_refs.py ok.
  • Release IRPerfGrid built; both positive-fire runs below exited RESULT=CLEAN, QUIET=guarded.

Acceptance evidence

Criterion Check run Observed
1. Unit tests: expected figures, rows add up, unavailable GPU, no pacing sample fleet-run IrredenEngineTest --gtest_filter='ProfileReport*' [ PASSED ] 17 tests.; RowsCarryTheExpectedPerFrameFigures, RowsAddUpToTheFrameMeanAtThePrintedPrecision, UnsupportedGpuTimingMarksTheRowUnavailable, AGpuTimingWithNoValidFrameMarksTheRowUnavailable, AMissingPacingSampleReadsZero all OK
2. Parser reads the section, absent reads absent, new lines pinned to the writer python3 scripts/perf/test_profile_parser.py Ran 29 tests ... OK; FrameSplitParserTest covers read, absence (frame_split is None), unavailable GPU and the writer pin
3a. Million yaw-0 control: UPDATE/RENDER/GPU non-zero and within 0.05 ms of the figures from the other sections; pacing < 0.1; remainder <= 5.0 python3 scripts/perf/repeat_profile.py --release --repeats 1 --output <dir>/million-yaw0 -- --wave-freeze --no-overlay --pivot-origin --auto-profile 300 --config-preset configs/perf/million-profiling-off.lua --yaw 0 RESULT=CLEAN. Section: UPDATE 11.352, RENDER 7.346, GPU 28.365, Pacing 0.000, Remainder 1.519, Frame 48.592. Per-system Total(ms) rows: UPDATE 3405.49/300 = 11.352, RENDER 2203.94/300 = 7.346; commandBufferSpans avg 28.365
3b. 16-cubed light scene: pacing above 0.2 ms python3 scripts/perf/repeat_profile.py --release --repeats 1 --output <dir>/grid16 -- --auto-profile 300 --grid-size 16 --zoom 1 --yaw 0 --wave-freeze --no-overlay --pivot-origin RESULT=CLEAN. Pacing 2.984 35.44% of an 8.419 ms frame
4. Summary lists each split row with mean and run range python3 scripts/perf/test_repeat_profile.py Ran 61 tests ... OK; SummaryFrameSplitTest. Real summary.md: | frame split UPDATE | 11.352 | 11.352–11.352 | n/a | for each of six rows
5. ruff and format clean ruff check scripts/; fleet-build --target format-changed All checks passed!; format-changed built with no residual changes
6. README describes the section and its remainder scripts/perf/README.md § "Read where a frame's time went" section added, names the remainder's contents

Plan departures

  • The million yaw-0 control read GPU 28.4 ms and a 1.5 ms remainder here, against the issue's hand-measured 18.2 ms and ~3.5 ms: the host was loaded by other fleet panes (QUIET=guarded). The criteria are relations between the report's own sections and bounds, which hold.

Notes for reviewer

fleet-pr-overlap reports VERDICT: overlap against #5042 (lighting, fleet:wip) on engine/profile/include/irreden/profile/profile_report.hpp and engine/profile/src/profile_report.cpp; both trial merges are clean.

Closes #4951

🤖 Generated with Claude Code

A profile report held per-system CPU totals, the GPU frame timing and the
frame-time line in separate sections, so every reader summed them by hand
and an unsummed term stayed invisible. The new "Frame decomposition"
section splits the mean recorded frame into INPUT/UPDATE/RENDER system CPU,
GPU (the command-buffer spans mean, not the envelope, which also counts
inter-submission gaps), offscreen pacing and a remainder, each in ms per
frame and as a share of the mean. Rows are computed in whole thousandths so
they add up to the printed frame mean exactly; a negative remainder prints
as it is, and an unavailable GPU timing is marked with the remainder
labelled as including GPU time.

The pacer's sample name moves into profile_report.hpp so the report and the
Metal pacer share one constant. compare_perf_runs.py parses the section
(absent reads None, never zeros) and repeat_profile.py lists each row in
summary.md.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@jakildev jakildev added fleet:author-claude Implementation last authored by Claude; route review to Codex fleet:authored-on-macos PR was authored and smoke-tested on macOS Metal backend labels Nov 12, 2026

@jakildev jakildev left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review — profile: print the per-frame decomposition in the profile report

Verdict: approve

The decomposition is derived from the same recorded-frame window as the report's frame mean and per-system totals. It uses commandBufferSpans rather than the envelope, preserves unavailable-GPU and negative-remainder semantics, and closes the printed rows at millisecond precision. The parser keeps old reports distinguishable from zero-valued splits, and the summary omits unavailable terms without inventing values.

Acceptance (issue #4951)

Criterion Grade Evidence
1. Profile-report unit tests Met Seven focused decomposition cases cover expected values, printed-precision closure, unavailable/invalid GPU timing, missing pacing, and negative remainder.
2. Parser compatibility Met Old reports remain None; new rows, unavailable GPU semantics, and writer-string pins are covered.
3. Native positive-fire Met The submitted Metal Release runs both report RESULT=CLEAN; the million-control values agree with their source sections and the 16-cubed scene records pacing above the required threshold.
4. Cross-run summary Met Tests cover each split term's mean/range, old-report omission, and unavailable-GPU labeling.
5. Lint and formatting Met Local focused Python lint passes; GitHub's Python lint and format checks are green.
6. Documentation Met The README documents the denominator, terms, spans choice, remainder, unavailable GPU behavior, and summary rows.

Validation

  • fleet-build --target IrredenEngineTest — passed (terminal detached job exit 0).
  • fleet-run IrredenEngineTest --gtest_filter='ProfileReport*' — 17/17 passed.
  • python3 scripts/perf/test_profile_parser.py — 29/29 passed.
  • python3 scripts/perf/test_repeat_profile.py — 61/61 passed.
  • ruff check on the four changed Python files — passed.
  • GitHub's fleet, Linux build, perf-gate, and render-harness jobs were still pending at review time; they are not reported as green here.

Praise

  • Converting every contribution to printed thousandths before calculating the remainder makes the report's closure claim mechanically true instead of merely approximate.
  • Moving the pacer phase name into the low-level profile module preserves the dependency direction while eliminating a duplicated protocol string.

🤖 Reviewed by Codex GPT-5 (review-pr skill)

Opus recheck not required (reviewed at opus class).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fleet:approved Fleet reviewer approved — ready for human merge fleet:author-claude Implementation last authored by Claude; route review to Codex fleet:authored-on-macos PR was authored and smoke-tested on macOS Metal backend fleet:needs-windows-smoke PR needs windows-debug build + smoke-run validation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

perf: print the per-frame decomposition in the profile report

1 participant