Frame clock: report the gaps between shown frames with the activity line #2111

Open
github-bot wants to merge 1 commit from github-bot/gh-2111 into main AGit
Owner

@⁠brandostrong on GitHub · 2026-11-25 04:42 UTC · original
brandostrong:frame-stats → main · +50 −2 · 2 files · 1 commits · open

XCL_ACTIVITY=1 counts presents per 2 s, which says where a run stops but not what a frame cost: a run that holds 30 fps and one that alternates 30 fps with 4 s stalls print the same line. The gaps between shown frames are what the frame clock actually did, and they are the number a shader-compile fix has to move. This adds them to the line that already reports the activity.

What is in it

  • crates/xcl/src/hle/d3d12x/present.rs: FrameTimes records each gap between shown frames while XCL_ACTIVITY is set; frame_times() returns (p50, p95, max, gaps over 100 ms)
  • crates/xcl/src/host.rs: the 2 s activity line ends with those four numbers
  • a unit test for the percentiles and the over-100 ms count

Tested

  • RTX 4090 (driver 32.0.16.1664), i9-13900K, Windows 11 26200, rustc 1.100.0, release and debug
  • cargo build --workspace && cargo test --workspace -- --test-threads=4 on b8e94b2: 1155 passed, 0 failed, 46 ignored
  • SKIPPED on this adapter (24): the wave64 GPU tests (the adapter reports waves of 32 lanes) and the f16 / f32-conversion programs the direct path refuses; heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows
  • a title run on this commit: 1737 frames in 180 s, gaps p50 33 ms, p95 76 ms, max 3759 ms, 46 over 100 ms

Regression run

main cbc296a:

xcl-smoke v1
commit: cbc296ab65a2661a61e3e2da109134bcd5319f60
gpu: NVIDIA GeForce RTX 4090
title: 3c290c16
seconds: 180
exit: 0x0
frames shown: 1901 (PresentX 1901)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 33336 MB

this PR's head b8e94b2 (clean worktree):

xcl-smoke v1
commit: b8e94b2469bcc9fce2be3621c7f1feabeea666b8
gpu: NVIDIA GeForce RTX 4090
title: 3c290c16
seconds: 180
exit: 0x0
frames shown: 1737 (PresentX 1737)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 35161 MB

Not tested

  • AMD, and NVIDIA cards other than this one (the reporting itself does not touch the driver)
  • a run long enough to get past where this title stalls (driver compiles of its largest compute programs, from t≈88 s on)

AI use

  • Claude Code, Claude Fable 5: wrote the code and the test, ran the suite and both smoke runs, wrote this description.

🤖 Generated with Claude Code

