RX 6950 XT (RDNA2), Windows 11: 5 xmem tests fail every run, clippy fails in victory-shader #2

Open
opened 2026-11-26 03:32:59 +00:00 by github-bot · 8 comments
Owner

@⁠MamaLeVrai on GitHub · 2026-11-25 11:04 UTC · original

I ran the checks on 4cbe9d7 on a different AMD card from the one in the README: RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, a GPU present. The title was not run.

1. Five xmem tests fail on every run (cargo test -p victory-hle --lib xmem: 10 runs of 10, and also with --test-threads=1):

  • modules::xmem::tests::a_run_keeps_the_placeholders_it_spans (xmem.rs:1578: left (0x1000b0000, 131072), right (0x1000d0000, 131072))
  • modules::xmem::tests::a_run_maps_across_two_placeholders (xmem.rs:1549: left 4096, right 8192)
  • modules::xmem::tests::a_run_maps_again_after_a_partial_unmap (xmem.rs:1524: left 4096, right 8192)
  • modules::xmem::tests::mapping_no_pages_changes_nothing (xmem.rs:1382: assert!(map_alias(at, a, 0)))
  • modules::xmem::tests::physical_pages_map_alias_and_unmap (xmem.rs:1330: left 4096, right 8192)

Two of them, physical_pages_map_alias_and_unmap and mapping_no_pages_changes_nothing, also exist on upstream main (940d32f) and on fxceless/victory-fork main (f85101b), and pass there on this machine; the other three (a_run_*) exist only in this fork. So in this fork's xmem.rs something changes how mapping behaves for the tests that the other trees pass. A region size of 4096 where 8192 is expected looks like pages not merged into one region, or a mapping made in two parts; I have not looked into the cause.

2. cargo clippy --workspace --all-targets --locked -D warnings fails in victory-shader, with and without --all-features: 10 errors (a hex literal grouping in native.rs:389, the never-used Module::int_value, three complex types, two get(&site).is_none(), two returns of a let binding, a useless u32::from). I am sending a PR for them. Cargo stops at the first crate that fails, so other crates may have more.

3. One victory-gpu test failed once in 7 runs: query::tests::occlusion_queries_around_draws_not_run_stay_visible. Not reproduced since; I note it only as seen.

The numbers are for one machine. No game data.

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

**@⁠MamaLeVrai** on GitHub · 2026-11-25 11:04 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/issues/2) I ran the checks on `4cbe9d7` on a different AMD card from the one in the README: **RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1**, a GPU present. The title was not run. **1. Five `xmem` tests fail on every run** (`cargo test -p victory-hle --lib xmem`: 10 runs of 10, and also with `--test-threads=1`): - `modules::xmem::tests::a_run_keeps_the_placeholders_it_spans` (`xmem.rs:1578`: left `(0x1000b0000, 131072)`, right `(0x1000d0000, 131072)`) - `modules::xmem::tests::a_run_maps_across_two_placeholders` (`xmem.rs:1549`: left 4096, right 8192) - `modules::xmem::tests::a_run_maps_again_after_a_partial_unmap` (`xmem.rs:1524`: left 4096, right 8192) - `modules::xmem::tests::mapping_no_pages_changes_nothing` (`xmem.rs:1382`: `assert!(map_alias(at, a, 0))`) - `modules::xmem::tests::physical_pages_map_alias_and_unmap` (`xmem.rs:1330`: left 4096, right 8192) Two of them, `physical_pages_map_alias_and_unmap` and `mapping_no_pages_changes_nothing`, also exist on upstream `main` (`940d32f`) and on `fxceless/victory-fork` `main` (`f85101b`), and pass there on this machine; the other three (`a_run_*`) exist only in this fork. So in this fork's `xmem.rs` something changes how mapping behaves for the tests that the other trees pass. A region size of 4096 where 8192 is expected looks like pages not merged into one region, or a mapping made in two parts; I have not looked into the cause. **2. `cargo clippy --workspace --all-targets --locked -D warnings` fails** in `victory-shader`, with and without `--all-features`: 10 errors (a hex literal grouping in `native.rs:389`, the never-used `Module::int_value`, three complex types, two `get(&site).is_none()`, two returns of a `let` binding, a useless `u32::from`). I am sending a PR for them. Cargo stops at the first crate that fails, so other crates may have more. **3. One `victory-gpu` test failed once in 7 runs**: `query::tests::occlusion_queries_around_draws_not_run_stay_visible`. Not reproduced since; I note it only as seen. The numbers are for one machine. No game data. AI-assisted (Claude Code); no game data.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:32:59 +00:00
Author
Owner

