Tests: memory the suite makes anew tells the watch nothing of the old at its address #277

Open
GDemay wants to merge 1 commit from upstream-pr/277 into main
GDemay commented 2026-11-26 14:11:44 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by GDemay on 2026-11-26T14:11:44Z.


What and why

watch::tests::freed_memory_leaves_no_notes and host::refresh_tests::unchanged_ranges_are_known failed together in the parallel job of run 45800018587 (both at 10:23:02), and pass in that same run's --test-threads=1 job and in the three runs before it. The suite's tests impersonate many owners of one process-global, address-keyed watch state, and a fresh raw allocation can land on an address another test has just given back, inheriting its notes:

  • guard() then skips noting a block that a stale foreign entry covers, so the notes the test reads back are not there (freed_memory_leaves_no_notes, the first noted()).
  • The asking skips a range whose stale PUBLISHED bits say it is known, so the kernel is never asked about the test's write and all 100 retries of the one asking miss it (unchanged_ranges_are_known, "view false: written on its last page").

The runtime never sees this interleaving: it is the one owner and tells of every change (title_memory_allocated, title_memory_freed, ...); the tests' raw VirtualAllocs and placeholders tell of nothing.

#[cfg(test)] pub(crate) fn title_memory_made_anew(at, len) clears what the address range's previous owner left: the guards' protected/clean/absent/held/aliased/foreign entries, the opened marks, the PUBLISHED/PROTECTED/BESIDE bits, and the VIEWS bits through the new forget_views. The journal needs no such call: its entries carry asking numbers, and another test's are always older than this test's (the suite's own idiom, written_pages_are_reported_to_every_asker). The three helpers that make memory anew call it: host.rs's title() and with_holes(), and watch.rs's placeholder(). Nothing outside #[cfg(test)] changes; no new switch, as there is no new behavior.

