GPU tests: assert a missed submission through readback #2805

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

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-25 21:03 UTC · original
andrewpozdnakov7-jpg:codex2/stable-missed-submission-test → main · +2 −3 · 1 files · 1 commits · open

The missed-submission test read a host word and then checked the tracked copy's clean flag. If another submission refreshed the copy between those two observations, the test could combine the old word 0x33 and the new clean flag with actual contents 0x11. The test now checks title memory and the next GPU readback, which verify the behavior the caller sees.

On 13f91ca, four serial diagnostics runs passed and one of four eight-thread runs failed the old assertion. A second parallel run hit the existing frame-timer failure. I forced a refresh between the two observations using the same synthetic test data. The old assertion then failed deterministically after the producer, refresh and final host-word controls passed. The same refresh sequence passed with the patch.

On the exact patch, the serial diagnostics run and all eight eight-thread runs passed with 198 tests and one ignored each. A separate control temporarily suppressed the retake: the retained GPU readback assertion failed with 0x33 instead of 0x11. Tests ran on app-local WARP. Strict GPU Clippy passed in both feature configurations, as did staged asset policy. Coordination claim

Please retain the Git author on cherry-pick or rebase. If you fold this change into another commit, please include Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-25 21:03 UTC · [original](https://github.com/Marvisak/VIctory/pull/2805) `andrewpozdnakov7-jpg:codex2/stable-missed-submission-test` → `main` · +2 −3 · 1 files · 1 commits · open The missed-submission test read a host word and then checked the tracked copy's clean flag. If another submission refreshed the copy between those two observations, the test could combine the old word `0x33` and the new clean flag with actual contents `0x11`. The test now checks title memory and the next GPU readback, which verify the behavior the caller sees. On `13f91ca`, four serial diagnostics runs passed and one of four eight-thread runs failed the old assertion. A second parallel run hit the existing frame-timer failure. I forced a refresh between the two observations using the same synthetic test data. The old assertion then failed deterministically after the producer, refresh and final host-word controls passed. The same refresh sequence passed with the patch. On the exact patch, the serial diagnostics run and all eight eight-thread runs passed with 198 tests and one ignored each. A separate control temporarily suppressed the retake: the retained GPU readback assertion failed with `0x33` instead of `0x11`. Tests ran on app-local WARP. Strict GPU Clippy passed in both feature configurations, as did staged asset policy. [Coordination claim](https://git.gtahub.st/github/Marvisak--VIctory/issues/1633) Please retain the Git author on cherry-pick or rebase. If you fold this change into another commit, please include `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>`.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:14:40 +00:00
Author
Owner

@⁠oni-swr on GitHub · 2026-11-25 21:19 UTC · original

Independent WARP/CPU verification of head cc0c89293313dc95b6a94ceb4fdfd77387102f38, merged onto origin/main 13f91caee25f2fdf2c062be5f7a27f058e51cbca (clean merge).

Environment: Windows 11 Pro 26200, WARP only (VICTORY_D3D12_WARP=1 with --features diagnostics, VICTORY_WARP=1), Windows SDK 10.0.26100.0 x64 dxil.dll 1.8.2502.11.

  • cargo test -j 4 -p victory-gpu --features diagnostics: 198 passed, 0 failed, 1 ignored. The baseline on origin/main was the same: 198/0/1.
  • Five more full runs of the lib tests with --test-threads=8: each 198/0/1.
  • Negative control: I disabled the immediate retake in drop_withheld (if false && SUBMISSION_MISSED…). a_submission_that_missed_leaves_the_copies_at_once then failed at the kept readback assertion with left: 51 (0x33), right: 17 (0x11). So the readback still catches a missing retake now that the racy clean-flag check is gone.
  • cargo clippy -p victory-gpu --all-targets -- -D warnings was clean, with and without --all-features.
  • cargo fmt --all --check: 891 hunks, the same as the baseline (no new hunks).

Diff review: no findings. The assertion that is dropped combined two observations that a concurrent refresh could separate. The title() and read() checks are what the caller sees, and they cover the behaviour. The change is test only, with no data files.

Not tested: physical GPU, retail title.

AI use: Claude Code (Claude Opus 5.5)

**@⁠oni-swr** on GitHub · 2026-11-25 21:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/2805#issuecomment-7174932810) Independent WARP/CPU verification of head `cc0c89293313dc95b6a94ceb4fdfd77387102f38`, merged onto `origin/main` `13f91caee25f2fdf2c062be5f7a27f058e51cbca` (clean merge). Environment: Windows 11 Pro 26200, WARP only (`VICTORY_D3D12_WARP=1` with `--features diagnostics`, `VICTORY_WARP=1`), Windows SDK 10.0.26100.0 x64 `dxil.dll` 1.8.2502.11. - `cargo test -j 4 -p victory-gpu --features diagnostics`: 198 passed, 0 failed, 1 ignored. The baseline on `origin/main` was the same: 198/0/1. - Five more full runs of the lib tests with `--test-threads=8`: each 198/0/1. - Negative control: I disabled the immediate retake in `drop_withheld` (`if false && SUBMISSION_MISSED…`). `a_submission_that_missed_leaves_the_copies_at_once` then failed at the kept readback assertion with `left: 51` (`0x33`), `right: 17` (`0x11`). So the readback still catches a missing retake now that the racy clean-flag check is gone. - `cargo clippy -p victory-gpu --all-targets -- -D warnings` was clean, with and without `--all-features`. - `cargo fmt --all --check`: 891 hunks, the same as the baseline (no new hunks). Diff review: no findings. The assertion that is dropped combined two observations that a concurrent refresh could separate. The `title()` and `read()` checks are what the caller sees, and they cover the behaviour. The change is test only, with no data files. Not tested: physical GPU, retail title. AI use: Claude Code (Claude Opus 5.5)
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-25 21:23 UTC · original

Reviewed and verified cc0c8929 on Windows 11 (RTX 5090 + WARP) against main (13f91ca).

  • Replacing the copy.read_host / copy.clean() race check with title-memory + subsequent GPU dispatch readback assertions cleanly eliminates the TOCTOU flake.
  • WARP (VICTORY_D3D12_WARP=1, --features diagnostics): memory::tests (--test-threads=1) 3/3 consecutive runs 5/5 passed (including a_submission_that_missed_leaves_the_copies_at_once); full suite 3/3 runs 196/196 passed (excluding the 2 pre-existing heap-cap tests).
  • RTX 5090 (--features diagnostics): memory::tests 3/3 runs 4/4 passed (excluding the pre-existing RTX 5090 lists_share baseline).
  • cargo clippy --locked -p victory-gpu --all-targets -- -D warnings (default & diagnostics): 0 warnings; cargo xtask policy: 184 files ok; clean git merge-tree vs 13f91ca.
**@⁠fuzeofficlal** on GitHub · 2026-11-25 21:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/2805#issuecomment-7175015010) Reviewed and verified `cc0c8929` on Windows 11 (RTX 5090 + WARP) against `main` (`13f91ca`). - Replacing the `copy.read_host` / `copy.clean()` race check with title-memory + subsequent GPU dispatch readback assertions cleanly eliminates the TOCTOU flake. - **WARP (`VICTORY_D3D12_WARP=1`, `--features diagnostics`)**: `memory::tests` (`--test-threads=1`) **3/3 consecutive runs `5/5 passed`** (including `a_submission_that_missed_leaves_the_copies_at_once`); full suite **3/3 runs `196/196 passed`** (excluding the 2 pre-existing heap-cap tests). - **RTX 5090 (`--features diagnostics`)**: `memory::tests` **3/3 runs `4/4 passed`** (excluding the pre-existing RTX 5090 `lists_share` baseline). - `cargo clippy --locked -p victory-gpu --all-targets -- -D warnings` (default & `diagnostics`): **0 warnings**; `cargo xtask policy`: **184 files ok**; clean `git merge-tree` vs `13f91ca`.
Author
Owner

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

Automated triage for the maintainers.

In a_submission_that_missed_leaves_the_copies_at_once (crates/victory-gpu/src/memory.rs) the check that reads copy.read_host and then copy.clean() is removed. Those two observations can be split by a refresh from another submission, which makes the test flaky. The test keeps the title-memory check and the next GPU readback, and an independent negative control in the thread shows the readback still fails when the immediate retake is disabled. main now serialises the memory tests with gpu_test_lock (#1865), but submissions from other modules can still refresh the copy, so the change still helps. CI (check) passes.

This is a recommendation for a maintainer to look, not an approval.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 23:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/2805#issuecomment-7177533599) <!-- victory-triage v1 head=cc0c89293313dc95b6a94ceb4fdfd77387102f38 verdict=merge-candidate at=2026-11-25T23:25:05Z --> Automated triage for the maintainers. In `a_submission_that_missed_leaves_the_copies_at_once` (`crates/victory-gpu/src/memory.rs`) the check that reads `copy.read_host` and then `copy.clean()` is removed. Those two observations can be split by a refresh from another submission, which makes the test flaky. The test keeps the title-memory check and the next GPU readback, and an independent negative control in the thread shows the readback still fails when the immediate retake is disabled. `main` now serialises the memory tests with `gpu_test_lock` (#1865), but submissions from other modules can still refresh the copy, so the change still helps. CI (`check`) passes. This is a recommendation for a maintainer to look, not an approval. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-25 21:13 UTC · original · reviewed

Right call — copy.clean()/its bytes are global shared state, and a concurrent test's submission legitimately refreshes the copy before this assert reads it. The kept asserts still cover the actual contract (nothing goes back before the next submission; the retake then reads title memory's bytes). LGTM.

**@⁠kotekompotek** on GitHub · 2026-11-25 21:13 UTC · [original](https://github.com/Marvisak/VIctory/pull/2805#pullrequestreview-6065065845) · **reviewed** Right call — `copy.clean()`/its bytes are global shared state, and a concurrent test's submission legitimately refreshes the copy before this assert reads it. The kept asserts still cover the actual contract (nothing goes back before the next submission; the retake then reads title memory's bytes). LGTM.
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-26 02:47 UTC · original · approved these changes

Tested merged onto origin/main (63bcca4) on Windows 11 x64 (NVIDIA GeForce RTX 5090):

  • cargo test -p victory-gpu --lib memory::tests -- --skip lists_share_a_table_and_copies_keep_their_views: 7 passed, 0 failed (skipped pre-existing #1744 NVIDIA 1M view-heap cap test).
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-26 02:47 UTC · [original](https://github.com/Marvisak/VIctory/pull/2805#pullrequestreview-6067881834) · **approved these changes** Tested merged onto `origin/main` (`63bcca4`) on Windows 11 x64 (NVIDIA GeForce RTX 5090): - `cargo test -p victory-gpu --lib memory::tests -- --skip lists_share_a_table_and_copies_keep_their_views`: **7 passed, 0 failed** (skipped pre-existing `#1744` NVIDIA 1M view-heap cap test). - `cargo clippy -p victory-gpu --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 12:07 UTC · original · approved these changes

Reviewed and verified at head cc0c8929 and merged onto origin/main (63bcca43) on Windows 11 (RTX 5090 + WARP, VICTORY_D3D12_DEBUG=1):

  • Design & correctness: removing the copy.read_host + !copy.clean() || held == 0x11 check in a_submission_that_missed_leaves_the_copies_at_once (crates/victory-gpu/src/memory.rs:883-887) eliminates a genuine TOCTOU race where a concurrent submission from another test module (not covered by memory::tests::gpu_test_lock()) refreshes the dirty shadow copy between the two reads. The retained assertions (assert_eq!(title(), 0x11) and assert_eq!(read(), 0x11)) still verify both sides of the contract—withholding writes from title memory and retaking title bytes on the next GPU dispatch.
  • Verification:
    • Clean git merge-tree against origin/main (63bcca43); cargo xtask policy (184 files ok); cargo clippy -p victory-gpu --all-targets -- -D warnings clean with default features and --all-features (both at cc0c8929 and merged onto 63bcca43).
    • At cc0c8929 with VICTORY_D3D12_DEBUG=1: RTX 5090 memory::tests 4/4 passed (skipping pre-existing 1M heap-cap lists_share), WARP memory::tests 5/5 passed.
    • Merged onto origin/main (63bcca43), 3 consecutive 8-thread parallel multi-module stress runs (memory::tests + draw::tests, --test-threads=8, --features diagnostics, VICTORY_D3D12_DEBUG=1): 3/3 passed on RTX 5090 (27/27 each, skipping pre-existing 1M heap-cap lists_share) and 3/3 passed on WARP (28/28 each) with zero flakes or debug-layer errors.

LGTM.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 12:07 UTC · [original](https://github.com/Marvisak/VIctory/pull/2805#pullrequestreview-6073859674) · **approved these changes** Reviewed and verified at head `cc0c8929` and merged onto `origin/main` (`63bcca43`) on Windows 11 (RTX 5090 + WARP, `VICTORY_D3D12_DEBUG=1`): - **Design & correctness**: removing the `copy.read_host` + `!copy.clean() || held == 0x11` check in `a_submission_that_missed_leaves_the_copies_at_once` (`crates/victory-gpu/src/memory.rs:883-887`) eliminates a genuine TOCTOU race where a concurrent submission from another test module (not covered by `memory::tests::gpu_test_lock()`) refreshes the dirty shadow copy between the two reads. The retained assertions (`assert_eq!(title(), 0x11)` and `assert_eq!(read(), 0x11)`) still verify both sides of the contract—withholding writes from title memory and retaking title bytes on the next GPU dispatch. - **Verification**: - Clean `git merge-tree` against `origin/main` (`63bcca43`); `cargo xtask policy` (`184 files ok`); `cargo clippy -p victory-gpu --all-targets -- -D warnings` clean with default features and `--all-features` (both at `cc0c8929` and merged onto `63bcca43`). - At `cc0c8929` with `VICTORY_D3D12_DEBUG=1`: RTX 5090 `memory::tests` **4/4** passed (skipping pre-existing 1M heap-cap `lists_share`), WARP `memory::tests` **5/5** passed. - Merged onto `origin/main` (`63bcca43`), 3 consecutive 8-thread parallel multi-module stress runs (`memory::tests` + `draw::tests`, `--test-threads=8`, `--features diagnostics`, `VICTORY_D3D12_DEBUG=1`): **3/3 passed on RTX 5090** (27/27 each, skipping pre-existing 1M heap-cap `lists_share`) and **3/3 passed on WARP** (28/28 each) with zero flakes or debug-layer errors. LGTM.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
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/2805/head:github-bot/gh-2805'
git switch 'github-bot/gh-2805'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2805'
git switch 'github-bot/gh-2805'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2805'
git switch 'github-bot/gh-2805'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2805'
git switch 'main'
git merge --squash 'github-bot/gh-2805'
git switch 'main'
git merge --ff-only 'github-bot/gh-2805'
git switch 'main'
git merge 'github-bot/gh-2805'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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!2805
No description provided.