@⁠MamaLeVrai on GitHub · 2026-11-25 11:09 UTC · original

Another result on the same machine (RX 6950 XT, 4cbe9d7, unmodified): cargo test -p victory-shader --lib has two failures every time (3 runs, each alone and in the whole library):

  • emit::valu_tests::scalar_counted_in_a_divergent_loop_read_after_it (valu_tests.rs:1504): expects all 64 lanes to count 64 iterations; got 32 for lanes 0 to 31 and 64 for lanes 32 to 63.
  • emit::valu_tests::scalar_counted_in_nested_divergent_loops (valu_tests.rs:1591): the inner count is 8 for lanes 0 to 31 and 16 for the next lanes (the beginning of the list; I did not read the whole line).

Both tests exist only in this fork (not in upstream main or in fxceless/victory-fork). The split at lane 32 suggests the second half of a 64-lane program counts what both halves did, on a host whose waves are 32 lanes wide here. I have not looked at the code, and I do not know the wave width your RX 9070 XT runs these programs at, so this may well pass there.

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

**@⁠MamaLeVrai** on GitHub · 2026-11-25 11:09 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/issues/2#issuecomment-7160664896) Another result on the same machine (RX 6950 XT, `4cbe9d7`, unmodified): `cargo test -p victory-shader --lib` has **two failures** every time (3 runs, each alone and in the whole library): - `emit::valu_tests::scalar_counted_in_a_divergent_loop_read_after_it` (`valu_tests.rs:1504`): expects all 64 lanes to count 64 iterations; got 32 for lanes 0 to 31 and 64 for lanes 32 to 63. - `emit::valu_tests::scalar_counted_in_nested_divergent_loops` (`valu_tests.rs:1591`): the inner count is 8 for lanes 0 to 31 and 16 for the next lanes (the beginning of the list; I did not read the whole line). Both tests exist only in this fork (not in upstream `main` or in `fxceless/victory-fork`). The split at lane 32 suggests the second half of a 64-lane program counts what both halves did, on a host whose waves are 32 lanes wide here. I have not looked at the code, and I do not know the wave width your RX 9070 XT runs these programs at, so this may well pass there. AI-assisted (Claude Code); no game data.
Author
Owner

@⁠MamaLeVrai on GitHub · 2026-11-25 11:11 UTC · original

I found the cause of the five xmem failures, and checked it.

XMemMapPhysicalPages now tries map_whole first (added in fa07481, "uncap frame pacing by default"): when the reservation is as long as the section of the pages mapped into it (len == first.section.1) and no view overlaps it, one view shows the whole reservation. Those tests reserve exactly 3 pages and map pages from a 3-page allocation, so they take that path. Then unmapping the middle page (XMemMapPhysicalPages(at(a, 1), 1, null)) leaves it committed: xmem.rs:1330 expects MEM_RESERVE (8192) and gets MEM_COMMIT (4096), which is the "left 4096, right 8192" of the failures.

Checked: with a local one-line switch that makes map_whole return false, all 14 xmem tests pass (they fail 5 of 14 with it). The behaviour does not depend on the card or on the Windows build.

So it is a conflict between the new whole-reservation view and the per-page behaviour the old tests check, not a bug I can call in the new design. Two ways out, yours to pick:

  • keep the design and let the tests take the per-page path: allocate a section longer than the reservation in those tests (so len != section size), and add a test for the whole path;
  • or limit map_whole to reservations above a size (your debug line already looks at pages.len() > 64), if tiny reservations should stay per page.

I did not change xmem.rs: the first needs the tests rewritten around your intent, and the second changes what the title gets, which I cannot check without the game.

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

**@⁠MamaLeVrai** on GitHub · 2026-11-25 11:11 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/issues/2#issuecomment-7160705230) I found the cause of the five `xmem` failures, and checked it. `XMemMapPhysicalPages` now tries `map_whole` first (added in `fa07481`, "uncap frame pacing by default"): when the reservation is as long as the section of the pages mapped into it (`len == first.section.1`) and no view overlaps it, one view shows the whole reservation. Those tests reserve exactly 3 pages and map pages from a 3-page allocation, so they take that path. Then unmapping the middle page (`XMemMapPhysicalPages(at(a, 1), 1, null)`) leaves it committed: `xmem.rs:1330` expects `MEM_RESERVE` (8192) and gets `MEM_COMMIT` (4096), which is the "left 4096, right 8192" of the failures. **Checked:** with a local one-line switch that makes `map_whole` return false, all 14 `xmem` tests pass (they fail 5 of 14 with it). The behaviour does not depend on the card or on the Windows build. So it is a conflict between the new whole-reservation view and the per-page behaviour the old tests check, not a bug I can call in the new design. Two ways out, yours to pick: - keep the design and let the tests take the per-page path: allocate a section longer than the reservation in those tests (so `len != section size`), and add a test for the whole path; - or limit `map_whole` to reservations above a size (your debug line already looks at `pages.len() > 64`), if tiny reservations should stay per page. I did not change `xmem.rs`: the first needs the tests rewritten around your intent, and the second changes what the title gets, which I cannot check without the game. AI-assisted (Claude Code); no game data.
Author
Owner

