Skip to content

render/opengl: report frame ends to the latency probe and bound the queue to one frame - #5187

Merged
jakildev merged 3 commits into
masterfrom
claude/5001-gl-frame-bound
Nov 19, 2026
Merged

jakildev merged 3 commits into
masterfrom
claude/5001-gl-frame-bound

Conversation

@jakildev

Copy link
Copy Markdown
Owner

Summary

OpenGL now reports frame ends to the input-latency probe as gpu-complete, using each frame's own submission-fence timestamp. Its queue is bounded to one presented frame in flight (it was two), and a max_frames_in_flight measurement preset selects 0, 1 or 2. The three-arm OpenGL table is committed. At the GPU-bound scene, bound 1 still reads one GPU frame above the serialized arm. The plan's bail path therefore applies: bound 1 lands because it is no worse than bound 2 on any reading, and #5001 is flagged for re-plan against #5000's frame-start policy.

Screenshots

No visual change: every render-verify row of IRShapeDebug (186) and IRCanvasStress (59) on windows-debug matches the merge-base control.

Acceptance evidence

Criterion Check run Observed
1. Three-arm table, OpenGL, Release, profiling off, 5 interleaved rounds, quiet, noise per row repeat_profile.py --target IRPerfGrid --release --repeats 1 --allow-unsupported-gpu-frame × 30 (arm order rotated per round) docs/perf/input-latency/README.md § "OpenGL: frames in flight"; 30/30 runs QUIET=guarded RESULT=CLEAN; spread stated per cell
2. Positive-fire: max frames in flight 2 → 1 at the GPU-bound scene same matrix, scene (b) arm 2: Frames in flight at frame start: max=2 ×5; arm 1: max=1 ×5; arm 0: max=0 ×5
3. Latency within serialized noise, or the table + re-plan flag on the issue committed table + issue comment GPU-bound: arm 1 61.977 ms vs serialized 31.799 (spread 2.416), so the flag branch applies; table and flag posted on #5001 (comment). CPU-bound: 97.517 vs 96.106 (spread 5.579), within
4. Steady frame mean of all three arms committed table GPU-bound 32.034 / 31.094 / 31.184 ms; CPU-bound 347.360 / 292.826 / 290.740 ms
5. Pick and hover on OpenGL python3 scripts/gui-verify.py IRShapeDebug -- --gui-test [gui-verify] 49/49 assertions passed, including newest_completed_pick_frame (30/30), settled_cursor_is_current, same_batch_move_press_is_stale, destroyed_entity_is_filtered
6. Pixels max delta 0 python3 scripts/render-verify.py --target IRShapeDebug / --target IRCanvasStress No row moved: IRShapeDebug 79 PASS / 24 FAIL / 83 SKIP and IRCanvasStress 23 / 8 / 28. Each matches the merge-base 44955ae9f control in verdict and metrics (0 of 186, 0 of 59 differ). Every FAIL is inherited: #4925 (6 CanvasStress default rows), #5182 (filed: 6 ShapeDebug yaw shots × 4 passes, 2 CanvasStress compare rows)
7. Fence tests incl. bounds 1 and 0 fleet-run IrredenEngineTest --gtest_filter='GpuSubmissionFences*' [ PASSED ] 11 tests. (new: BoundOne* ×2, BoundZeroWaitsForEveryPresentedFrame, EveryRetiringPathReportsEachSubmissionOnceInOrder)
A1. OpenGL probe reports latency and in-flight > 0 under the two-frame queue; injected delay shows scene (b) arm 2; IRShapeDebug sdf-off vs input-latency-delay-20ms.lua, 3 pairs, Debug End event: gpu-complete, input_to_present_ms 93.366 ms, max in flight 2; delay rises 29.49 / 28.90 / 31.33 ms (≥ 20 ms)
Reviewer notes

Plan departures

  • Criterion 2 says "2 on the parent commit": the parent's OpenGL device reports End event: not measured (no frames-in-flight reading exists there). Arm 2 on this commit is the parent's queue (same throttle, bound 2 via preset) and reads 2.
  • A1 "override the backend-neutral completion query" is superseded by A2. The device arms m_frameCompletions in its setGpuFrameTimingEnabled override and reports ends from the fence queries as they retire. Retirement reaches the device through a new optional retired(fence, serial) observer on GpuSubmissionFences' poll, throttle and completeAll.
  • glGetInteger64v was not in the generated GL wrapper. It is added to funcs_list.txt, GLAPI.h and GLAPITrace.h by hand, matching the generator's output shape.
  • The setting is max_frames_in_flight (the plan left the name to the implementer), clamped to [0, 2]. Six presets: configs/perf/{million,profiling-off}-frames-in-flight-{0,1,2}.lua in IRPerfGrid.
  • Refs, not Closes. The plan's bail path flags the issue for re-planning, so it stays open.

Notes for reviewer

Refs #5001

🤖 Generated with Claude Code

jakildev and others added 3 commits November 17, 2026 15:20
…ueue to one frame

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Five rotated rounds of the serialized, one-frame and two-frame arms at
the GPU-bound million control and the CPU-bound scene, on the Windows
OpenGL host, Release. At the GPU-bound scene each frame in flight adds
one GPU frame of input latency (31.8 / 62.0 / 93.4 ms) for a 0.9 ms
frame-time gain; at the CPU-bound scene latency is flat and serializing
costs 54.5 ms per frame. The one-frame bound is no worse than two on any
reading, so it ships; closing the remaining gap needs a later CPU frame
start, a policy shared with the Metal backend.

Also polish: name the retirement-observer accessor after what it
returns, and format the new hunks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n calls

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jakildev jakildev added fleet:wip Work in progress — not ready for review fleet:author-claude Implementation last authored by Claude; route review to Codex fleet:authored-on-windows PR was opened from a Windows (MSYS2) host and removed fleet:wip Work in progress — not ready for review labels Nov 18, 2026
@github-actions