Measurements or Tested

  • The two tests fail together only in parallel and pass with --test-threads=1 in the same run: run 45800018587, Default job (both FAILED at 10:23:02); Diagnostics job: both pass. #172 saw the same class of one-off parallel flake in victory-loader.
  • Cross-checked from a non-Windows machine: CARGO_FEATURE_PURE=1 cargo clippy -p victory-gpu --all-targets --locked --target x86_64-pc-windows-msvc -- -D warnings (and --all-features) is clean on this branch apart from the unnecessary_mut_passed error already on main (watch.rs:3626, #241) and the missing_transmute_annotations one (#169).
  • Windows runners (my fork's CI, this branch, runs 45835219559): the parallel Default job 380 passed; 1 failed and Diagnostics 432 passed; 1 failed — in both, the only failure is depth_bounds_pipeline_loads_and_filters_draws (WARP, #169); both victim tests pass in the parallel job.

Not run

  • The flake is intermittent (one observed failure in the parallel job of that run; a code-identical baseline run of my fork's CI did not reproduce it), so these passes are evidence for the mechanism above, not proof by repetition.
  • Not run: the game — nothing here is outside #[cfg(test)].

AI-assisted: yes

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:issue:6628475292 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/277). Originally posted by [GDemay](https://github.com/GDemay) on 2026-11-26T14:11:44Z. --- ### What and why `watch::tests::freed_memory_leaves_no_notes` and `host::refresh_tests::unchanged_ranges_are_known` failed together in the parallel job of run 45800018587 (both at 10:23:02), and pass in that same run's `--test-threads=1` job and in the three runs before it. The suite's tests impersonate many owners of one process-global, address-keyed watch state, and a fresh raw allocation can land on an address another test has just given back, inheriting its notes: - `guard()` then skips noting a block that a stale `foreign` entry covers, so the notes the test reads back are not there (`freed_memory_leaves_no_notes`, the first `noted()`). - The asking skips a range whose stale `PUBLISHED` bits say it is known, so the kernel is never asked about the test's write and all 100 retries of the one asking miss it (`unchanged_ranges_are_known`, "view false: written on its last page"). The runtime never sees this interleaving: it is the one owner and tells of every change (`title_memory_allocated`, `title_memory_freed`, ...); the tests' raw `VirtualAlloc`s and placeholders tell of nothing. `#[cfg(test)] pub(crate) fn title_memory_made_anew(at, len)` clears what the address range's previous owner left: the guards' `protected`/`clean`/`absent`/`held`/`aliased`/`foreign` entries, the `opened` marks, the `PUBLISHED`/`PROTECTED`/`BESIDE` bits, and the `VIEWS` bits through the new `forget_views`. The journal needs no such call: its entries carry asking numbers, and another test's are always older than this test's (the suite's own idiom, `written_pages_are_reported_to_every_asker`). The three helpers that make memory anew call it: host.rs's `title()` and `with_holes()`, and watch.rs's `placeholder()`. Nothing outside `#[cfg(test)]` changes; no new switch, as there is no new behavior. ### Measurements or Tested - The two tests fail together only in parallel and pass with `--test-threads=1` in the same run: run 45800018587, Default job (both FAILED at 10:23:02); Diagnostics job: both pass. #172 saw the same class of one-off parallel flake in victory-loader. - Cross-checked from a non-Windows machine: `CARGO_FEATURE_PURE=1 cargo clippy -p victory-gpu --all-targets --locked --target x86_64-pc-windows-msvc -- -D warnings` (and `--all-features`) is clean on this branch apart from the `unnecessary_mut_passed` error already on main (watch.rs:3626, #241) and the `missing_transmute_annotations` one (#169). - Windows runners (my fork's CI, this branch, runs 45835219559): the parallel Default job **380 passed; 1 failed** and Diagnostics **432 passed; 1 failed** — in both, the only failure is `depth_bounds_pipeline_loads_and_filters_draws` (WARP, #169); both victim tests pass in the parallel job. ### Not run - The flake is intermittent (one observed failure in the parallel job of that run; a code-identical baseline run of my fork's CI did not reproduce it), so these passes are evidence for the mechanism above, not proof by repetition. - Not run: the game — nothing here is outside `#[cfg(test)]`. AI-assisted: yes
compaccount1-coder commented 2026-11-26 15:54:12 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by compaccount1-coder on 2026-11-26T15:54:12Z.


Results on real hardware, since CI only has WARP: RX 6700 XT (RDNA 2), Windows 11, this PR merged onto main (c9c932c), cargo test -p victory-gpu --lib:

  • 4 full runs on a quiet machine: clean, apart from views_are_made_beside_the_heap_and_copied_in, which fails on every RDNA 2 card on main too (fixed in #298).
  • 1 run while the machine was busy (another cargo test running beside it): watch::tests::freed_memory_leaves_no_notes --- FAILED, one of the two tests this PR is about. Right after it, what_the_title_puts_in_beside_a_guard_is_told spun in its unbounded put_beside retry and never finished (the run was killed after 25 minutes, so cargo never printed the failure's message). I've opened #315 so that loop fails with a message instead of hanging.

So on this card the PR doesn't break anything when the machine is quiet. But with it applied, freed_memory_leaves_no_notes still failed once in parallel under load. Either some recycled-address state isn't cleared yet, or that run hit something else. One run is all I have, so take it as a data point rather than a verdict.

Without this PR, under the same load, I also saw host::refresh_tests::unchanged_ranges_are_known and watch::tests::what_the_kernel_writes_through_is_not_guarded_for_another_view fail once each. Both runs were on #283 merged onto main, and #283 only changes where diagnostic files are written.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:comment:7196907022 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/277#issuecomment-7196907022). Originally posted by [compaccount1-coder](https://github.com/compaccount1-coder) on 2026-11-26T15:54:12Z. --- Results on real hardware, since CI only has WARP: RX 6700 XT (RDNA 2), Windows 11, this PR merged onto `main` (`c9c932c`), `cargo test -p victory-gpu --lib`: - **4 full runs on a quiet machine:** clean, apart from `views_are_made_beside_the_heap_and_copied_in`, which fails on every RDNA 2 card on `main` too (fixed in #298). - **1 run while the machine was busy** (another cargo test running beside it): `watch::tests::freed_memory_leaves_no_notes --- FAILED`, one of the two tests this PR is about. Right after it, `what_the_title_puts_in_beside_a_guard_is_told` spun in its unbounded `put_beside` retry and never finished (the run was killed after 25 minutes, so cargo never printed the failure's message). I've opened #315 so that loop fails with a message instead of hanging. So on this card the PR doesn't break anything when the machine is quiet. But with it applied, `freed_memory_leaves_no_notes` still failed once in parallel under load. Either some recycled-address state isn't cleared yet, or that run hit something else. One run is all I have, so take it as a data point rather than a verdict. Without this PR, under the same load, I also saw `host::refresh_tests::unchanged_ranges_are_known` and `watch::tests::what_the_kernel_writes_through_is_not_guarded_for_another_view` fail once each. Both runs were on #283 merged onto `main`, and #283 only changes where diagnostic files are written. AI-assisted: yes (Claude Code)
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/277:upstream-pr/277'
git switch 'upstream-pr/277'

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/277'
git switch 'upstream-pr/277'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/277'
git switch 'upstream-pr/277'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/277'
git switch 'main'
git merge --squash 'upstream-pr/277'
git switch 'main'
git merge --ff-only 'upstream-pr/277'
git switch 'main'
git merge 'upstream-pr/277'
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
avatarmanz/VIctory-7900XTX!277
No description provided.