@⁠MamaLeVrai on GitHub · 2026-11-25 11:18 UTC · original

The two valu_tests failures (scalar_counted_in_a_divergent_loop_read_after_it, scalar_counted_in_nested_divergent_loops) on the RX 6950 XT: I found why, and checked it with a local change.

Why. In emit/lower.rs (around line 1224) the translated compute program only gets a WaveSize attribute when split (a console wave64 on a host that cannot run 64 lanes) or when console_lanes || one_wave && s.lds_dwords > 0. These two test programs are wave64 programs whose only dependence on the wave width is a scalar counter in a divergent loop (the console runs the loop until the 64th lane leaves, so every lane reads 64). They get no WaveSize, and this card's driver then picks 32-lane waves for compute: lanes 0 to 31 count 32, lanes 32 to 63 count 64, which is exactly the output. On your RX 9070 XT the default may be 64-lane waves, which would explain why they pass for you; that part is a guess.

Checked. With a local change that also sets s.wave_size = Some(wave) when x.native.wave64 && x.target.runs(64), on this machine: both tests pass, and the whole cargo test -p victory-shader --lib goes from 264 passed, 2 failed to 266 passed, 0 failed.

What I did not check. That change asks for WaveSize(64) for every wave64 program on a host that can run it, which is broader than these two tests need. I do not know what it does to compile times or to the AMD compiler crashes you skip (it may change which pipelines crash), or to pipelines in the title; I did not run the title. A narrower rule (set the attribute when the program has a counted loop like these, or a read of a scalar written under divergence) is the safer shape if you want one. I did not open a PR for it for that reason.

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

**@⁠MamaLeVrai** on GitHub · 2026-11-25 11:18 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/issues/2#issuecomment-7160865607) The two `valu_tests` failures (`scalar_counted_in_a_divergent_loop_read_after_it`, `scalar_counted_in_nested_divergent_loops`) on the RX 6950 XT: I found why, and checked it with a local change. **Why.** In `emit/lower.rs` (around line 1224) the translated compute program only gets a `WaveSize` attribute when `split` (a console wave64 on a host that cannot run 64 lanes) or when `console_lanes || one_wave && s.lds_dwords > 0`. These two test programs are wave64 programs whose only dependence on the wave width is a scalar counter in a divergent loop (the console runs the loop until the 64th lane leaves, so every lane reads 64). They get no `WaveSize`, and this card's driver then picks 32-lane waves for compute: lanes 0 to 31 count 32, lanes 32 to 63 count 64, which is exactly the output. On your RX 9070 XT the default may be 64-lane waves, which would explain why they pass for you; that part is a guess. **Checked.** With a local change that also sets `s.wave_size = Some(wave)` when `x.native.wave64 && x.target.runs(64)`, on this machine: both tests pass, and the whole `cargo test -p victory-shader --lib` goes from 264 passed, 2 failed to 266 passed, 0 failed. **What I did not check.** That change asks for `WaveSize(64)` for every wave64 program on a host that can run it, which is broader than these two tests need. I do not know what it does to compile times or to the AMD compiler crashes you skip (it may change which pipelines crash), or to pipelines in the title; I did not run the title. A narrower rule (set the attribute when the program has a counted loop like these, or a read of a scalar written under divergence) is the safer shape if you want one. I did not open a PR for it for that reason. AI-assisted (Claude Code); no game data.
Author
Owner

@⁠kanav-khanna on GitHub · 2026-11-25 12:51 UTC · original · edited 2026-11-25 12:59 UTC

Reproduced on a second AMD machine: Ryzen 7 5800X, RX 6750 XT, 24 GB RAM, Windows 11,

