list test: the memory its waits read is atomics (it failed in every release run) #210

Open
MamaLeVrai wants to merge 1 commit from upstream-pr/210 into main
MamaLeVrai commented 2026-11-25 23:24:06 +00:00 (Migrated from github.com)

Imported from Belobug/VIctory-Belobug-AMD. Originally posted by MamaLeVrai on 2026-11-25T23:24:06Z.


list::tests::lists_are_cut_at_waits_that_follow_work fails in every release run on main (4f62c2a) on my machine: 150 of 150 runs of the whole victory_gpu test binary (cargo test --release -p victory-gpu --lib), and every run of the test alone. It was the only test that failed in those runs. The test needs a host GPU (it returns early without one), so it runs here.

panicked at crates\victory-gpu\src\list.rs:2100:13:
assertion failed: parts[0].unmet().is_empty() && parts[1].unmet().len() == 1

Why. With a print before that line: the first of the two loop rounds passes (unmet 0 and 1), and the second fails with unmet 0 and 0. The second wait, at memory[1], then reads as met: it still sees the 4 the first round wrote. memory is a plain let memory = [0u64; 2], not mut. The test writes it through raw pointers made from shared references (&raw const memory[i] cast to *mut). That is undefined behaviour, and in a release build the zeroing at the start of the second round does not reach what the wait reads.

The change. Only the test changes: memory is two AtomicU64, and the test writes and reads them with store and load. The addresses it gives the lists come from AtomicU64::as_ptr, which may be written through.

Checks (RX 6950 XT, Windows 11 build 26300, Rust 1.98.1, release):

main this PR
the test alone fails every run passes 30 of 30
whole victory_gpu binary, 150 runs 150 failing runs, all on this test 5 failing runs, none on this test

The 5 runs that still fail are other tests that fail now and then, or the binary dying without a result line: watch::tests::written_pages_are_reported_to_every_asker once, query::tests::occlusion_queries_around_draws_not_run_stay_visible once, and three runs without a failing test named. I have not looked at those yet. I did not run a debug build.

harness machine: rx6950xt-w11 | AMD Radeon RX 6950 XT (RDNA2), driver 32.0.21045.29003 | 32 GB RAM | Windows 11 build 26300

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

🤖 Generated with Claude Code

<!-- greyfinch-sync:Belobug/VIctory-Belobug-AMD:issue:5500929289 --> Imported from [Belobug/VIctory-Belobug-AMD](https://github.com/Belobug/VIctory-Belobug-AMD/pull/210). Originally posted by [MamaLeVrai](https://github.com/MamaLeVrai) on 2026-11-25T23:24:06Z. --- `list::tests::lists_are_cut_at_waits_that_follow_work` fails in every release run on `main` (`4f62c2a`) on my machine: 150 of 150 runs of the whole `victory_gpu` test binary (`cargo test --release -p victory-gpu --lib`), and every run of the test alone. It was the only test that failed in those runs. The test needs a host GPU (it returns early without one), so it runs here. ``` panicked at crates\victory-gpu\src\list.rs:2100:13: assertion failed: parts[0].unmet().is_empty() && parts[1].unmet().len() == 1 ``` **Why.** With a print before that line: the first of the two loop rounds passes (`unmet` 0 and 1), and the second fails with `unmet` 0 and 0. The second wait, at `memory[1]`, then reads as met: it still sees the 4 the first round wrote. `memory` is a plain `let memory = [0u64; 2]`, not `mut`. The test writes it through raw pointers made from shared references (`&raw const memory[i]` cast to `*mut`). That is undefined behaviour, and in a release build the zeroing at the start of the second round does not reach what the wait reads. **The change.** Only the test changes: `memory` is two `AtomicU64`, and the test writes and reads them with `store` and `load`. The addresses it gives the lists come from `AtomicU64::as_ptr`, which may be written through. **Checks** (RX 6950 XT, Windows 11 build 26300, Rust 1.98.1, release): | | `main` | this PR | |---|---|---| | the test alone | fails every run | passes 30 of 30 | | whole `victory_gpu` binary, 150 runs | 150 failing runs, all on this test | 5 failing runs, none on this test | The 5 runs that still fail are other tests that fail now and then, or the binary dying without a result line: `watch::tests::written_pages_are_reported_to_every_asker` once, `query::tests::occlusion_queries_around_draws_not_run_stay_visible` once, and three runs without a failing test named. I have not looked at those yet. I did not run a debug build. harness machine: rx6950xt-w11 | AMD Radeon RX 6950 XT (RDNA2), driver 32.0.21045.29003 | 32 GB RAM | Windows 11 build 26300 AI-assisted (Claude Code); no game data. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
copilot-pull-request-reviewer[bot] commented 2026-11-25 23:24:18 +00:00 (Migrated from github.com)

Imported from Belobug/VIctory-Belobug-AMD. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-25T23:24:18Z.

Review: COMMENTED


Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

<!-- greyfinch-sync:Belobug/VIctory-Belobug-AMD:review:6066372954 --> Imported from [Belobug/VIctory-Belobug-AMD](https://github.com/Belobug/VIctory-Belobug-AMD/pull/210#pullrequestreview-6066372954). Originally posted by [copilot-pull-request-reviewer[bot]](https://github.com/apps/copilot-pull-request-reviewer) on 2026-11-25T23:24:18Z. **Review:** COMMENTED --- Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
adrianmjim commented 2026-11-26 19:50:48 +00:00 (Migrated from github.com)

Imported from Belobug/VIctory-Belobug-AMD. Originally posted by adrianmjim on 2026-11-26T19:50:48Z.


Tested natively on a different GPU generation, with a debug build as well.

Setup: RX 7900 XT (RDNA3), driver 32.0.32029.2010, Windows 11 build 26300, Rust 1.98.1, default D3D12 hardware adapter. Head 11bc2d4, base 4f62c2a. I ran base and PR binaries interleaved, in release and debug. Other heavy jobs were running on the machine at the same time.

list::tests::lists_are_cut_at_waits_that_follow_work alone, 30 runs each:

  • base, release: fails 30/30, with the same assertion at list.rs:2100
  • base, debug: passes 30/30
  • PR, release: passes 30/30
  • PR, debug: passes 30/30

Whole victory_gpu lib binary, 50 runs each:

  • base, release: this test fails in 50/50 runs. In one of them the binary then exited with code 127 and printed no result line.
  • base, debug: this test fails in 0/50
  • PR, release and debug: this test fails in 0/50

So on this machine the failure only happens in release, and RDNA3 shows the same result as RDNA2. A debug build of base passes, which fits the UB explanation in the PR.

Runs that failed on some other test: base release 15/50, PR release 11/50, base debug 4/50, PR debug 9/50. The tests involved:

  • on both base and PR: four watch::tests, pipeline::library::tests::concurrent_atomic_writes_publish_one_complete_file, queue::tests::present_runs_after_a_queues_wait
  • on base only: query::tests::host_queries_count_what_draws_did (2), frame::tests::waits_end_on_ticks_and_count_frames (1)
  • on PR only: resource::tests::copy_texture_region_reads_back_into_title_buffer (1, release). This PR does not touch that code. Run alone, it passed 10/10 on both base and PR release.

Not tested: WARP, Linux/Wine.

<!-- greyfinch-sync:Belobug/VIctory-Belobug-AMD:comment:7202021861 --> Imported from [Belobug/VIctory-Belobug-AMD](https://github.com/Belobug/VIctory-Belobug-AMD/pull/210#issuecomment-7202021861). Originally posted by [adrianmjim](https://github.com/adrianmjim) on 2026-11-26T19:50:48Z. --- Tested natively on a different GPU generation, with a debug build as well. Setup: RX 7900 XT (RDNA3), driver 32.0.32029.2010, Windows 11 build 26300, Rust 1.98.1, default D3D12 hardware adapter. Head 11bc2d4, base 4f62c2a. I ran base and PR binaries interleaved, in release and debug. Other heavy jobs were running on the machine at the same time. `list::tests::lists_are_cut_at_waits_that_follow_work` alone, 30 runs each: - base, release: fails 30/30, with the same assertion at list.rs:2100 - base, debug: passes 30/30 - PR, release: passes 30/30 - PR, debug: passes 30/30 Whole `victory_gpu` lib binary, 50 runs each: - base, release: this test fails in 50/50 runs. In one of them the binary then exited with code 127 and printed no result line. - base, debug: this test fails in 0/50 - PR, release and debug: this test fails in 0/50 So on this machine the failure only happens in release, and RDNA3 shows the same result as RDNA2. A debug build of base passes, which fits the UB explanation in the PR. Runs that failed on some other test: base release 15/50, PR release 11/50, base debug 4/50, PR debug 9/50. The tests involved: - on both base and PR: four `watch::tests`, `pipeline::library::tests::concurrent_atomic_writes_publish_one_complete_file`, `queue::tests::present_runs_after_a_queues_wait` - on base only: `query::tests::host_queries_count_what_draws_did` (2), `frame::tests::waits_end_on_ticks_and_count_frames` (1) - on PR only: `resource::tests::copy_texture_region_reads_back_into_title_buffer` (1, release). This PR does not touch that code. Run alone, it passed 10/10 on both base and PR release. Not tested: WARP, Linux/Wine.
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/210:upstream-pr/210'
git switch 'upstream-pr/210'

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