Skip missing DXGI present counts in frame generation timing #14

Open
HandshakeHackin wants to merge 74 commits from upstream-pr/14 into main
HandshakeHackin commented 2026-11-25 16:21:25 +00:00 (Migrated from github.com)

Imported from PastiiJay/klbf-lab. Originally posted by HandshakeHackin on 2026-11-25T16:21:25Z.


GetLastPresentCount().ok() can yield None. Converting that to zero makes wrapping_sub treat a failed query as a real counter wrap. The next successful query can then produce another inflated sample. Keep the previous valid baseline through missing queries. The real frame ID still advances on every present.

In an isolated harness compiled from the original and patched Rust function, cumulative readings [100, None, 104] spaced ~1.05 s apart produced ~4.09 billion and 99.0 presented FPS before the patch. Afterward they produced one 1.9 FPS sample over the two valid readings. Also checked an initially missing reading, a genuine u32 wrap, and valid zero counts.

Windows target compile check passed: cargo check --locked -p victory-gpu --tests --target x86_64-pc-windows-msvc --features blake3/pure. No hardware run.

The GPU crate now includes a fixed-clock regression at d184745. It covers an initially missing query, a sub-second reading, a second missing query, a genuine wrap to zero and consecutive valid zeros. All three frame-generation module tests passed on native Windows. Restoring the old missing-as-zero behavior made the regression report 4,294,967,292 presented FPS on the first interval. Windows test and negative control.

<!-- greyfinch-sync:PastiiJay/klbf-lab:issue:5494992796 --> Imported from [PastiiJay/klbf-lab](https://github.com/PastiiJay/klbf-lab/pull/14). Originally posted by [HandshakeHackin](https://github.com/HandshakeHackin) on 2026-11-25T16:21:25Z. --- `GetLastPresentCount().ok()` can yield `None`. Converting that to zero makes `wrapping_sub` treat a failed query as a real counter wrap. The next successful query can then produce another inflated sample. Keep the previous valid baseline through missing queries. The real frame ID still advances on every present. In an isolated harness compiled from the original and patched Rust function, cumulative readings `[100, None, 104]` spaced ~1.05 s apart produced ~4.09 billion and 99.0 presented FPS before the patch. Afterward they produced one 1.9 FPS sample over the two valid readings. Also checked an initially missing reading, a genuine u32 wrap, and valid zero counts. Windows target compile check passed: `cargo check --locked -p victory-gpu --tests --target x86_64-pc-windows-msvc --features blake3/pure`. No hardware run. The GPU crate now includes a fixed-clock regression at `d184745`. It covers an initially missing query, a sub-second reading, a second missing query, a genuine wrap to zero and consecutive valid zeros. All three frame-generation module tests passed on native Windows. Restoring the old missing-as-zero behavior made the regression report 4,294,967,292 presented FPS on the first interval. [Windows test and negative control](https://github.com/HandshakeHackin/klbf-lab/actions/runs/45812871826).
PastiiJay commented 2026-11-25 17:02:31 +00:00 (Migrated from github.com)

Imported from PastiiJay/klbf-lab. Originally posted by PastiiJay on 2026-11-25T17:02:31Z.


Thanks a lot @HandshakeHackin! Noted. I'll test it on the RX 9070 XT in the next test build and report back here.

<!-- greyfinch-sync:PastiiJay/klbf-lab:comment:7168912694 --> Imported from [PastiiJay/klbf-lab](https://github.com/PastiiJay/klbf-lab/pull/14#issuecomment-7168912694). Originally posted by [PastiiJay](https://github.com/PastiiJay) on 2026-11-25T17:02:31Z. --- Thanks a lot @HandshakeHackin! Noted. I'll test it on the RX 9070 XT in the next test build and report back here.
PastiiJay commented 2026-11-26 11:49:40 +00:00 (Migrated from github.com)

Imported from PastiiJay/klbf-lab. Originally posted by PastiiJay on 2026-11-26T11:49:40Z.


Thanks for adding the deterministic clock, that makes the missing-count case testable without real frames. We will merge it with the next beta batch; a short line in the description on what the test covers would be handy.

<!-- greyfinch-sync:PastiiJay/klbf-lab:comment:7191216095 --> Imported from [PastiiJay/klbf-lab](https://github.com/PastiiJay/klbf-lab/pull/14#issuecomment-7191216095). Originally posted by [PastiiJay](https://github.com/PastiiJay) on 2026-11-26T11:49:40Z. --- Thanks for adding the deterministic clock, that makes the missing-count case testable without real frames. We will merge it with the next beta batch; a short line in the description on what the test covers would be handy.
akimfomin commented 2026-11-28 02:04:34 +00:00 (Migrated from github.com)

Imported from PastiiJay/klbf-lab. Originally posted by akimfomin on 2026-11-28T02:04:34Z.


I downloaded the d184745 source, extracted only present_rates and its fixed-clock regression, and ran them with rustc 1.100.1 on Windows. The test passed, with no GPU needed. The VIctory #3313 timing review now cites your distinction between missing counts and valid zero. For subsequent source-only checks, the public PortBridge agent entry accepts one PR link and question, without repo installation.

<!-- greyfinch-sync:PastiiJay/klbf-lab:comment:7232113002 --> Imported from [PastiiJay/klbf-lab](https://github.com/PastiiJay/klbf-lab/pull/14#issuecomment-7232113002). Originally posted by [akimfomin](https://github.com/akimfomin) on 2026-11-28T02:04:34Z. --- I downloaded the `d184745` source, extracted only `present_rates` and its fixed-clock regression, and ran them with `rustc 1.100.1` on Windows. The test passed, with no GPU needed. The [VIctory #3313](https://github.com/Marvisak/VIctory/pull/3313#issuecomment-7232062508) timing review now cites your distinction between missing counts and valid zero. For subsequent source-only checks, the public [PortBridge agent entry](https://github.com/akimfomin/PortBridge/issues/98) accepts one PR link and question, without repo installation.
HandshakeHackin commented 2026-11-29 03:23:04 +00:00 (Migrated from github.com)

Imported from PastiiJay/klbf-lab. Originally posted by HandshakeHackin on 2026-11-29T03:23:04Z.


I ported the meter change to the shipped v26.11.9 framegen.rs. Its real reporting function gave 19,041 FPS after one failed query and 0 FPS across a genuine counter wrap in two controlled sequences. Both measured 1.90 FPS after the port. Release-based patch · Four Windows processes

A separate issue affects the saved BM-v1 card: it uses the frame-generation ratio since launch, including loading screens. In a synthetic run generating two displayed frames per rendered frame only during the timed portion, stock saved a 1.49× ratio. When only the loading screens generated extra frames, it still saved 1.51×. Follow-up commit samples from the first world frame to the last timed frame. It saved 2.00× for the first case and reported rendered FPS only for the second and for a missing final count. Six saved JSON comparisons

<!-- greyfinch-sync:PastiiJay/klbf-lab:comment:7250014661 --> Imported from [PastiiJay/klbf-lab](https://github.com/PastiiJay/klbf-lab/pull/14#issuecomment-7250014661). Originally posted by [HandshakeHackin](https://github.com/HandshakeHackin) on 2026-11-29T03:23:04Z. --- I ported the meter change to the shipped v26.11.9 `framegen.rs`. Its real reporting function gave 19,041 FPS after one failed query and 0 FPS across a genuine counter wrap in two controlled sequences. Both measured 1.90 FPS after the port. [Release-based patch](https://github.com/HandshakeHackin/klbf-lab/commit/b9f74781ccec52eac9531dc1ab094f6d15333252) · [Four Windows processes](https://github.com/HandshakeHackin/klbf-lab/actions/runs/46219311575/job/141210284854) A separate issue affects the saved BM-v1 card: it uses the frame-generation ratio since launch, including loading screens. In a synthetic run generating two displayed frames per rendered frame only during the timed portion, stock saved a 1.49× ratio. When only the loading screens generated extra frames, it still saved 1.51×. [Follow-up commit](https://github.com/HandshakeHackin/klbf-lab/commit/0cbea253eea7abd9c0782d6bee154ec9cb241054) samples from the first world frame to the last timed frame. It saved 2.00× for the first case and reported rendered FPS only for the second and for a missing final count. [Six saved JSON comparisons](https://github.com/HandshakeHackin/klbf-lab/actions/runs/46219601442/job/141211152725)
PastiiJay commented 2026-11-29 08:24:42 +00:00 (Migrated from github.com)

Imported from PastiiJay/klbf-lab. Originally posted by PastiiJay on 2026-11-29T08:24:42Z.


The port onto the shipped framegen.rs and the loading-screen ratio are both noted. Neither is in the v26.11.10 pre-release yet; they go into the next round with credit, the BM-v1 ratio especially since the board reads it.

Quick one before we pick them: does 0cbea25 need b9f7478 under it, or can it go in alone?

<!-- greyfinch-sync:PastiiJay/klbf-lab:comment:7253087462 --> Imported from [PastiiJay/klbf-lab](https://github.com/PastiiJay/klbf-lab/pull/14#issuecomment-7253087462). Originally posted by [PastiiJay](https://github.com/PastiiJay) on 2026-11-29T08:24:42Z. --- The port onto the shipped `framegen.rs` and the loading-screen ratio are both noted. Neither is in the v26.11.10 pre-release yet; they go into the next round with credit, the BM-v1 ratio especially since the board reads it. Quick one before we pick them: does `0cbea25` need `b9f7478` under it, or can it go in alone?
HandshakeHackin commented 2026-11-30 13:17:12 +00:00 (Migrated from github.com)

Imported from PastiiJay/klbf-lab. Originally posted by HandshakeHackin on 2026-11-30T13:17:12Z.


Yes. On v26.11.9, apply b9f7478 first, then 0cbea25. The second uses the first commit’s counter sampling and reset code. On a clean v26.11.9 checkout, the second patch alone fails to apply and the pair applies in that order. For v26.11.17 stable or the v26.11.18 release candidate, 2646a41 applies as a single cherry-pick and preserves the DLSS and XeSS multipliers.

On both releases, Windows wrote six BM-v1 results from synthetic frame counts, three with stock code and three with the patch. With 2× generation during the timed section only, the saved ratio changed from 1.49× to 2.00×. When generation happened only during loading, or the final DXGI count was missing, the patched file reported rendered FPS only. All 23 benchmark tests, six frame-generation tests and Clippy passed on each release. Windows verification for both versions

<!-- greyfinch-sync:PastiiJay/klbf-lab:comment:7279623882 --> Imported from [PastiiJay/klbf-lab](https://github.com/PastiiJay/klbf-lab/pull/14#issuecomment-7279623882). Originally posted by [HandshakeHackin](https://github.com/HandshakeHackin) on 2026-11-30T13:17:12Z. --- Yes. On v26.11.9, apply `b9f7478` first, then `0cbea25`. The second uses the first commit’s counter sampling and reset code. On a clean v26.11.9 checkout, the second patch alone fails to apply and the pair applies in that order. For v26.11.17 stable or the v26.11.18 release candidate, [2646a41](https://github.com/HandshakeHackin/klbf-lab/commit/2646a4199ca5070664614df62edc5c6f76f9240e) applies as a single cherry-pick and preserves the DLSS and XeSS multipliers. On both releases, Windows wrote six BM-v1 results from synthetic frame counts, three with stock code and three with the patch. With 2× generation during the timed section only, the saved ratio changed from 1.49× to 2.00×. When generation happened only during loading, or the final DXGI count was missing, the patched file reported rendered FPS only. All 23 benchmark tests, six frame-generation tests and Clippy passed on each release. [Windows verification for both versions](https://github.com/HandshakeHackin/klbf-lab/actions/runs/46425603300)
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/14:upstream-pr/14'
git switch 'upstream-pr/14'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/14'
git switch 'upstream-pr/14'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/14'
git switch 'upstream-pr/14'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/14'
git switch 'main'
git merge --squash 'upstream-pr/14'
git switch 'main'
git merge --ff-only 'upstream-pr/14'
git switch 'main'
git merge 'upstream-pr/14'
git push origin 'main'
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
PastiiJay/klbf-lab!14
No description provided.