The same five xmem tests fail every run, with default threads and with --test-threads=1. My line numbers are 1334, 1553 and 1582 (so I'm on a slightly different commit than the report). The 1582 failure shows the same (0x…, 131072) pair.

Reading xmem.rs, the 4096/8192 values look like memory state flags rather than sizes: 4096 = MEM_COMMIT (0x1000), 8192 = MEM_RESERVE (0x2000). At 1334 and 1553 the test unmaps and expects query(..).host.State == MEM_RESERVE, but Windows reports MEM_COMMIT. At 1582, the left AllocationBase is the start of the whole reservation instead of at(2), so the split placeholders were coalesced after the unmap. That might point at how unmapped placeholders behave on this Windows build.

**@⁠kanav-khanna** on GitHub · 2026-11-25 12:51 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/issues/2#issuecomment-7162951855) · edited 2026-11-25 12:59 UTC Reproduced on a second AMD machine: Ryzen 7 5800X, RX 6750 XT, 24 GB RAM, Windows 11, The same five xmem tests fail every run, with default threads and with --test-threads=1. My line numbers are 1334, 1553 and 1582 (so I'm on a slightly different commit than the report). The 1582 failure shows the same (0x…, 131072) pair. Reading xmem.rs, the 4096/8192 values look like memory state flags rather than sizes: 4096 = MEM_COMMIT (0x1000), 8192 = MEM_RESERVE (0x2000). At 1334 and 1553 the test unmaps and expects query(..).host.State == MEM_RESERVE, but Windows reports MEM_COMMIT. At 1582, the left AllocationBase is the start of the whole reservation instead of at(2), so the split placeholders were coalesced after the unmap. That might point at how unmapped placeholders behave on this Windows build.
Author
Owner

@⁠alexdeliu on GitHub · 2026-11-25 14:44 UTC · original

The narrower rule for the two valu_tests wave-size failures is in #110, building on @⁠MamaLeVrai's diagnosis above.

The rule. leave_loops (emit/lower.rs) takes a divergent loop's scalars with a wave maximum over the host's wave. That matches the console only in a 64-lane wave. #110 asks for WaveSize(64) at that point only when all of these hold:

  • the program is wave64;
  • the host runs 64 lanes;
  • no wave size is set yet;
  • the loop has an exit branch that is not over uniform values only.

Across the unit tests, that is 2 programs out of the 85 wave64 compute programs lowered for a 64-lane host (the two failing tests). The broad rule would set it for 10.

Checked on one machine with both generations, cargo test -p victory-shader --lib -- --test-threads=1:

71652a2 #110
Ryzen 7 7700 iGPU (gfx1036, RDNA2) 264 passed, 2 failed 267 passed, 0 failed
RX 9070 (RDNA4) 266 passed, 0 failed 267 passed, 0 failed
WARP 252 passed, 14 failed 253 passed, the same 14 failed

The extra test checks the requested wave range without a GPU.

@⁠MamaLeVrai, @⁠kanav-khanna: if you have a few minutes, a run of #110's branch on your RX 6950 XT / RX 6750 XT would show whether it holds on discrete RDNA2 too. Our RDNA2 is an iGPU.

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

**@⁠alexdeliu** on GitHub · 2026-11-25 14:44 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/issues/2#issuecomment-7165750287) The narrower rule for the two `valu_tests` wave-size failures is in #110, building on @⁠MamaLeVrai's diagnosis above. **The rule.** `leave_loops` (`emit/lower.rs`) takes a divergent loop's scalars with a wave maximum over the host's wave. That matches the console only in a 64-lane wave. #110 asks for `WaveSize(64)` at that point only when all of these hold: - the program is wave64; - the host runs 64 lanes; - no wave size is set yet; - the loop has an exit branch that is not over uniform values only. Across the unit tests, that is 2 programs out of the 85 wave64 compute programs lowered for a 64-lane host (the two failing tests). The broad rule would set it for 10. **Checked on one machine with both generations**, `cargo test -p victory-shader --lib -- --test-threads=1`: | | `71652a2` | #110 | |---|---|---| | Ryzen 7 7700 iGPU (gfx1036, RDNA2) | 264 passed, 2 failed | 267 passed, 0 failed | | RX 9070 (RDNA4) | 266 passed, 0 failed | 267 passed, 0 failed | | WARP | 252 passed, 14 failed | 253 passed, the same 14 failed | The extra test checks the requested wave range without a GPU. @⁠MamaLeVrai, @⁠kanav-khanna: if you have a few minutes, a run of #110's branch on your RX 6950 XT / RX 6750 XT would show whether it holds on discrete RDNA2 too. Our RDNA2 is an iGPU. AI-assisted (Claude Code); no game data.
Author
Owner

@⁠alexdeliu on GitHub · 2026-11-25 15:05 UTC · original

A related note: two of the AMD compiler bugs this fork meets are now reported to AMD, with DXIL repros made from this fork's own output: AMD Developer Community.

  • the shared-dword i64 compare (#81's workaround);
  • f64 add/mul of doubles sharing a dword (v_add_f64 v[0:1], v[1:2], v[2:3] gives 1.5 + x = 3.0). In the shape this fork emits it is wrong on the RX 9070, and on RDNA2 too when makeDouble takes the dwords directly.

Both were re-checked today. Vectors: rdna2-conformance.

**@⁠alexdeliu** on GitHub · 2026-11-25 15:05 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/issues/2#issuecomment-7166275322) A related note: two of the AMD compiler bugs this fork meets are now reported to AMD, with DXIL repros made from this fork's own output: [AMD Developer Community](https://devcommunity.amd.com/t/d3d12-shader-compiler-5-miscompiles-of-validator-passing-dxil-on-rx-9070-rdna4-and-rdna2-with-repro-vectors/1518). - the shared-dword i64 compare (#81's workaround); - f64 add/mul of doubles sharing a dword (`v_add_f64 v[0:1], v[1:2], v[2:3]` gives `1.5 + x` = 3.0). In the shape this fork emits it is wrong on the RX 9070, and on RDNA2 too when `makeDouble` takes the dwords directly. Both were re-checked today. Vectors: [rdna2-conformance](https://github.com/alexdeliu/rdna2-conformance).
Author
Owner

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

Status of the failures in this issue, on the same RX 6950 XT (release lib tests, main 4f62c2a):

  • The five xmem tests: #93 fixes them here (103 passed, 0 failed, in 3 runs out of 3). #99 is a related change I have not run.
  • The two valu_tests wave-size tests: #110, #204 and #92 each fix them here (#110: 278 passed, 0 failed; #204: 277 passed, 0 failed). #204 conflicts with #144 in emit/mod.rs. #110 merges cleanly with #144.
  • Also failing on every release run here: list::tests::lists_are_cut_at_waits_that_follow_work, from undefined behaviour in the test itself. #210 fixes it.
  • The xtask asset-policy test: it fails because emit/lower.rs is now over the 512 KiB limit. #72 and #84 split that file.

With #93, #110 and #210 in, victory-gpu, victory-shader and victory-hle would pass here, apart from occasional flakes that already have PRs (#102 with #112/#115, and #116 with #132).

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

**@⁠MamaLeVrai** on GitHub · 2026-11-26 00:26 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/issues/2#issuecomment-7178764731) Status of the failures in this issue, on the same RX 6950 XT (release lib tests, `main` `4f62c2a`): - **The five `xmem` tests:** #93 fixes them here (103 passed, 0 failed, in 3 runs out of 3). #99 is a related change I have not run. - **The two `valu_tests` wave-size tests:** #110, #204 and #92 each fix them here (#110: 278 passed, 0 failed; #204: 277 passed, 0 failed). #204 conflicts with #144 in `emit/mod.rs`. #110 merges cleanly with #144. - **Also failing on every release run here:** `list::tests::lists_are_cut_at_waits_that_follow_work`, from undefined behaviour in the test itself. #210 fixes it. - **The `xtask` asset-policy test:** it fails because `emit/lower.rs` is now over the 512 KiB limit. #72 and #84 split that file. With #93, #110 and #210 in, `victory-gpu`, `victory-shader` and `victory-hle` would pass here, apart from occasional flakes that already have PRs (#102 with #112/#115, and #116 with #132). AI-assisted (Claude Code); no game data.
Author
Owner

@⁠blpeters67 on GitHub · 2026-11-27 00:36 UTC · original

Same five xmem failures as #8. Status there: #8

In short: PR #14 fixes them on main. On a-publier (default branch), map_whole was removed, and CI #385 at 4eb6cfd passes on Windows, including the victory-shader clippy run with -D warnings.

**@⁠blpeters67** on GitHub · 2026-11-27 00:36 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/issues/2#issuecomment-7206601305) Same five xmem failures as #8. Status there: https://git.gtahub.st/github/Belobug--VIctory-Belobug-AMD/issues/8 In short: PR #14 fixes them on main. On a-publier (default branch), map_whole was removed, and CI #385 at 4eb6cfd passes on Windows, including the victory-shader clippy run with -D warnings.
This discussion has been locked. Commenting is limited to contributors.
No description provided.