**@⁠brandostrong** on GitHub · 2026-11-25 04:42 UTC · [original](https://github.com/xcl-dev/xcl/pull/2111) `brandostrong:frame-stats` → `main` · +50 −2 · 2 files · 1 commits · open `XCL_ACTIVITY=1` counts presents per 2 s, which says where a run stops but not what a frame cost: a run that holds 30 fps and one that alternates 30 fps with 4 s stalls print the same line. The gaps between shown frames are what the frame clock actually did, and they are the number a shader-compile fix has to move. This adds them to the line that already reports the activity. **What is in it** - `crates/xcl/src/hle/d3d12x/present.rs`: `FrameTimes` records each gap between shown frames while `XCL_ACTIVITY` is set; `frame_times()` returns (p50, p95, max, gaps over 100 ms) - `crates/xcl/src/host.rs`: the 2 s activity line ends with those four numbers - a unit test for the percentiles and the over-100 ms count **Tested** - RTX 4090 (driver 32.0.16.1664), i9-13900K, Windows 11 26200, rustc 1.100.0, release and debug - `cargo build --workspace && cargo test --workspace -- --test-threads=4` on `b8e94b2`: 1155 passed, 0 failed, 46 ignored - `SKIPPED` on this adapter (24): the wave64 GPU tests (the adapter reports waves of 32 lanes) and the f16 / f32-conversion programs the direct path refuses; `heap_window_out_of_memory_falls_back_to_the_switch_form`: no heap windows - a title run on this commit: 1737 frames in 180 s, gaps p50 33 ms, p95 76 ms, max 3759 ms, 46 over 100 ms **Regression run** `main` `cbc296a`: ``` xcl-smoke v1 commit: cbc296ab65a2661a61e3e2da109134bcd5319f60 gpu: NVIDIA GeForce RTX 4090 title: 3c290c16 seconds: 180 exit: 0x0 frames shown: 1901 (PresentX 1901) presents per 2 s (last 3): 0 0 0 device removals: 0 crashes: 0 peak commit: 33336 MB ``` this PR's head `b8e94b2` (clean worktree): ``` xcl-smoke v1 commit: b8e94b2469bcc9fce2be3621c7f1feabeea666b8 gpu: NVIDIA GeForce RTX 4090 title: 3c290c16 seconds: 180 exit: 0x0 frames shown: 1737 (PresentX 1737) presents per 2 s (last 3): 0 0 0 device removals: 0 crashes: 0 peak commit: 35161 MB ``` **Not tested** - AMD, and NVIDIA cards other than this one (the reporting itself does not touch the driver) - a run long enough to get past where this title stalls (driver compiles of its largest compute programs, from t≈88 s on) **AI use** - Claude Code, Claude Fable 5: wrote the code and the test, ran the suite and both smoke runs, wrote this description. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
`XCL_ACTIVITY=1` counts presents per 2 s, which says where a run stops but not
what a frame cost: a run that holds 30 fps and one that alternates 60 fps with
1.5 s gaps print the same line. The gap since the last shown frame is recorded
per frame and reported as p50 / p95 / max and a count over 100 ms, in the same
line, under the same switch.

Co-Authored-By: Claude Code <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:19:10 +00:00
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-25 05:17 UTC · original · edited 2026-11-25 05:21 UTC

Full-suite run, since this PR has no test report yet. Tested exact head b8e94b2 (on its base cbc296a).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::recomp::lower_dxil::tests::mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu --skip gpu::dxil::fuzz_tests: 1143 passed, 0 failed, 44 ignored. SKIPPED (no wave64): a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu, a_per_lane_2d_or_3d_group_runs_on_the_gpu, coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu, cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu, gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware, the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu.
  • The new tests ran and passed: the_frame_clock_reports_percentiles_and_the_frames_over_100_ms.
  • Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 1154 passed, 0 failed, 46 ignored. SKIPPED: f16_programs_on_the_gpu (f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), f32_programs_on_the_gpu (f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))), f32_programs_on_the_gpu (f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • --skip leaves out tests that fail on main 6020a33 too, not because of this PR. On NVIDIA: heap_window_out_of_memory_falls_back_to_the_switch_form (#1651), the four gpu::recomp::lower_dxil::tests::*_programs_on_the_gpu tests, const_and_null_mask_operands_agree_with_hlsl_on_the_gpu and mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu (follow-up on #1651) fail because runner::skip_test turns their skips into failures under XCL_REQUIRE_GPU=mesh, and gpu::dxil::fuzz_tests seeds 70, 545, 1019 and 1507 fail CreateComputePipelineState with E_OUTOFMEMORY on this card (drivers 616.64 and 621.40). On AMD: fuzz_validate_and_gpu_1 fails on seed 540 (res[833] 0x7 vs CPU 0x6). The AMD run does not set XCL_REQUIRE_GPU.

Not tested

  • a release build, a game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
**@⁠futurepro62** on GitHub · 2026-11-25 05:17 UTC · [original](https://github.com/xcl-dev/xcl/pull/2111#issuecomment-7153626247) · edited 2026-11-25 05:21 UTC Full-suite run, since this PR has no test report yet. Tested exact head `b8e94b2` (on its base `cbc296a`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed. - `cargo build --workspace`, then `XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::recomp::lower_dxil::tests::mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu --skip gpu::dxil::fuzz_tests`: **1143 passed, 0 failed, 44 ignored**. SKIPPED (no wave64): `a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu`, `a_per_lane_2d_or_3d_group_runs_on_the_gpu`, `coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu`, `cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu`, `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`, `the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu`. - The new tests ran and passed: `the_frame_clock_reports_percentiles_and_the_frames_over_100_ms`. - Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, `XCL_ADAPTER=radeon`), `cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1`: **1154 passed, 0 failed, 46 ignored**. SKIPPED: `f16_programs_on_the_gpu` (f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), `f16_programs_on_the_gpu` (f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), `f16_programs_on_the_gpu` (f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), `f16_programs_on_the_gpu` (f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), `f32_programs_on_the_gpu` (f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))), `f32_programs_on_the_gpu` (f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))), `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows). - `--skip` leaves out tests that fail on main `6020a33` too, not because of this PR. On NVIDIA: `heap_window_out_of_memory_falls_back_to_the_switch_form` (#1651), the four `gpu::recomp::lower_dxil::tests::*_programs_on_the_gpu` tests, `const_and_null_mask_operands_agree_with_hlsl_on_the_gpu` and `mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu` ([follow-up on #1651](https://git.gtahub.st/github/xcl-dev--xcl/issues/1651)) fail because `runner::skip_test` turns their skips into failures under `XCL_REQUIRE_GPU=mesh`, and `gpu::dxil::fuzz_tests` seeds 70, 545, 1019 and 1507 fail `CreateComputePipelineState` with `E_OUTOFMEMORY` on this card (drivers 616.64 and 621.40). On AMD: `fuzz_validate_and_gpu_1` fails on seed 540 (`res[833]` 0x7 vs CPU 0x6). The AMD run does not set `XCL_REQUIRE_GPU`. **Not tested** - a release build, a game (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 06:02 UTC · original

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-25 06:02 UTC · [original](https://github.com/xcl-dev/xcl/pull/2111#issuecomment-7154385491) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
Author
Owner

@⁠brandostrong on GitHub · 2026-11-25 09:54 UTC · original

Thanks — that is the AMD and second-NVIDIA coverage this PR was missing, and the Blackwell and RDNA2 iGPU runs both cover the new clock path (the_frame_clock_reports_percentiles_and_the_frames_over_100_ms passing on both). Nothing to change for it; I will add your run to the PR's Tested as a third-party report naming b8e94b2.

AI use: Claude Code (Claude Opus 5.5) wrote this reply.

**@⁠brandostrong** on GitHub · 2026-11-25 09:54 UTC · [original](https://github.com/xcl-dev/xcl/pull/2111#issuecomment-7158952895) Thanks — that is the AMD and second-NVIDIA coverage this PR was missing, and the Blackwell and RDNA2 iGPU runs both cover the new clock path (`the_frame_clock_reports_percentiles_and_the_frames_over_100_ms` passing on both). Nothing to change for it; I will add your run to the PR's **Tested** as a third-party report naming `b8e94b2`. AI use: Claude Code (Claude Opus 5.5) wrote this reply.
Author
Owner

@⁠raylitebull on GitHub · 2026-11-25 10:51 UTC · original

Update: #2111 passed dual-vendor checks (NVIDIA RTX 4090 / RTX 5070 Ti / RTX 3060 Ti + AMD Radeon iGPU) and both CI checks, and recent merges on main introduced a merge conflict (DIRTY). @⁠brandostrong — please rebase onto latest main so CI runs cleanly and we can merge!

**@⁠raylitebull** on GitHub · 2026-11-25 10:51 UTC · [original](https://github.com/xcl-dev/xcl/pull/2111#issuecomment-7160273373) Update: #2111 passed dual-vendor checks (**NVIDIA RTX 4090 / RTX 5070 Ti / RTX 3060 Ti** + **AMD Radeon iGPU**) and both CI checks, and recent merges on main introduced a merge conflict (DIRTY). @⁠brandostrong — please rebase onto latest main so CI runs cleanly and we can merge!
Author
Owner

@⁠thehollowedone on GitHub · 2026-11-25 15:34 UTC · original

Independent Windows check of b8e94b2 integrated locally onto 0829441. The merge conflict was resolved by keeping both the present-ring and frame-percentile tests. Both passed.

I added two presents to the bundled synthetic title after deliberate waits of 135 ms and 40 ms. The PR logged three presents, but its maximum gap was 41 ms and it counted zero gaps over 100 ms. In this run the first call to the elapsed clock returned zero, which the guard also uses to mean that there was no previous frame. With a local one-line change to use the existing present count (if n != 0) instead of the prior timestamp as the guard, the same test logged a 136 ms maximum and one gap over 100 ms.

The workspace built and reported 1,273 passed, 0 failed, 46 ignored, including 26 runtime skips, both before and after that one-line change with the synthetic instrumentation removed. RTX 3080 Ti (621.35), Windows 11 build 26300, Rust 1.99.1 MSVC and DXC 1.8.2502.11. Synthetic tests only. AI-assisted. Codex (GPT-6, exact variant unavailable) resolved the local conflict, instrumented the fixture, checked the change and drafted this report.

**@⁠thehollowedone** on GitHub · 2026-11-25 15:34 UTC · [original](https://github.com/xcl-dev/xcl/pull/2111#issuecomment-7167050220) Independent Windows check of [b8e94b2](https://github.com/xcl-dev/xcl/commit/b8e94b2469bcc9fce2be3621c7f1feabeea666b8) integrated locally onto [0829441](https://github.com/xcl-dev/xcl/commit/082944135cd2b96288470a595861fa608eee08dc). The merge conflict was resolved by keeping both the present-ring and frame-percentile tests. Both passed. I added two presents to the bundled synthetic title after deliberate waits of 135 ms and 40 ms. The PR logged three presents, but its maximum gap was 41 ms and it counted zero gaps over 100 ms. In this run the first call to the elapsed clock returned zero, which the guard also uses to mean that there was no previous frame. With a local one-line change to use the existing present count (if n != 0) instead of the prior timestamp as the guard, the same test logged a 136 ms maximum and one gap over 100 ms. The workspace built and reported **1,273 passed, 0 failed, 46 ignored**, including 26 runtime skips, both before and after that one-line change with the synthetic instrumentation removed. RTX 3080 Ti (621.35), Windows 11 build 26300, Rust 1.99.1 MSVC and DXC 1.8.2502.11. Synthetic tests only. AI-assisted. Codex (GPT-6, exact variant unavailable) resolved the local conflict, instrumented the fixture, checked the change and drafted this report.
Author
Owner

@⁠luckyteagirl on GitHub · 2026-11-26 08:54 UTC · original · reviewed

At exact head b8e94b2 (base 6987e49, current main b49be18), the new gap clock samples after optional frame-dump work rather than at the successful Present. This is a source-derived review; I did not run a timed title fixture.

present.rs sets p.last = Instant::now() immediately after sc.Present, then can wait up to 2,000 ms for a dump fence and write the bitmap before PRESENTS/FRAME_TIMES samples now_ms(). With XCL_ACTIVITY and XCL_FRAME_DUMP together, a slow dump is charged to the gap ending at the already-shown frame and removed from the next gap. For example, Presents at 0, 20, and 115 ms have actual gaps 20 and 95 ms. If the middle frame's post-Present dump takes 90 ms, this telemetry records roughly 110 and 5 ms and falsely increments the “over 100 ms” count.

Could the frame-time sample be taken alongside p.last, before the dump wait/writes, and then added to FRAME_TIMES later? A deterministic clock fixture with delayed work after a successful Present would protect the attribution.

AI assistance: GPT-6.2 Sol found the timing path; GPT-6.2 Astra verified the exact-head source and example.

**@⁠luckyteagirl** on GitHub · 2026-11-26 08:54 UTC · [original](https://github.com/xcl-dev/xcl/pull/2111#pullrequestreview-6071038464) · **reviewed** At exact head `b8e94b2` (base `6987e49`, current main `b49be18`), the new gap clock samples after optional frame-dump work rather than at the successful Present. This is a source-derived review; I did not run a timed title fixture. `present.rs` sets `p.last = Instant::now()` immediately after `sc.Present`, then can wait up to 2,000 ms for a dump fence and write the bitmap before `PRESENTS`/`FRAME_TIMES` samples `now_ms()`. With `XCL_ACTIVITY` and `XCL_FRAME_DUMP` together, a slow dump is charged to the gap ending at the already-shown frame and removed from the next gap. For example, Presents at 0, 20, and 115 ms have actual gaps 20 and 95 ms. If the middle frame's post-Present dump takes 90 ms, this telemetry records roughly 110 and 5 ms and falsely increments the “over 100 ms” count. Could the frame-time sample be taken alongside `p.last`, before the dump wait/writes, and then added to `FRAME_TIMES` later? A deterministic clock fixture with delayed work after a successful Present would protect the attribution. AI assistance: GPT-6.2 Sol found the timing path; GPT-6.2 Astra verified the exact-head source and example.
This pull request has changes conflicting with the target branch.
  • crates/xcl/src/hle/d3d12x/present.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2111/head:github-bot/gh-2111'
git switch 'github-bot/gh-2111'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2111'
git switch 'github-bot/gh-2111'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2111'
git switch 'github-bot/gh-2111'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2111'
git switch 'main'
git merge --squash 'github-bot/gh-2111'
git switch 'main'
git merge --ff-only 'github-bot/gh-2111'
git switch 'main'
git merge 'github-bot/gh-2111'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.