Repository navigation
render/opengl: report frame ends to the latency probe and bound the queue to one frame - #5187
Conversation
…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>
Perf gateHead host slug: Perf gate — no class-matched baselineNo capture of Captures considered:
|
jakildev
left a comment
There was a problem hiding this comment.
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 IrredenEngineTestcompleted 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, andall-checkswere 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
left a comment
There was a problem hiding this comment.
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 IrredenEngineTestcompleted 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...HEADpassed.- Current CI: all completed non-Fleet checks are green;
linux-buildremains in progress. Thefleet-tests,gate, andall-checksfailures reproduce the same pre-existingopengl_render_impl.cppout-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)
|
Cross-host smoke OK on macos (fresh checkout + IRShapeDebug --auto-screenshot 10 — build clean, exit 0, no log warnings). |
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 amax_frames_in_flightmeasurement 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-verifyrow of IRShapeDebug (186) and IRCanvasStress (59) onwindows-debugmatches the merge-base control.Acceptance evidence
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 runsQUIET=guardedRESULT=CLEAN; spread stated per cellFrames in flight at frame start: max=2×5; arm 1:max=1×5; arm 0:max=0×5python3 scripts/gui-verify.py IRShapeDebug -- --gui-test[gui-verify] 49/49 assertions passed, includingnewest_completed_pick_frame(30/30),settled_cursor_is_current,same_batch_move_press_is_stale,destroyed_entity_is_filteredpython3 scripts/render-verify.py --target IRShapeDebug/--target IRCanvasStress44955ae9fcontrol 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 CanvasStresscomparerows)fleet-run IrredenEngineTest --gtest_filter='GpuSubmissionFences*'[ PASSED ] 11 tests.(new:BoundOne*×2,BoundZeroWaitsForEveryPresentedFrame,EveryRetiringPathReportsEachSubmissionOnceInOrder)IRShapeDebugsdf-off vsinput-latency-delay-20ms.lua, 3 pairs, DebugEnd event: gpu-complete,input_to_present_ms93.366 ms, max in flight 2; delay rises 29.49 / 28.90 / 31.33 ms (≥ 20 ms)Reviewer notes
Plan departures
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.m_frameCompletionsin itssetGpuFrameTimingEnabledoverride and reports ends from the fence queries as they retire. Retirement reaches the device through a new optionalretired(fence, serial)observer onGpuSubmissionFences' poll, throttle and completeAll.glGetInteger64vwas not in the generated GL wrapper. It is added tofuncs_list.txt,GLAPI.handGLAPITrace.hby hand, matching the generator's output shape.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}.luain IRPerfGrid.Refs, notCloses. The plan's bail path flags the issue for re-planning, so it stays open.Notes for reviewer
44955ae9f, samerender-verify --no-build --json-out; no cached control existed). The cached--against-controlpath needs--all --record-control.light-verify --if-changed: the first run wasALIVE-TIMEOUT×3 during cold shader links (17–46 s per program). The rerun at--timeout 900printed[light-verify] all checks PASS (some backends skipped — no baselines).IrredenEngineTest --gtest_filter='GLApiLoader*:*Config*:InputLatency*:GpuSubmissionFences*:GpuReadbackRing*:PresentedPick*':[ PASSED ] 63 tests.GLApiLoadercovers the newglGetInteger64vslot.present(), a locked decision. Moving the CPU frame's start is render/metal: present without blocking the CPU on the GPU, with no added input latency #5000's policy.GL_TIMESTAMPread's driver round trip. That is small against the 30 ms arm deltas.ee09a9aef. Later commits only renameframeEndReporter(), move two overrides besidefinish(), and reformat. There is no behaviour change, and the Debug test build was re-run after them (GpuSubmissionFences*:GLApiLoader*13 PASSED).fleet-pr-overlap --base master:VERDICT: overlap, every row clean. The rows to check for semantic agreement are render: bound Metal frame overlap and pace input [WIP] #5161 (render/metal: present without blocking the CPU on the GPU, with no added input latency #5000's Metal overlap, same epic), onrender_device.hpp,opengl_render_impl.cpp,config.hppandworld.cpp. It addsprepareCpuFramebesidebeginFrame(); the overrides here were moved off that hunk to stop a textual conflict. Also render: add a composite draw witness and attribute the gl query cost #5183 (GL wrapper files,render_device.hpp,opengl_render_impl.cpp), render/metal: draw consecutive draws to one target in one render pass (#4994) #5100 / render: size per-axis stores from content height (#4960) #5101 / docs: capture overflow-rejection camera ordering in docs/design/per-axis-trixel-canvas-rotation.md (#5086) #5124 / render: prototype event-cursor picks from completed images #5135 (world.cpp), and window: offscreen captures keep the requested size under an OS clamp #5186 (opengl_render_impl.cpp).optimizepass beyond the matrix: the change is the frame-pacing policy itself, and the table states its throughput cost.Refs #5001
🤖 Generated with Claude Code