GPU/watch+inplace: release/reopen views across MANY_VIEWS transitions and clear g.aliased #763

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

@⁠AscilCH on GitHub · 2026-11-25 06:44 UTC · original
AscilCH:fix/gpu-watch-many-views-threshold-and-aliased-cleanup → main · +114 −41 · 2 files · 1 commits · open

Problem

Three multi-view guard state bugs when physical pages cross the MANY_VIEWS (64) threshold (crates/victory-gpu/src/{inplace,watch}.rs):

  1. Crossing MANY_VIEWS upward (64 -> 65 views): title_memory_view() inserted the 65th view into v.pages before calling watch::views_mapped(), which queried views_of_section() and skipped pages with shown.len() > MANY_VIEWS. None of the 64 previously guarded views were opened: v_0 remained clean and PAGE_READONLY, v_1..v_63 remained trapped PAGE_READONLY and in g.aliased, and writes through v_64 were silently missed.
  2. Crossing MANY_VIEWS downward (> 64 -> 2..=64 views): When views_gone() dropped a page's view count back into 2..=MANY_VIEWS, a remaining view that had been guarded alone above MANY_VIEWS stayed clean and PAGE_READONLY while its remaining sibling views stayed PAGE_READWRITE and unguarded.
  3. Stale g.aliased entries in views_mapped(): views_mapped() called open_here() without removing opened blocks from g.aliased.

Fix

  • In inplace::title_memory_view(), collect views to open whenever before is in 1..=MANY_VIEWS (catching both normal additions and the exact 64 -> 65 crossing while keeping > 65 filler pages O(1)) and pass coalesced runs to watch::views_mapped().
  • In inplace::views_gone(), return coalesced runs of remaining views for any page whose count dropped from > MANY_VIEWS into 2..=MANY_VIEWS, and reopen them in watch::title_memory_remapped().
  • Remove opened blocks from g.aliased in watch::views_mapped() and when reopening downward-transitioned views.

Verification

  • cargo test -p victory-gpu --locked -- watch:: inplace::: 20 passed; 0 failed (including new tests crossing_many_views_upward_releases_aliases_and_reports_dirty and crossing_many_views_downward_reopens_remaining_views_for_shared_guarding).
  • cargo clippy -p victory-gpu --all-targets --all-features --locked: 0 warnings in inplace.rs and watch.rs (only pre-existing 8dd30ab warnings in draw.rs:2377 and indirect.rs:1322).
  • cargo xtask policy: 171 files ok.

(AI-assisted; synthetic unit tests only, no game data.)

**@⁠AscilCH** on GitHub · 2026-11-25 06:44 UTC · [original](https://github.com/fxceless/victory-fork/pull/763) `AscilCH:fix/gpu-watch-many-views-threshold-and-aliased-cleanup` → `main` · +114 −41 · 2 files · 1 commits · open ### Problem Three multi-view guard state bugs when physical pages cross the `MANY_VIEWS` (64) threshold (`crates/victory-gpu/src/{inplace,watch}.rs`): 1. **Crossing `MANY_VIEWS` upward (64 -> 65 views)**: `title_memory_view()` inserted the 65th view into `v.pages` before calling `watch::views_mapped()`, which queried `views_of_section()` and skipped pages with `shown.len() > MANY_VIEWS`. None of the 64 previously guarded views were opened: `v_0` remained `clean` and `PAGE_READONLY`, `v_1..v_63` remained trapped `PAGE_READONLY` and in `g.aliased`, and writes through `v_64` were silently missed. 2. **Crossing `MANY_VIEWS` downward (> 64 -> 2..=64 views)**: When `views_gone()` dropped a page's view count back into `2..=MANY_VIEWS`, a remaining view that had been guarded alone above `MANY_VIEWS` stayed `clean` and `PAGE_READONLY` while its remaining sibling views stayed `PAGE_READWRITE` and unguarded. 3. **Stale `g.aliased` entries in `views_mapped()`**: `views_mapped()` called `open_here()` without removing opened blocks from `g.aliased`. ### Fix - In `inplace::title_memory_view()`, collect views to open whenever `before` is in `1..=MANY_VIEWS` (catching both normal additions and the exact `64 -> 65` crossing while keeping `> 65` filler pages O(1)) and pass coalesced runs to `watch::views_mapped()`. - In `inplace::views_gone()`, return coalesced runs of remaining views for any page whose count dropped from `> MANY_VIEWS` into `2..=MANY_VIEWS`, and reopen them in `watch::title_memory_remapped()`. - Remove opened blocks from `g.aliased` in `watch::views_mapped()` and when reopening downward-transitioned views. ### Verification - `cargo test -p victory-gpu --locked -- watch:: inplace::`: `20 passed; 0 failed` (including new tests `crossing_many_views_upward_releases_aliases_and_reports_dirty` and `crossing_many_views_downward_reopens_remaining_views_for_shared_guarding`). - `cargo clippy -p victory-gpu --all-targets --all-features --locked`: 0 warnings in `inplace.rs` and `watch.rs` (only pre-existing `8dd30ab` warnings in `draw.rs:2377` and `indirect.rs:1322`). - `cargo xtask policy`: `171 files ok`. *(AI-assisted; synthetic unit tests only, no game data.)*
Three multi-view guard state bugs in crates/victory-gpu/src/{inplace,watch}.rs:

1. Crossing MANY_VIEWS upward (64 -> 65 views): `title_memory_view` inserted
   the 65th view into `v.pages` before calling `watch::views_mapped`, which
   then queried `views_of_section` and skipped any page with
   `shown.len() > MANY_VIEWS`. As a result none of the 64 previously guarded
   views were opened: `v_0` stayed `clean` and `PAGE_READONLY`, `v_1..v_63`
   remained stuck `PAGE_READONLY` in `g.aliased`, and writes through `v_64`
   were silently missed. Open all existing views of a page on the exact
   `MANY_VIEWS -> MANY_VIEWS + 1` transition (while still skipping pages
   already above `MANY_VIEWS + 1`).

2. Crossing MANY_VIEWS downward (> 64 -> 2..=64 views): when `views_gone`
   dropped a page's view count back into `2..=MANY_VIEWS`, a remaining view
   that had been guarded alone while count > 64 stayed `clean` and
   `PAGE_READONLY` while its remaining sibling views stayed unguarded and
   `PAGE_READWRITE`. Return those remaining views from `views_gone` and open
   them in `title_memory_remapped` so the next `guard()` protects all
   remaining views together.

3. `watch::views_mapped` called `open_here` without removing opened blocks
   from `g.aliased`, leaving stale alias entries behind. Remove opened
   blocks from `g.aliased` in `views_mapped` (and when opening views after a
   downward `MANY_VIEWS` transition).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:50:33 +00:00
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/watch.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/763/head:github-bot/gh-763'
git switch 'github-bot/gh-763'

Merge

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