present: measure latency only for observed frame origins #1263

Closed
Kadamitas wants to merge 2 commits from upstream-pr/1263 into main
Kadamitas commented 2026-11-24 21:03:05 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Kadamitas on 2026-11-24T21:03:05Z.


Claimed in the coordination issue as: frame-origin latency

Depends on: #1198 touches the same frame timing function. Either change can land first.

What and why

A timeout can return a frame token with no observed origin event. Carry that distinction into presentation statistics so the frame still contributes to the interval and frame counts while origin latency includes only observed origins.

Tested

  • Built and ran the native frame pacer suite on Windows 11 x64 with GCC.
  • The timeout regression keeps both presentations and measures only the observed origin. A new test polls before the first origin, presents after it, and verifies that the early token does not enter the latency ring. The frame pacer suite passed on the Nov 27 rebase.

GPUs tested: n/a (CPU-only tests)

AI-assisted: yes

  • One topic with synthetic inputs and no game data.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5480287183 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1263). Originally posted by [Kadamitas](https://github.com/Kadamitas) on 2026-11-24T21:03:05Z. --- Claimed in the coordination issue as: [frame-origin latency](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7144407859) Depends on: #1198 touches the same frame timing function. Either change can land first. ### What and why A timeout can return a frame token with no observed origin event. Carry that distinction into presentation statistics so the frame still contributes to the interval and frame counts while origin latency includes only observed origins. ### Tested - Built and ran the native frame pacer suite on Windows 11 x64 with GCC. - The timeout regression keeps both presentations and measures only the observed origin. A new test polls before the first origin, presents after it, and verifies that the early token does not enter the latency ring. The frame pacer suite passed on the Nov 27 rebase. GPUs tested: n/a (CPU-only tests) AI-assisted: yes - [x] One topic with synthetic inputs and no game data.
PierreEbele commented 2026-11-25 14:40:47 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by PierreEbele on 2026-11-25T14:40:47Z.


Reviewed 32fd2ea54: built and ran frame_pacer_test on the branch and on main (Linux, g++); the extended scenario fails on main without the fix — it tests the right thing. Probed timeout-issued consecutive tokens (mixed, repeated, uncapped, stale out-of-order) on both trees: only the latency ring changes; token numbering, tick grid, interval stats and uncapped mode are unchanged. The branch conflicts with current main (merge-tree: issue_token_locked, one region) — main moved issuance to the shared FrameTokenSource and added the current_token_locked poll path, whose origin also needs an observed/unobserved decision when this is rebased. AI-assisted review.

Recommendation: Fix first

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7165647239 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1263#issuecomment-7165647239). Originally posted by [PierreEbele](https://github.com/PierreEbele) on 2026-11-25T14:40:47Z. --- Reviewed 32fd2ea54: built and ran `frame_pacer_test` on the branch and on main (Linux, g++); the extended scenario fails on main without the fix — it tests the right thing. Probed timeout-issued consecutive tokens (mixed, repeated, uncapped, stale out-of-order) on both trees: only the latency ring changes; token numbering, tick grid, interval stats and uncapped mode are unchanged. The branch conflicts with current main (merge-tree: `issue_token_locked`, one region) — main moved issuance to the shared `FrameTokenSource` and added the `current_token_locked` poll path, whose origin also needs an observed/unobserved decision when this is rebased. AI-assisted review. **Recommendation:** Fix first
OreoFR commented 2026-11-28 21:48:18 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-28T21:48:18Z.


Verified by OreoFR

  • Base: main c1ecf04ed + PR head 5321de987 (tested at 5321de987, head is now 8d480c8e8); green run in a merge package of 12 PRs, no new ctest failure vs main
  • Test: ctest -R ^frame_pacer$
  • Red on main: failure line 208 (pacer.pacing_summary().latency_samples == 0)
  • Green with the PR: OK
  • Verdict: READY (frame_pacer.h is also touched by #1237 and #1198)
  • Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7246285639 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1263#issuecomment-7246285639). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-28T21:48:18Z. --- **Verified by OreoFR** - Base: main `c1ecf04ed` + PR head `5321de987` (tested at `5321de987`, head is now `8d480c8e8`); green run in a merge package of 12 PRs, no new ctest failure vs main - Test: `ctest -R ^frame_pacer$` - Red on main: failure line 208 (pacer.pacing_summary().latency_samples == 0) - Green with the PR: OK - Verdict: READY (frame_pacer.h is also touched by #1237 and #1198) - Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11 AI-assisted (Claude Code, Claude Opus 5.5).
zmasi commented 2026-11-28 21:51:57 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T21:51:57Z.


Independent Verification Report — 8d480c8e8c + origin/main (a8465211fb)

Environment: Windows 11 (26200), AMD Ryzen 9 5950X, MSVC 19.44.35228 (x64, /std:c++20 /EHsc /W4 /permissive- /utf-8, Debug /Od /MDd & Release /O2 /MD).
Verdict: PASS (Ready to merge) — clean Git merge with origin/main (e3b31369be05).

1. Red -> Green Verification on Windows 11 + MSVC 19.44

  • Red (origin/main frame_pacer.h + #1263 frame_pacer_test.cpp): frame_pacer_test fails deterministically (rc = 1) at line 224: pacer.pacing_summary().latency_samples == 0 because origin/main recorded origin-to-present latency for tokens issued before the first configured origin tick (wait_flag_current_token with now < origin) and on early timeout (frame_wait_flag_token_on_timeout).
  • Green (8d480c8e8c + origin/main):
    • frame_pacer_test (Debug /Od /MDd & Release /O2 /MD): PASS (frame_pacer_test: all cases pass), 0 warnings under /W4 /permissive-.
    • Confirmed origin_observed is now >= origin for wait_flag_current_token, false for frame_wait_flag_token_on_timeout, and true for normal observed origin ticks, keeping frame interval counts intact while excluding synthetic origins from latency_ring_.
  • Cross-PR Note: Pairwise git merge-tree with open PR #1198 (token_record_locked binary search) touches the same lines in FramePacer::record_present_timing_locked (if (record && record->origin_observed && now >= record->origin_us) resolves both cleanly when the second of the two lands).

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7246329612 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1263#issuecomment-7246329612). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T21:51:57Z. --- ### Independent Verification Report — `8d480c8e8c` + `origin/main` (`a8465211fb`) **Environment:** Windows 11 (`26200`), AMD Ryzen 9 5950X, MSVC `19.44.35228` (`x64`, `/std:c++20 /EHsc /W4 /permissive- /utf-8`, Debug `/Od /MDd` & Release `/O2 /MD`). **Verdict:** **PASS (Ready to merge)** — clean Git merge with `origin/main` (`e3b31369be05`). #### 1. Red -> Green Verification on Windows 11 + MSVC `19.44` - **Red (`origin/main` `frame_pacer.h` + `#1263` `frame_pacer_test.cpp`):** `frame_pacer_test` fails deterministically (`rc = 1`) at `line 224: pacer.pacing_summary().latency_samples == 0` because `origin/main` recorded origin-to-present latency for tokens issued before the first configured origin tick (`wait_flag_current_token` with `now < origin`) and on early timeout (`frame_wait_flag_token_on_timeout`). - **Green (`8d480c8e8c` + `origin/main`):** - `frame_pacer_test` (Debug `/Od /MDd` & Release `/O2 /MD`): **PASS** (`frame_pacer_test: all cases pass`), `0` warnings under `/W4 /permissive-`. - Confirmed `origin_observed` is `now >= origin` for `wait_flag_current_token`, `false` for `frame_wait_flag_token_on_timeout`, and `true` for normal observed origin ticks, keeping frame interval counts intact while excluding synthetic origins from `latency_ring_`. - **Cross-PR Note:** Pairwise `git merge-tree` with open PR `#1198` (`token_record_locked` binary search) touches the same lines in `FramePacer::record_present_timing_locked` (`if (record && record->origin_observed && now >= record->origin_us)` resolves both cleanly when the second of the two lands). AI-assisted.
aslan2142 commented 2026-12-01 17:22:38 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T17:22:38Z.


Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, d3d12/, or general docs), please feel free to reopen it.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7319200698 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1263#issuecomment-7319200698). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T17:22:38Z. --- Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (`d3d12/`) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, `d3d12/`, or general docs), please feel free to reopen it.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!1263
No description provided.