Test title_memory_is_read_and_written_at_computed_addresses fails intermittently in a full workspace run #1882

Open
opened 2026-11-26 04:47:32 +00:00 by github-bot · 4 comments
Owner

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

emit::memory_tests::title_memory_is_read_and_written_at_computed_addresses (added in 27c3dc9d, "title memory at raw addresses through a page table") fails now and then in a full cargo test --workspace --locked, and passes when run alone.

What I saw (Windows 11, RX 6950 XT, Rust 1.98.1, main merged into trees of my own bundles, so the code under test is main's): 3 failures in about 10 full runs, on three different trees; main itself passed its 2 runs, and 3 later runs of one of the trees were clean. Run alone with cargo test -p victory-shader --lib memory_tests, it passed 3 of 3.

The failure (crates/victory-shader/src/emit/memory_tests.rs:303):

assertion `left == right` failed: warp: pages
  left: [1, 16, 17, 18, ...]   (several thousand page numbers, from 1 up to 8187)
 right: [1360, 5200, 5201]

The warp run reports a long list of pages where the test expects three. The test names the software adapter, so I suspect it shares something with the other GPU tests of the crate that run at the same time (the waterfall and VALU tests are serialised with each other for that reason); I have not found which. Nothing here depends on a game file.

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

**@⁠MamaLeVrai** on GitHub · 2026-11-25 00:03 UTC · [original](https://github.com/Marvisak/VIctory/issues/1882) `emit::memory_tests::title_memory_is_read_and_written_at_computed_addresses` (added in `27c3dc9d`, "title memory at raw addresses through a page table") fails now and then in a full `cargo test --workspace --locked`, and passes when run alone. **What I saw** (Windows 11, RX 6950 XT, Rust 1.98.1, `main` merged into trees of my own bundles, so the code under test is `main`'s): 3 failures in about 10 full runs, on three different trees; `main` itself passed its 2 runs, and 3 later runs of one of the trees were clean. Run alone with `cargo test -p victory-shader --lib memory_tests`, it passed 3 of 3. **The failure** (`crates/victory-shader/src/emit/memory_tests.rs:303`): ``` assertion `left == right` failed: warp: pages left: [1, 16, 17, 18, ...] (several thousand page numbers, from 1 up to 8187) right: [1360, 5200, 5201] ``` The `warp` run reports a long list of pages where the test expects three. The test names the software adapter, so I suspect it shares something with the other GPU tests of the crate that run at the same time (the waterfall and VALU tests are serialised with each other for that reason); I have not found which. Nothing here depends on a game file. AI-assisted (Claude Code); no game data.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:47:32 +00:00
Author
Owner

@⁠fiestorra on GitHub · 2026-11-25 00:15 UTC · original

Cause found: diff_tests was the only GPU test module that made a Host without taking the shared lock

The crate already has the lock, for exactly this: emit::valu_tests::ONE_AT_A_TIME, whose comment says WARP can end the test process with an access violation and "other GPU test modules take this lock too". I audited all nine modules that make a Host:

module makes a host takes the lock
bvh_tests yes yes
diff_tests yes (3 tests) no
flow_tests yes yes
memory_tests yes yes
semantics_tests yes yes
stride_tests yes yes
synthetic_tests yes yes
valu_tests yes yes
waterfall_tests yes yes

diff_tests' three host-making tests — translated_shaders_draw_as_pc_ones, translated_mesh_shaders_draw_as_pc_ones, float_semantics_are_the_consoles — were dispatching beside whatever else the test threads were running, which is the shape of the failure you saw: memory_tests' title-memory test reading back thousands of pages set instead of the three it wrote, and passing when run alone.

The fix is that those three take the lock too, through one helper, and the lock's own comment now states the rule that nothing wrote down: a GPU test module that makes a Host without taking it is how the failure comes back.

What I can and cannot claim:

  • I cannot reproduce your failure here — three GPU suites skip on this machine (no dxc/console compiler for diff_tests, no SM 6.6 device for parts of it), so on my runs the unlocking tests never dispatched and the race never happened. cargo test --workspace --locked was green in two consecutive runs before and after.
  • What I can show is the audit: nine modules, one missing the lock, and it is the one with three dispatches. That is a mechanism, not a coincidence, and it matches your own reading of the failure.
  • If it still happens with this in place, the next suspect is not another module but the per-dispatch readback path in emit/host.rs, and the way to catch it would be to have the test keep the readback buffer it made rather than a fresh one.

Verification: cargo test -p victory-shader --locked --lib (209 passed, 2 ignored); cargo test --workspace --locked twice, 23 suites ok, with only the pre-existing victory-hle::modules::display::tests::sdr_and_display_deferrals failing in this headless session (it is what #1630 fixes); clippy --workspace --all-targets with and without --all-features clean under -D warnings; rustfmt --check clean on the two files touched.

Pull request: #1892

No game data is involved: test names and counts only.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-25 00:15 UTC · [original](https://github.com/Marvisak/VIctory/issues/1882#issuecomment-7148310575) **Cause found: `diff_tests` was the only GPU test module that made a `Host` without taking the shared lock** The crate already has the lock, for exactly this: `emit::valu_tests::ONE_AT_A_TIME`, whose comment says WARP can end the test process with an access violation and "other GPU test modules take this lock too". I audited all nine modules that make a `Host`: | module | makes a host | takes the lock | |---|---|---| | `bvh_tests` | yes | yes | | **`diff_tests`** | **yes (3 tests)** | **no** | | `flow_tests` | yes | yes | | `memory_tests` | yes | yes | | `semantics_tests` | yes | yes | | `stride_tests` | yes | yes | | `synthetic_tests` | yes | yes | | `valu_tests` | yes | yes | | `waterfall_tests` | yes | yes | `diff_tests`' three host-making tests — `translated_shaders_draw_as_pc_ones`, `translated_mesh_shaders_draw_as_pc_ones`, `float_semantics_are_the_consoles` — were dispatching beside whatever else the test threads were running, which is the shape of the failure you saw: `memory_tests`' title-memory test reading back thousands of pages set instead of the three it wrote, and passing when run alone. The fix is that those three take the lock too, through one helper, and the lock's own comment now states the rule that nothing wrote down: **a GPU test module that makes a `Host` without taking it is how the failure comes back**. What I can and cannot claim: - **I cannot reproduce your failure here** — three GPU suites skip on this machine (no `dxc`/console compiler for `diff_tests`, no SM 6.6 device for parts of it), so on my runs the unlocking tests never dispatched and the race never happened. `cargo test --workspace --locked` was green in two consecutive runs before and after. - **What I can show is the audit**: nine modules, one missing the lock, and it is the one with three dispatches. That is a mechanism, not a coincidence, and it matches your own reading of the failure. - If it still happens with this in place, the next suspect is not another module but the per-dispatch readback path in `emit/host.rs`, and the way to catch it would be to have the test keep the readback buffer it made rather than a fresh one. Verification: `cargo test -p victory-shader --locked --lib` (209 passed, 2 ignored); `cargo test --workspace --locked` twice, 23 suites ok, with only the pre-existing `victory-hle::modules::display::tests::sdr_and_display_deferrals` failing in this headless session (it is what #1630 fixes); `clippy --workspace --all-targets` with and without `--all-features` clean under `-D warnings`; `rustfmt --check` clean on the two files touched. Pull request: https://git.gtahub.st/github/Marvisak--VIctory/pulls/1892 No game data is involved: test names and counts only. Written with an AI assistant.
Author
Owner

@⁠dragoso on GitHub · 2026-11-25 00:30 UTC · original

Does not reproduce on main 70564ae on an RTX 5060 Ti: 0 failures in 6 full runs and 8 targeted runs. Two experiments also rule out WARP handing a new buffer stale memory.

Setup: Windows 11 Pro (build 26300), NVIDIA GeForce RTX 5060 Ti (DXGI adapter 0), driver 32.0.16.1742, Rust 1.98.1 MSVC. I used the victory-shader lib test binary with default parallel test threads.

  • 6 full runs: memory_tests::title_memory_is_read_and_written_at_computed_addresses passed every time, and no warp: pages failure appeared. Each run had the same 3 failures, the ones from #1835 (NVIDIA's 1,000,000 view cap). The runs took between 61 s and 446 s, so the scheduling varied a lot between them.
  • 8 targeted runs of memory_tests stride_tests bvh_tests flow_tests together: 0 failures of this test.
  • Is it stale memory? I wrote a temporary test, not committed, on the WARP host. It runs the same program 40 times. Before each clean dispatch, it dispatches with a large garbage buffer that is then freed: an upload-heap root SRV of up to 2 MB filled with 0xA5A5A5A5 in one variant, and a default-heap View::Memory of the same size in the other. The page bitmap (Root::Uav(256)) always came back with exactly the 3 expected bits. So on this machine, WARP's new committed buffers come back zeroed even right after large frees.

One lead. D3D12CreateDevice returns one WARP device per process, so every test that uses WARP shares it. All the GPU tests serialise on valu_tests::ONE_AT_A_TIME, through run, run_cases and check, except:

  • rect.rs::rectangles_get_their_fourth_corner, which draws on WARP with no lock;
  • the diff_tests (hardware unless VICTORY_WARP=1) and mod.rs::stub_pipeline_is_created (hardware only), which only matter with that variable set.

In a full run, that draw can overlap this test on the shared WARP device. I could not make that produce the failure here, so it is only a lead. Taking the lock in that test would be cheap if the failure comes back.

Since main passed both of your runs and the failures came from trees with your bundles merged in, one of the bundled PRs might be what writes into this test's memory. Root UAV writes are not bounds-checked, and WARP has no protection between resources. A bisect over the bundle should be quicker than catching it on main.

AI-assisted (Claude Code); run on our machine, no game data.

**@⁠dragoso** on GitHub · 2026-11-25 00:30 UTC · [original](https://github.com/Marvisak/VIctory/issues/1882#issuecomment-7148573127) **Does not reproduce on `main` `70564ae` on an RTX 5060 Ti: 0 failures in 6 full runs and 8 targeted runs.** Two experiments also rule out WARP handing a new buffer stale memory. **Setup:** Windows 11 Pro (build 26300), NVIDIA GeForce RTX 5060 Ti (DXGI adapter 0), driver 32.0.16.1742, Rust 1.98.1 MSVC. I used the `victory-shader` lib test binary with default parallel test threads. - **6 full runs:** `memory_tests::title_memory_is_read_and_written_at_computed_addresses` passed every time, and no `warp: pages` failure appeared. Each run had the same 3 failures, the ones from #1835 (NVIDIA's 1,000,000 view cap). The runs took between 61 s and 446 s, so the scheduling varied a lot between them. - **8 targeted runs** of `memory_tests stride_tests bvh_tests flow_tests` together: 0 failures of this test. - **Is it stale memory?** I wrote a temporary test, not committed, on the WARP host. It runs the same program 40 times. Before each clean dispatch, it dispatches with a large garbage buffer that is then freed: an upload-heap root SRV of up to 2 MB filled with `0xA5A5A5A5` in one variant, and a default-heap `View::Memory` of the same size in the other. The page bitmap (`Root::Uav(256)`) always came back with exactly the 3 expected bits. So on this machine, WARP's new committed buffers come back zeroed even right after large frees. **One lead.** `D3D12CreateDevice` returns one WARP device per process, so every test that uses WARP shares it. All the GPU tests serialise on `valu_tests::ONE_AT_A_TIME`, through `run`, `run_cases` and `check`, except: - `rect.rs::rectangles_get_their_fourth_corner`, which draws on WARP with no lock; - the `diff_tests` (hardware unless `VICTORY_WARP=1`) and `mod.rs::stub_pipeline_is_created` (hardware only), which only matter with that variable set. In a full run, that draw can overlap this test on the shared WARP device. I could not make that produce the failure here, so it is only a lead. Taking the lock in that test would be cheap if the failure comes back. Since `main` passed both of your runs and the failures came from trees with your bundles merged in, one of the bundled PRs might be what writes into this test's memory. Root UAV writes are not bounds-checked, and WARP has no protection between resources. A bisect over the bundle should be quicker than catching it on `main`. *AI-assisted (Claude Code); run on our machine, no game data.*
Author
Owner

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

Doesn't reproduce on main 42363ab on RDNA2. Three suspected causes are ruled out here, and the unlocked GPU tests your bundles add are listed below as bisect candidates.

Setup: AMD RX 6600 XT (RDNA2, the closest card to your RX 6950 XT so far), driver 32.0.21045.29003, Windows 11, Rust 1.98.1 MSVC, victory-shader lib test binary.

Experiment Failures
Whole crate test binary, default parallel threads 0 / 20 runs
title_memory_is_read_and_written_at_computed_addresses beside rect::rectangles_get_their_fourth_corner (on main it draws on WARP without the lock), 2 threads 0 / 200
The memory test beside a scratch test making 40 WARP compute pipelines without the lock (what #1145's validate_and_create_cs_pso and #189's recommended_wave64_mode_matches_device_capabilities do) 0 / 60
The memory test beside an unlocked twin of itself running 8 WARP dispatches of the same program 0 / 100

The runs overlapped: the scratch test alone takes 0.4 s and the memory test 0.19 s. On this machine, concurrent WARP use (draws, pipeline creation or dispatches) does not corrupt the page bitmap.

About #1892: the three diff_tests it locks need VICTORY_CONSOLE_DXC (the GDK console compiler) and return early without it. That includes this machine, and probably yours. They can't be what raced here unless that variable was set on your side.

GPU tests that PRs in your bundles (#1632, #1638) add without ONE_AT_A_TIME, from their diffs:

  • shader.rs::validate_and_create_cs_pso: hardware and WARP pipelines (#1145; also in #1644)
  • host.rs::recommended_wave64_mode_matches_device_capabilities: hardware and WARP pipelines (#189, #586)
  • valu_tests.rs::dispatch_oob_case and oob_raw_store_does_not_corrupt_element_zero: hardware dispatches with deliberate out-of-bounds raw stores (#542)
  • mod.rs::compute_shader_implicit_sample_uses_valver_1_8_and_validates: a hardware pipeline (#1597)

None of these is shown to be the cause. They are the bundle's GPU users that run outside the lock, so they are where a bisect should start. A small hardening commit that makes main's two remaining unlocked tests (rect and stub_pipeline_is_created) take the lock is on a local branch, if wanted.

AI-assisted (Claude Code); run on our machine, synthetic programs only, no game data.

**@⁠jules47800** on GitHub · 2026-11-25 01:25 UTC · [original](https://github.com/Marvisak/VIctory/issues/1882#issuecomment-7149527992) **Doesn't reproduce on `main` `42363ab` on RDNA2. Three suspected causes are ruled out here, and the unlocked GPU tests your bundles add are listed below as bisect candidates.** Setup: AMD RX 6600 XT (RDNA2, the closest card to your RX 6950 XT so far), driver 32.0.21045.29003, Windows 11, Rust 1.98.1 MSVC, `victory-shader` lib test binary. | Experiment | Failures | |---|---| | Whole crate test binary, default parallel threads | 0 / 20 runs | | `title_memory_is_read_and_written_at_computed_addresses` beside `rect::rectangles_get_their_fourth_corner` (on main it draws on WARP without the lock), 2 threads | 0 / 200 | | The memory test beside a scratch test making 40 WARP compute pipelines without the lock (what #1145's `validate_and_create_cs_pso` and #189's `recommended_wave64_mode_matches_device_capabilities` do) | 0 / 60 | | The memory test beside an unlocked twin of itself running 8 WARP dispatches of the same program | 0 / 100 | The runs overlapped: the scratch test alone takes 0.4 s and the memory test 0.19 s. On this machine, concurrent WARP use (draws, pipeline creation or dispatches) does not corrupt the page bitmap. About #1892: the three `diff_tests` it locks need `VICTORY_CONSOLE_DXC` (the GDK console compiler) and return early without it. That includes this machine, and probably yours. They can't be what raced here unless that variable was set on your side. GPU tests that PRs in your bundles (#1632, #1638) add without `ONE_AT_A_TIME`, from their diffs: - `shader.rs::validate_and_create_cs_pso`: hardware and WARP pipelines (#1145; also in #1644) - `host.rs::recommended_wave64_mode_matches_device_capabilities`: hardware and WARP pipelines (#189, #586) - `valu_tests.rs::dispatch_oob_case` and `oob_raw_store_does_not_corrupt_element_zero`: hardware dispatches with deliberate out-of-bounds raw stores (#542) - `mod.rs::compute_shader_implicit_sample_uses_valver_1_8_and_validates`: a hardware pipeline (#1597) None of these is shown to be the cause. They are the bundle's GPU users that run outside the lock, so they are where a bisect should start. A small hardening commit that makes main's two remaining unlocked tests (`rect` and `stub_pipeline_is_created`) take the lock is on a local branch, if wanted. *AI-assisted (Claude Code); run on our machine, synthetic programs only, no game data.*
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 12:51 UTC · original

Automated triage for the maintainers.

Reading main (940d32f) alone can't settle this. The GPU test modules in crates/victory-shader/src/emit/ serialise on valu_tests::ONE_AT_A_TIME. diff_tests is the one that doesn't, and open PR #1892 adds the lock there. But as noted above, its three tests return early without the console compiler (VICTORY_CONSOLE_DXC), so they can only race if that variable is set.

Two independent attempts on main did not reproduce the failure: an RTX 5060 Ti with 6 full and 8 targeted runs, and an RX 6600 XT with 20 full runs and 360 targeted overlaps. The three failures came from trees with your own bundles merged in; main passed both of its runs.

What would settle it:

  • whether VICTORY_CONSOLE_DXC was set in the failing runs;
  • the list of PRs in the bundles that failed, or a bisect over them. The previous comment lists the bundled GPU tests that run without the lock as the place to start;
  • a failure on plain main, if you see one.

Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 12:51 UTC · [original](https://github.com/Marvisak/VIctory/issues/1882#issuecomment-7162952611) <!-- victory-issue-triage v1 verdict=needs-info seen=2026-11-25T01:25:18Z at=2026-11-25T12:51:14Z --> Automated triage for the maintainers. Reading `main` (`940d32f`) alone can't settle this. The GPU test modules in `crates/victory-shader/src/emit/` serialise on `valu_tests::ONE_AT_A_TIME`. `diff_tests` is the one that doesn't, and open PR #1892 adds the lock there. But as noted above, its three tests return early without the console compiler (`VICTORY_CONSOLE_DXC`), so they can only race if that variable is set. Two independent attempts on `main` did not reproduce the failure: an RTX 5060 Ti with 6 full and 8 targeted runs, and an RX 6600 XT with 20 full runs and 360 targeted overlaps. The three failures came from trees with your own bundles merged in; `main` passed both of its runs. What would settle it: - whether `VICTORY_CONSOLE_DXC` was set in the failing runs; - the list of PRs in the bundles that failed, or a bisect over them. The previous comment lists the bundled GPU tests that run without the lock as the place to start; - a failure on plain `main`, if you see one. --- _Generated by [Claude Code](https://claude.ai/code)_
This discussion has been locked. Commenting is limited to contributors.
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory#1882
No description provided.