Copy link
Copy Markdown

Perf gate

Head host slug: linux-x86_64-xeon-platinum-8573c-unknown

Perf gate — no class-matched baseline

No capture of linux-x86_64-xeon-platinum-8573c-unknown on the baseline branch is in this head's calibration class (head ref_ms 87.80; a capture qualifies within 1.20× of it, finished at most 14 days before this head started, same matrix and frame count, every cell measured). The next master push that lands on this runner class files one. Gate is informational this PR.

Captures considered:

  • a990fd60f603e872fc1f7886ba7fa10ac223d6fb ref_ms 77.66 — older than 14 days
  • 87c1d6067c42bbf4e5e83d720675c876bbacb0ab ref_ms 79.91 — older than 14 days
  • 8e87859c96d0510bdfabd97838c7dafa79fddd53 ref_ms 82.71 — older than 14 days
  • d94ace876538c293d6fe16f134022f618368d916 ref_ms 77.59 — older than 14 days
  • 0e104317362fae808ba4ee6996fc7279b75b5673 ref_ms 84.81 — older than 14 days
  • 37e07cfd9754389831781205fd3e25ae489c6975 ref_ms 90.72 — older than 14 days
  • 56dff05ff0e4a46f9e1e5f6879a5ee778b2ac615 ref_ms 81.92 — older than 14 days
  • d80f5f9a2abd2b83f5606ac278d0d82b95cdd172 ref_ms 81.54 — older than 14 days
  • 02153359a5e8fdf1429745f474758262c9e3c861 ref_ms 91.85 — older than 14 days
  • c3ea76d802943336f7cc9b92b5fafaa8e9ff3b59 ref_ms 75.28 — older than 14 days
  • 637bc06f012aafe1cb043130d648ae9f998ff558 ref_ms 91.11 — older than 14 days
  • 82cb65a30f95ca772a2f09a0eda5c0bc0239b5a2 ref_ms 87.83 — older than 14 days
  • 5f8a95c1d941d1d36ba7109f91e63563edc70b68 ref_ms 89.94 — older than 14 days

@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 — render/opengl: report frame ends to the latency probe and bound the queue to one frame

Verdict: approve

The OpenGL completion path preserves ordered fence retirement, bounds the default queue to one presented frame, and records the phase-0 bail-path evidence without introducing a blocking poll.

Checked

  • Read the complete PR and issue #5001 threads, the current-head diff, OpenGL submission/clock-mapping path, queue bookkeeping, config wiring, generated GL-wrapper additions, and focused tests.
  • fleet-build --detach --target IrredenEngineTest completed successfully on the reviewed head (macOS Debug; exit 0).
  • fleet-run IrredenEngineTest '--gtest_filter=GpuSubmissionFences*' — 11/11 passed.
  • PR checks: completed checks are green; linux-build, fleet-tests, and all-checks were still in progress at review time.

🤖 Reviewed by Codex (runtime: codex; review-pr skill)
Opus recheck required: render-core OpenGL timestamp/fence lifetime and GPU/CPU completion semantics.

@jakildev jakildev added fleet:needs-opus-recheck Sonnet flagged this PR for Opus recheck before merge fleet:needs-macos-smoke PR needs macos-debug build + smoke-run validation and removed fleet:reviewing-mac-pool-4 labels Nov 18, 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 — render/opengl: report frame ends to the latency probe and bound the queue to one frame

Verdict: approve

Sonnet flagged the OpenGL timestamp/fence lifetime and GPU/CPU completion semantics; on closer read I confirm the implementation is sound because each timestamp query is reported before its fence slot can be reused, retirement remains in submission order, and query results are read only after availability or a completed wait guarantees GPU completion.

Checked

  • Read the complete PR and issue #5001 threads, the current-head diff, the OpenGL submission and clock-domain mapping paths, queue bookkeeping, config wiring, generated GL-wrapper additions, and committed matrix/positive-control evidence.
  • The phase-0 result follows the issue's bail contract: bound 1 is not worse than bound 2 within the recorded measurements, while the residual gap to serialized presentation remains documented and replanned against #5000.
  • fleet-build --detach --target IrredenEngineTest completed successfully on the reviewed head (macOS Debug; exit 0).
  • fleet-run IrredenEngineTest --gtest_filter='GpuSubmissionFences*:*GLApiLoader*' — 11/11 applicable macOS tests passed.
  • git diff --check origin/master...HEAD passed.
  • Current CI: all completed non-Fleet checks are green; linux-build remains in progress. The fleet-tests, gate, and all-checks failures reproduce the same pre-existing opengl_render_impl.cpp out-of-tree registry finding on the exact base commit and are not introduced by this PR.

🤖 Reviewed by Codex (runtime: codex; model: GPT-5; Opus-class final review; review-pr skill)

@jakildev jakildev added fleet:approved Fleet reviewer approved — ready for human merge and removed fleet:needs-opus-recheck Sonnet flagged this PR for Opus recheck before merge fleet:reviewing-mac-pool-3 labels Nov 18, 2026
@jakildev jakildev added fleet:verified-macos Cross-host smoke passed on macos-debug and removed fleet:needs-macos-smoke PR needs macos-debug build + smoke-run validation labels Nov 18, 2026
@jakildev

Copy link
Copy Markdown
Owner Author

Cross-host smoke OK on macos (fresh checkout + IRShapeDebug --auto-screenshot 10 — build clean, exit 0, no log warnings).

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-windows PR was opened from a Windows (MSYS2) host fleet:verified-macos Cross-host smoke passed on macos-debug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant