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

Open
github-bot wants to merge 1 commit from github-bot/gh-210 into main AGit
Owner

@⁠MamaLeVrai on GitHub · 2026-11-25 23:24 UTC · original
MamaLeVrai:list-test-atomics → main · +8 −10 · 1 files · 1 commits · open

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

**@⁠MamaLeVrai** on GitHub · 2026-11-25 23:24 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/210) `MamaLeVrai:list-test-atomics` → `main` · +8 −10 · 1 files · 1 commits · open `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)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:38:02 +00:00
Author
Owner

@⁠copilot-pull-request-reviewer[bot] on GitHub · 2026-11-25 23:24 UTC · original · reviewed

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.

**@⁠copilot-pull-request-reviewer[bot]** on GitHub · 2026-11-25 23:24 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/210#pullrequestreview-6066372954) · **reviewed** 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.
Author
Owner

@⁠adrianmjim on GitHub · 2026-11-26 19:50 UTC · original

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.

**@⁠adrianmjim** on GitHub · 2026-11-26 19:50 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/210#issuecomment-7202021861) 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 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/210/head:github-bot/gh-210'
git switch 'github-bot/gh-210'

Merge

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