Tests: one submission at a time across the suite (no_write_is_lost_with_port_7 failed beside refreshed_ranges_hold_title_memory) #382

Open
github-bot wants to merge 1 commit from github-bot/gh-382 into a-publier AGit
Owner

@⁠felicerosella on GitHub · 2026-11-26 22:58 UTC · original
felicerosella:fix/one-submission-in-tests → a-publier · +14 −3 · 2 files · 1 commits · open

watch::port7_tests::no_write_is_lost_with_port_7 fails now and then in the parallel victory-gpu suite, with round N, page P: X is not after X from its submission thread. It is another test's doing, not port 7's.

Cause. ask_once ends whatever asking stands, as it should with the runtime's one submission thread. The tests that play the submission each kept to that in their own way, or not at all:

  • host::refresh_tests::submission: a mutex of its own (static ONE)
  • host::refresh_tests::unchanged_ranges_are_known: a retry "if a submission of another test ended it"
  • the port-7 test's submission thread, and watch::tests::the_rest_of_the_one_asking_has_a_number_of_its_own: nothing

So refreshed_ranges_hold_title_memory's ask_once ended the port-7 test's asking mid-round, and that test then read a page's write with a number it had already seen.

Fix (test code only). watch::submission_in_test() is one lock for all of them:

  • the host helper's mutex becomes this lock;
  • unchanged_ranges_are_known's look and the_rest_of_the_one_asking_has_a_number_of_its_own hold it;
  • the port-7 test's submission thread holds it for each round. Its writers and askers still run alongside, which is what that test is about.

I left unchanged_ranges_are_known's retry loop in place to keep the change small.

Results on a-publier at 4eb6cfd, RTX 4070 SUPER, Ryzen 7 7800X3D, Windows 11 26200:

before after
no_write_is_lost_with_port_7 + refreshed_ranges_hold_title_memory (--exact), 20 runs 20/20 failed 0/20 failed
full cargo test -p victory-gpu --lib, 10 runs 10/10 clean 10/10 clean

In the full suite it only shows up now and then. It came up once in 4 full runs on this machine while I was testing something else. cargo clippy -p victory-gpu --all-targets -- -D warnings is clean.

AI-assisted: yes (Claude Code)

**@⁠felicerosella** on GitHub · 2026-11-26 22:58 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/382) `felicerosella:fix/one-submission-in-tests` → `a-publier` · +14 −3 · 2 files · 1 commits · open `watch::port7_tests::no_write_is_lost_with_port_7` fails now and then in the parallel `victory-gpu` suite, with `round N, page P: X is not after X` from its submission thread. It is another test's doing, not port 7's. **Cause.** `ask_once` ends whatever asking stands, as it should with the runtime's one submission thread. The tests that play the submission each kept to that in their own way, or not at all: - `host::refresh_tests::submission`: a mutex of its own (`static ONE`) - `host::refresh_tests::unchanged_ranges_are_known`: a retry "if a submission of another test ended it" - the port-7 test's submission thread, and `watch::tests::the_rest_of_the_one_asking_has_a_number_of_its_own`: nothing So `refreshed_ranges_hold_title_memory`'s `ask_once` ended the port-7 test's asking mid-round, and that test then read a page's write with a number it had already seen. **Fix (test code only).** `watch::submission_in_test()` is one lock for all of them: - the host helper's mutex becomes this lock; - `unchanged_ranges_are_known`'s `look` and `the_rest_of_the_one_asking_has_a_number_of_its_own` hold it; - the port-7 test's submission thread holds it for each round. Its writers and askers still run alongside, which is what that test is about. I left `unchanged_ranges_are_known`'s retry loop in place to keep the change small. **Results** on `a-publier` at `4eb6cfd`, RTX 4070 SUPER, Ryzen 7 7800X3D, Windows 11 26200: | | before | after | |---|---|---| | `no_write_is_lost_with_port_7` + `refreshed_ranges_hold_title_memory` (`--exact`), 20 runs | 20/20 failed | 0/20 failed | | full `cargo test -p victory-gpu --lib`, 10 runs | 10/10 clean | 10/10 clean | In the full suite it only shows up now and then. It came up once in 4 full runs on this machine while I was testing something else. `cargo clippy -p victory-gpu --all-targets -- -D warnings` is clean. AI-assisted: yes (Claude Code)
ask_once ends whatever asking stands, as the runtime's one submission
thread may. Tests that play the submission each had their own way of
keeping to that: host::refresh_tests::submission a mutex of its own,
unchanged_ranges_are_known a retry "if a submission of another test
ended it", the port-7 test and the_rest_of_the_one_asking_has_a_number_of_its_own
nothing. Run together, one test's ask_once ended another's asking in the
middle, and the port-7 test read a page's write with the number it had
already seen ("round N, page P: X is not after X").

watch::submission_in_test is one lock for all of them: the host
helper's mutex becomes it, unchanged_ranges_are_known's look and
the_rest_of_the_one_asking_has_a_number_of_its_own hold it, and the
port-7 test's submission thread holds it for each round (its other
threads still ask and write meanwhile). Test code only.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 00:58:51 +00:00
Author
Owner

@⁠MamaLeVrai on GitHub · 2026-11-27 00:22 UTC · original

Tested on an RX 6950 XT 16 GB (RDNA 2), driver 32.0.21045.29003, Windows 11 build 26300, Rust 1.98.1, release, at 3ed1953: cargo test --release -p victory-gpu --lib 396 passed, 0 failed, 34 ignored.

AI-assisted (Claude Code); no game data.

**@⁠MamaLeVrai** on GitHub · 2026-11-27 00:22 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/382#issuecomment-7206405571) Tested on an RX 6950 XT 16 GB (RDNA 2), driver 32.0.21045.29003, Windows 11 build 26300, Rust 1.98.1, release, at `3ed1953`: `cargo test --release -p victory-gpu --lib` 396 passed, 0 failed, 34 ignored. AI-assisted (Claude Code); no game data.
Author
Owner

@⁠lvndrpup on GitHub · 2026-11-27 03:31 UTC · original · reviewed

Tested on an RTX 3060 Ti 8 GB, Ryzen 5 5600X, 32 GB, Windows 11 build 26300, Rust 1.98.1, debug. On 4eb6cfd, no_write_is_lost_with_port_7 beside refreshed_ranges_hold_title_memory failed in 10 of 10 runs; with 3ed1953, in 0 of 10. It merges cleanly with #446 and #450, and cargo test -p victory-gpu --lib -- watch:: host::refresh_tests failed in 0 of 30 runs with #450, and in 0 of 30 with #446 and #450.

One more caller: host::card_steps::tests::the_card_copies_what_is_recorded is not ignored and submits through host.execute (card_steps.rs:1202). HostQueue::submit then calls watch::ask_once (host.rs:5840) and ask_once_end (host.rs:5898) without submission_in_test(), so it can still end the asking of a test that holds the guard. A throwaway eprintln! in ask_once showed one call per run on this card. I have not seen a failure from it, since the window is one call a run. Taking the guard at the top of that test (let _one = crate::watch::submission_in_test();) would close it. submit never takes the guard, so this cannot deadlock. I tried that one line on top of this PR, #446 and #450, and cargo test -p victory-gpu --lib -- host::card_steps watch::port7_tests host::refresh_tests passed in 5 of 5 runs (17 tests each).

**@⁠lvndrpup** on GitHub · 2026-11-27 03:31 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/382#pullrequestreview-6083088317) · **reviewed** Tested on an RTX 3060 Ti 8 GB, Ryzen 5 5600X, 32 GB, Windows 11 build 26300, Rust 1.98.1, debug. On `4eb6cfd`, `no_write_is_lost_with_port_7` beside `refreshed_ranges_hold_title_memory` failed in 10 of 10 runs; with `3ed1953`, in 0 of 10. It merges cleanly with #446 and #450, and `cargo test -p victory-gpu --lib -- watch:: host::refresh_tests` failed in 0 of 30 runs with #450, and in 0 of 30 with #446 and #450. One more caller: `host::card_steps::tests::the_card_copies_what_is_recorded` is not ignored and submits through `host.execute` (`card_steps.rs:1202`). `HostQueue::submit` then calls `watch::ask_once` (`host.rs:5840`) and `ask_once_end` (`host.rs:5898`) without `submission_in_test()`, so it can still end the asking of a test that holds the guard. A throwaway `eprintln!` in `ask_once` showed one call per run on this card. I have not seen a failure from it, since the window is one call a run. Taking the guard at the top of that test (`let _one = crate::watch::submission_in_test();`) would close it. `submit` never takes the guard, so this cannot deadlock. I tried that one line on top of this PR, #446 and #450, and `cargo test -p victory-gpu --lib -- host::card_steps watch::port7_tests host::refresh_tests` passed in 5 of 5 runs (17 tests each).
Author
Owner

@⁠lvndrpup on GitHub · 2026-11-27 04:14 UTC · original

More data, from the whole victory-gpu lib test binary run directly with default test threads, which is where these failures show. RTX 3060 Ti 8 GB, Windows 11 build 26300, Rust 1.98.1, debug, 30 runs each, alternating:

tree failed runs failing tests
a-publier 4eb6cfd 5 of 30 host::refresh_tests::unchanged_ranges_are_known (3), watch::port7_tests::no_write_is_lost_with_port_7 (3), both in one run
4eb6cfd + this PR + #446 + #450 0 of 30

So with this PR, unchanged_ranges_are_known is covered too. #446 lists it as still failing now and then: its look closure is one of the places that now takes submission_in_test(). descriptor::host::tests::views_off_their_elements_get_a_copy_of_their_bytes, the other one #446 names, did not fail in any of these 60 runs.

**@⁠lvndrpup** on GitHub · 2026-11-27 04:14 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/382#issuecomment-7209643107) More data, from the whole `victory-gpu` lib test binary run directly with default test threads, which is where these failures show. RTX 3060 Ti 8 GB, Windows 11 build 26300, Rust 1.98.1, debug, 30 runs each, alternating: | tree | failed runs | failing tests | |---|---|---| | `a-publier` `4eb6cfd` | 5 of 30 | `host::refresh_tests::unchanged_ranges_are_known` (3), `watch::port7_tests::no_write_is_lost_with_port_7` (3), both in one run | | `4eb6cfd` + this PR + #446 + #450 | 0 of 30 | | So with this PR, `unchanged_ranges_are_known` is covered too. #446 lists it as still failing now and then: its `look` closure is one of the places that now takes `submission_in_test()`. `descriptor::host::tests::views_off_their_elements_get_a_copy_of_their_bytes`, the other one #446 names, did not fail in any of these 60 runs.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

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

Merge

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