GPU: synchronize frame interval resets with tick reservations #2477

Open
VlREX wants to merge 3 commits from upstream-pr/2479 into main
VlREX commented 2026-11-25 14:27:05 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by VlREX on 2026-11-25T14:27:05Z.


set_interval reads the last reserved ticks before acquiring CLOCK. A concurrent next_tick can reserve another tick in between, leaving the new interval anchored to an older tick and potentially adding an interval to the next wait for that event kind.

Hold the same CLOCK lock around the LAST scan and the clock replacement. This keeps interval resets ordered with the reservations introduced in #174.

Verified that the patch is one commit on upstream main and only changes frame.rs. Rust tests were not run locally. No title data was used.

<!-- greyfinch-sync:Marvisak/VIctory:issue:5493263382 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2479). Originally posted by [VlREX](https://github.com/VlREX) on 2026-11-25T14:27:05Z. --- `set_interval` reads the last reserved ticks before acquiring `CLOCK`. A concurrent `next_tick` can reserve another tick in between, leaving the new interval anchored to an older tick and potentially adding an interval to the next wait for that event kind. Hold the same `CLOCK` lock around the `LAST` scan and the clock replacement. This keeps interval resets ordered with the reservations introduced in #174. Verified that the patch is one commit on upstream `main` and only changes `frame.rs`. Rust tests were not run locally. No title data was used.
catminou4 commented 2026-11-25 14:57:42 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T14:57:42Z.

Review: COMMENTED


Synchronize frame interval resets with tick reservations. Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1.

<!-- greyfinch-sync:Marvisak/VIctory:review:6059997929 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2479#pullrequestreview-6059997929). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T14:57:42Z. **Review:** COMMENTED --- Synchronize frame interval resets with tick reservations. Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1.
Bj0rnis commented 2026-11-25 15:04:23 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Bj0rnis on 2026-11-25T14:41:35Z.


Independent Windows 11 hardware + WARP verification of #2479 at b5e0caab (clean git merge-tree with origin/main 940d32f6, Rust 1.98.1 MSVC):

  • NVIDIA GeForce RTX 5070 Ti (real hardware): cargo test -p victory-gpu --features diagnostics --lib --locked -- --test-threads=1 -> 144 passed, 2 failed, 2 ignored (only the 2 pre-existing #1744 NVIDIA 1M view-heap baseline failures also present on main 940d32f6; all frame::tests passed).
  • WARP (VICTORY_D3D12_WARP=1): 146 passed, 0 failed, 2 ignored (0.99s).
  • Clippy: cargo clippy -p victory-gpu --all-targets --all-features --locked -- -D warnings -> 0 warnings.
  • Asset policy: cargo xtask policy -> 182 files ok.

Not tested: live game workload / frame pacing soak test.

AI-assisted test run and summary.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7165667657 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2479#issuecomment-7165667657). Originally posted by [Bj0rnis](https://github.com/Bj0rnis) on 2026-11-25T14:41:35Z. --- Independent Windows 11 hardware + WARP verification of #2479 at `b5e0caab` (clean `git merge-tree` with `origin/main` `940d32f6`, Rust 1.98.1 MSVC): - **NVIDIA GeForce RTX 5070 Ti (real hardware):** `cargo test -p victory-gpu --features diagnostics --lib --locked -- --test-threads=1` -> **144 passed, 2 failed, 2 ignored** (only the 2 pre-existing #1744 NVIDIA 1M view-heap baseline failures also present on `main` `940d32f6`; all `frame::tests` passed). - **WARP (`VICTORY_D3D12_WARP=1`):** **146 passed, 0 failed, 2 ignored** (0.99s). - **Clippy:** `cargo clippy -p victory-gpu --all-targets --all-features --locked -- -D warnings` -> **0 warnings**. - **Asset policy:** `cargo xtask policy` -> **182 files ok**. Not tested: live game workload / frame pacing soak test. AI-assisted test run and summary.
VlREX commented 2026-11-25 21:03:27 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by VlREX on 2026-11-25T21:03:10Z.


Native AMD / Windows 10 validation

CPU: AMD Ryzen 5 3600X
GPU: Radeon RX 5700 XT
Driver: 32.0.21045.29003
OS: Windows 10 Pro 19045
Rust: 1.98.1

  • Workspace check: PASS
  • Frame tests: 2/2 PASS
  • Eight-thread tick reservation test: PASS
  • Clippy (-D warnings): PASS
  • GitHub CI: PASS

Tested commit: 30a5f1d

Full GPU suite and live gameplay frame pacing
were not tested in this run.

AI-assisted development (ChatGPT).
Native verification using VIREX Test Studio 1.2.1.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7174544247 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2479#issuecomment-7174544247). Originally posted by [VlREX](https://github.com/VlREX) on 2026-11-25T21:03:10Z. --- ### Native AMD / Windows 10 validation CPU: AMD Ryzen 5 3600X GPU: Radeon RX 5700 XT Driver: 32.0.21045.29003 OS: Windows 10 Pro 19045 Rust: 1.98.1 - Workspace check: PASS - Frame tests: 2/2 PASS - Eight-thread tick reservation test: PASS - Clippy (-D warnings): PASS - GitHub CI: PASS Tested commit: 30a5f1d Full GPU suite and live gameplay frame pacing were not tested in this run. AI-assisted development (ChatGPT). Native verification using VIREX Test Studio 1.2.1.
andrewpozdnakov7-jpg commented 2026-11-28 13:35:05 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T13:35:05Z.


I combined this PR at 30a5f1d with the virtual clock from #2877 at 8616219 on current main 63bcca4. Tested branch at edb4bb0. Both exact PR heads and their Git authors are preserved.

In a two-thread synthetic check, I paused the interval reset just before it acquired the clock mutex, reserved tick 1, then let the reset finish. The next reservation requested tick 2. With #2877 alone it waited 14 ms after switching to a 7 ms interval. With this PR's locking applied to Pacer it waited 7 ms. The combined code samples the new start time and the latest reserved tick while holding the same lock.

The eight-thread test now uses the virtual clock and checks that eight simultaneous reservations get ticks 1 through 8, a zero-timeout poll takes none, and the first tick after the reset uses the new interval. All three frame tests passed in 30 separate processes. On WARP 1.0.22 with Agility 1.620.2, the full GPU diagnostics suite had 247 passed and one ignored with the D3D12 debug layer off and on. Strict GPU Clippy in both configurations and the asset policy passed.

Please retain the original Git authors if carrying either change separately. If folding the integration changes into another commit, please add Co-authored-by: andrewpozdnakov7-jpg <[email protected]>. AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7240038938 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2479#issuecomment-7240038938). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-28T13:35:05Z. --- I combined this PR at `30a5f1d` with the virtual clock from #2877 at `8616219` on current main `63bcca4`. [Tested branch at `edb4bb0`](https://github.com/andrewpozdnakov7-jpg/VIctory/tree/review/2479-2877-frame-clock). Both exact PR heads and their Git authors are preserved. In a two-thread synthetic check, I paused the interval reset just before it acquired the clock mutex, reserved tick 1, then let the reset finish. The next reservation requested tick 2. With #2877 alone it waited 14 ms after switching to a 7 ms interval. With this PR's locking applied to `Pacer` it waited 7 ms. The combined code samples the new start time and the latest reserved tick while holding the same lock. The eight-thread test now uses the virtual clock and checks that eight simultaneous reservations get ticks 1 through 8, a zero-timeout poll takes none, and the first tick after the reset uses the new interval. All three frame tests passed in 30 separate processes. On WARP 1.0.22 with Agility 1.620.2, the full GPU diagnostics suite had 247 passed and one ignored with the D3D12 debug layer off and on. Strict GPU Clippy in both configurations and the asset policy passed. Please retain the original Git authors if carrying either change separately. If folding the integration changes into another commit, please add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>`. AI-assisted with OpenAI Codex.
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/2479:upstream-pr/2479'
git switch 'upstream-pr/2479'

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/2479'
git switch 'upstream-pr/2479'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2479'
git switch 'upstream-pr/2479'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2479'
git switch 'main'
git merge --squash 'upstream-pr/2479'
git switch 'main'
git merge --ff-only 'upstream-pr/2479'
git switch 'main'
git merge 'upstream-pr/2479'
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
Marvisak/VIctory!2477
No description provided.