Skip to content

GPU tests: two tests CI runners failed hold on a loaded host - #2861

Open
0xkn0wh3r3 wants to merge 1 commit into
Marvisak:mainfrom
0xkn0wh3r3:tests/flaky-gpu-tests-on-loaded-runners
Open

0xkn0wh3r3 wants to merge 1 commit into
Marvisak:mainfrom
0xkn0wh3r3:tests/flaky-gpu-tests-on-loaded-runners

Conversation

@0xkn0wh3r3

Copy link
Copy Markdown
Contributor

Problem

Two GPU tests fail on CI runners now and then, on changes that don't touch them:

  • frame::tests::waits_end_on_ticks_and_count_frames (frame.rs:231, failed on Shaders: pixel programs the console tests depth before keep early depth #2085's run). Its first part runs 2 ms ticks and expects a wait with a zero time-out to time out right after a wait returned on a tick. A runner woken a little late finds the next tick has already passed and gets S_OK.
  • descriptor::host::tests::views_bound_while_another_slot_gets_its_texture_do_not_wait (descriptor/host.rs:2011, failed on GPU: a submission's refreshes copy on several threads #2051's run). It and a_slot_rewritten_while_its_view_is_prepared_views_the_new_record hand the next view prepared some work through WHILE_PREPARING, a static every test shares. Another test preparing a view of its own at the same time takes the work, so the test's own view is made without it.

Change

  • The frame test's first part uses 50 ms ticks, as its second part already does for the same reason ("a thread woken 15-30 ms late on a busy host ... still makes its tick"). The bound on the second wait goes from 50 ms to 250 ms to fit one tick plus slack. What it checks is unchanged.
  • WHILE_PREPARING is per thread (thread_local!). Both tests call mirror on their own thread, which is where prepare runs the work, and the thread each one spawns can't take it.

Tests only; no runtime code changes.

Testing

On an RTX 5070 Ti: cargo test -p victory-gpu --lib 8 times in a row, plus the three tests alone 10 times. None of them failed. The only failures were dynamic_slots_are_held_until_released and lists_share_a_table_and_copies_keep_their_views, which fail on main on NVIDIA (#1835's heap cap). Clippy, with and without diagnostics, and cargo xtask policy are clean.

`frame::tests::waits_end_on_ticks_and_count_frames` ran 2 ms ticks and
expected a wait with no time to wait to time out right after a tick: a
runner woken a tick late found the next tick passed (CI, Marvisak#2085). It uses
50 ms ticks, as the test's second part already does for the same reason.

`views_bound_while_another_slot_gets_its_texture_do_not_wait` and
`a_slot_rewritten_while_its_view_is_prepared_views_the_new_record` set
work for the next view prepared, in a static every test shares: another
test preparing a view of its own meanwhile took it (CI, Marvisak#2051). The work
is now per thread; both tests prepare on their own thread.

@kotekompotek kotekompotek left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right fix for the CI flake: WHILE_PREPARING as a global Mutex meant whichever parallel test hit prepare first consumed the injected work — a test preparing its own view ran another's closure and both misbehaved. thread_local makes the hook per-test-thread, matching how cargo test parallelizes. LGTM.

@fuzeofficlal fuzeofficlal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified head b6702963 cleanly merged onto origin/main (63bcca43) on Windows 11 x64 (NVIDIA GeForce RTX 5090 + D3D12 WARP + VICTORY_D3D12_DEBUG=1).

Code Review & Cross-PR Note

  • crates/victory-gpu/src/descriptor/host.rs: Moving the test hook WHILE_PREPARING from a process-wide Mutex<Option<Work>> to thread_local! { RefCell<Option<Work>> } eliminates a genuine cross-test concurrency race when parallel GPU tests invoke HostHeap::mirror.
  • crates/victory-gpu/src/frame.rs overlap with #2877: Widening the 2 ms / 50 ms tolerances to 50 ms / 250 ms touches the same test that #2877 refactors onto a deterministic virtual clock (struct Pacer). If #2877 lands first, the frame.rs portion here is superseded, while the descriptor/host.rs thread_local! fix remains independently valuable.

Local Verification (VICTORY_D3D12_DEBUG=1, 5 consecutive rounds)

  • RTX 5090: descriptor::host::tests (skipping pre-existing 1M cap baseline dynamic_slots_are_held_until_released) 14/14 x 5 rounds, frame::tests 2/2 x 5 rounds.
  • WARP: descriptor::host::tests 15/15 x 5 rounds, frame::tests 2/2 x 5 rounds.
  • cargo clippy --locked -p victory-gpu --all-targets -- -D warnings (default and --features diagnostics) & cargo xtask policy (191 files ok): clean.

@0xkn0wh3r3

Copy link
Copy Markdown
Contributor Author

@fuzeofficlal thanks for the five rounds on both adapters. Agreed on #2877: if its virtual clock lands first, the frame.rs part here is superseded and I'll drop it, keeping only the per-thread WHILE_PREPARING, which is independent.

@futurepro62

Copy link
Copy Markdown

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

Tested

Not tested

  • AMD (the tests take the default adapter), a release build, the title (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.

Marvisak commented Nov 26, 2026 •

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Thanks. Nothing has changed since the last review (same head). It stays a merge candidate, and the frame.rs half drops out if #2877 lands first.


Generated by Claude Code

@0xkn0wh3r3

Copy link
Copy Markdown
Contributor Author

Thanks for the runs. On the overlap with #2877: its virtual clock is the better fix for waits_end_on_ticks_and_count_frames. If #2877 lands first I'll drop the frame.rs change from this PR and keep only the thread_local! hook in descriptor/host.rs, which fixes the other flake (views_bound_while_another_slot_gets_its_texture_do_not_wait) on its own.

@Dukestar69 Dukestar69 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified on RTX 5090 against origin/main (63bcca4):

  • cargo test -p victory-gpu --lib descriptor::host::tests::views_ -- --test-threads=1: 2/2 passed.
  • cargo test -p victory-gpu --lib frame:: -- --test-threads=1: 2/2 passed.
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Cleanly hardens both timing-sensitive CI tests against loaded host scheduling jitter.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants