bug(perf): GPU timestamp readback returns stale samples at GPU-bound frame rates #1076
Labels
No labels
Context: Bug
Context: Enhancements
Platform: Android
Platform: Linux
Platform: Web
Platform: Windows
Platform: iOS
Platform: macOS
Release
Target: CI
Target: CLI
Target: Dependency
Target: Engine
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
SakulFlee/Orbital#1076
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The GPU timing columns in the Windows capture are not updating. Every GPU stage has only 6 distinct values over 180 one-second samples:
gpu_shadow:1.413for rows 1-92, then1.135for rows 96-179gpu_models:2.293for rows 1-92, then1.277for rows 96-179gpu_volumetrics:2.414for rows 1-92, then2.114for rows 96-179Real GPU time does not stay constant to 0.001 ms for 92 seconds. The values change exactly during 2.4-2.8 ms iced stalls, when the CPU finally gives the readback time to complete.
Likely cause
Renderer::renderwrites timestamps into one of two staging buffers, then immediately polls the previous buffer, maps it, and unmaps it even if the map did not finish. When the GPU frame time is close to the CPU frame time, the previous buffer is still in use and the map never completes;prev_gpu_nsstays at the last successful sample.timestamp_readback_msis ~0.006 ms, confirming that no wait occurs.Impact
Fix direction
Acceptance criteria
Android phone data extends this beyond desktop:
gpu_scene_totalaround 1 ms with almost no variation.0.000.presentis ~89 ms and FPS is ~8.A real GPU frame cannot be 1 ms while present blocks for 89 ms. This should be treated as stale/unavailable GPU data, not as evidence that the GPU is fast.
Important distinction: the overall frame timing is still real.
update + surface_acq + totalmatchescdt, andcdtmatches FPS. The reporting problem is limited to the GPU-stage columns; it does not invalidate the measured 8 FPS.Tablet data is even clearer:
gpu_scene_totalis3.149for every non-zero row.gpu_volumetricsis4.876for every non-zero row.presentis ~342 ms and FPS is ~3.A real 3 FPS frame cannot have 3.1 ms of scene GPU work and 4.9 ms of volumetrics. These are stale samples, not a fast GPU. Android should be included in the scope of this fix, and unavailable/stale GPU data should be marked explicitly rather than reported as a plausible number.
The new capture shows why this still matters:
gpu_complete(independent queue-completion callback): ~195 ms mediangpu_scene_total: constant ~1.09 msgpu_volumetrics: constant ~0.15 mspresent: ~86 msThe pass timestamps are still frozen/incorrect while the independent GPU completion measurement shows a nearly two-frame queue backlog. The stale columns cannot identify which pass is responsible, so this issue remains a blocker for GPU-pass attribution.
Real tablet data reinforces this: timestamp-query features are reported as available on the Adreno 810, but
gpu_scene_totalis all zero whilegpu_completeis ~567 ms and the frame is ~358 ms. The pass timestamps are unusable on both Android GPUs.Implemented on
feat/perf-timings, commitdd8a5479:Queue::get_timestamp_period().This is not yet hardware-validated. Please re-capture the tablet or phone with the new commit; the GPU pass columns (
gpu_scene_total,gpu_models,gpu_volumetrics,gpu_tonemap,gpu_aa) should now update instead of staying zero/frozen. Keep this issue open until the Android capture confirms it.The timestamp fix is working on the emulator (llvmpipe, x86_64, 320x640). The GPU pass columns are no longer zero:
gpu_scene_total: ~89 msgpu_shadow: ~30 msgpu_models: ~57 msgpu_volumetrics: ~130 msgpu_tonemap: ~14 msgpu_aa: ~8 msgpu_complete: ~245 msThis confirms the readback ring itself works. The values are from software llvmpipe, so they are not tablet performance numbers, but the pass breakdown is now usable. Need a phone/tablet capture with the new build for hardware validation; keeping this open until then.
Timestamp readback is now confirmed on a real device: Mali-G720 phone, 1220 x 2582, ~8.2 FPS. The pass values are nonzero and the sum matches the frame:
gpu_scene_total: ~93 msgpu_models: ~91 msgpu_volumetrics: ~14 msgpu_tonemap: ~7 msgpu_aa: ~1.6 msThe old failure mode (all-zero/frozen GPU columns) is gone on Mali. I still want the tablet/Adreno confirmation before closing this issue.
The four-slot readback ring and queue timestamp period are working on the Android Mali-G720 capture at
5be0937d: 66 usable rows, GPU values vary per frame, and the split subpasses sum exactly togpu_scene_total(77.88 ms). The phone no longer shows the long constant runs described for Windows.Keeping this open for the remaining acceptance item: the Windows capture and, if available, a fresh tablet/Adreno capture.