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

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

@⁠GDemay on GitHub · 2026-11-26 14:11 UTC · original
GDemay:fix/test-stale-watch-state → main · +60 −0 · 2 files · 1 commits · open

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

**@⁠GDemay** on GitHub · 2026-11-26 14:11 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/277) `GDemay:fix/test-stale-watch-state` → `main` · +60 −0 · 2 files · 1 commits · open ### 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
freed_memory_leaves_no_notes and unchanged_ranges_are_known failed together in
the parallel job of CI run 45800018587 (both at 10:23:02), and pass in the same
run's --test-threads=1 job: the suite's many tests impersonate owners of one
process-global, address-keyed watch state, and a fresh raw allocation can land
on a recycled address whose notes another test left behind. Fresh title(),
with_holes() and placeholder() memory now clears the stale blocks, bits and
view marks of its address range, as the runtime's own notifications would.

Co-Authored-By: GLM 5.3 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 14:12:59 +00:00
Author
Owner

@⁠compaccount1-coder on GitHub · 2026-11-26 15:54 UTC · original

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)

**@⁠compaccount1-coder** on GitHub · 2026-11-26 15:54 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/277#issuecomment-7196907022) 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 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/277/head:github-bot/gh-277'
git switch 'github-bot/gh-277'

Merge

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