GPU: two frame waits that pick the same tick no longer both end on it #325

Open
RenzoWit35 wants to merge 1 commit from upstream-pr/325 into main
RenzoWit35 commented 2026-11-24 23:34:38 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by RenzoWit35 on 2026-11-24T23:34:38Z.


Fixes #244.

A wait chose its tick before sleeping and then advanced LAST with fetch_max, ignoring the
previous value, so two concurrent waits (two FLIP waits, or both on the late path) could both
return S_OK on one tick. The wait (now in claim()) ends only if its fetch_max moved LAST
past the previous value. Otherwise it waits for the next tick against the original deadline,
so a retry never lengthens the caller's time-out.

Tests: two concurrent waits end on different ticks (three rounds); three waits aligned on a
tick, with 150 ms time-outs and 100 ms ticks, give exactly one S_OK and two time-outs within
the limit (on main all three ended on the same tick). The frame tests share the global clock,
so they now take a test lock.

Note for review: the existing waits_end_on_ticks_and_count_frames relies on sleeps landing
within a 5 ms tick; on a heavily loaded machine it can fail on main too.

Testing

On Windows 11, MSVC Rust 1.98.1, branch alone on top of main (2119b0e): cargo clippy --workspace --all-targets --locked -- -D warnings, the same with --all-features, and cargo test --workspace --locked all pass. The new regression test fails on main and passes here. All nine fix branches for #242-#250 also pass together when merged.

🤖 Generated with Claude Code

<!-- greyfinch-sync:fxceless/victory-fork:issue:6593595880 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/325). Originally posted by [RenzoWit35](https://github.com/RenzoWit35) on 2026-11-24T23:34:38Z. --- Fixes #244. A wait chose its tick before sleeping and then advanced `LAST` with `fetch_max`, ignoring the previous value, so two concurrent waits (two FLIP waits, or both on the late path) could both return `S_OK` on one tick. The wait (now in `claim()`) ends only if its `fetch_max` moved `LAST` past the previous value. Otherwise it waits for the next tick against the original deadline, so a retry never lengthens the caller's time-out. Tests: two concurrent waits end on different ticks (three rounds); three waits aligned on a tick, with 150 ms time-outs and 100 ms ticks, give exactly one `S_OK` and two time-outs within the limit (on `main` all three ended on the same tick). The frame tests share the global clock, so they now take a test lock. Note for review: the existing `waits_end_on_ticks_and_count_frames` relies on sleeps landing within a 5 ms tick; on a heavily loaded machine it can fail on `main` too. ## Testing On Windows 11, MSVC Rust 1.98.1, branch alone on top of `main` (2119b0e): `cargo clippy --workspace --all-targets --locked -- -D warnings`, the same with `--all-features`, and `cargo test --workspace --locked` all pass. The new regression test fails on `main` and passes here. All nine fix branches for #242-#250 also pass together when merged. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
kaayzouee commented 2026-11-25 02:10:06 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by kaayzouee on 2026-11-25T01:16:59Z.


Duplicate of #281?

<!-- greyfinch-sync:fxceless/victory-fork:comment:7149389118 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/325#issuecomment-7149389118). Originally posted by [kaayzouee](https://github.com/kaayzouee) on 2026-11-25T01:16:59Z. --- Duplicate of #281?
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/325:upstream-pr/325'
git switch 'upstream-pr/325'

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/325'
git switch 'upstream-pr/325'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/325'
git switch 'upstream-pr/325'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/325'
git switch 'main'
git merge --squash 'upstream-pr/325'
git switch 'main'
git merge --ff-only 'upstream-pr/325'
git switch 'main'
git merge 'upstream-pr/325'
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
fxceless/victory-fork!325
No description provided.