Skip to content

Count midpoint setup and bound GPU timestamp readbacks - #9

Merged
MONZikWasTaken merged 3 commits into
getflyhigh:mainfrom
NimaJafariComp:fix/bounded-gpu-phase-timing
Nov 20, 2026
Merged

MONZikWasTaken merged 3 commits into
getflyhigh:mainfrom
NimaJafariComp:fix/bounded-gpu-phase-timing

Conversation

@NimaJafariComp

@NimaJafariComp NimaJafariComp commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

FlyHigh's first fast-linear phase was reporting the render time but leaving out the midpoint motion setup it had just submitted. I noticed it while comparing the fast and exact-phase paths. That made the first phase look much cheaper than it was. On native Metal I could also reproduce a separate zero-timestamp result.

What changes

  • Report midpoint setup and frame work separately. The existing WebGPU cost promise still works and includes the total; the new timing promise gives the breakdown.
  • Keep at most four timing samples in flight. When they're busy or timestamps aren't available, render the frame untimed instead of holding it back.
  • On native Metal, wait for the GPU to finish recording timestamps before resolving them. This delays the readback, not the render. Each active slot keeps its sample until it can be read.

This is a timing fix, not a kernel optimization. In my Mac WebGPU test, the old first-phase median was 0.92 ms. With the setup included, it's 2.95 ms total: about 2.03 ms of setup and 0.92 ms for the frame. Later phases still measured 0.92 ms.

Verification

The native Metal test reproduced a zero sample on the unmodified build. All seven GPU stream tests passed with the fix, as did the normal engine tests and strict engine Clippy. In a WebGPU burst, all 48 frames rendered: four timed, 44 untimed, with identical pixels to the untimed reference. Timing resumed afterward. I haven't tried this on Windows NVIDIA.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@MONZikWasTaken
MONZikWasTaken merged commit 2401de4 into getflyhigh:main Nov 20, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants