GPU watch marks unaligned zero-byte writes and can drop live aliases on empty remaps #2009

Open
opened 2026-11-25 02:53:29 +00:00 by tyr0nsur · 2 comments
tyr0nsur commented 2026-11-25 02:53:29 +00:00 (Migrated from github.com)
Contributor

Imported from Marvisak/VIctory. Originally posted by tyr0nsur on 2026-11-25T02:53:29Z.


On 940d32f, writing(base + 1, 0) reports a write to a clean 64 KiB page and its alias. Rounding the unaligned start down and the identical end up produces a one-page range. The same rounding in title_memory_remapped can remove an alias link on an empty remap.

The regression links two tracked pages and consumes the initial dirty range. It checks the empty write both while the guard lives and after dropping it, checks the empty remap, and then verifies that a real one-byte write through the first address still dirties the second. It uses the existing test helpers.

I reproduced the first empty-write assertion failure on Windows x64 at the revision above. With the small guard and range changes, the regression and the GPU library suite pass. Apply the linked patch, then run cargo test --locked -p victory-gpu --lib watch::tests::empty_writes_and_remaps_leave_a_clean_page_and_its_alias_untouched -- --exact.

Standalone patch and regression test

<!-- greyfinch-sync:Marvisak/VIctory:issue:6596111123 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/2011). Originally posted by [tyr0nsur](https://github.com/tyr0nsur) on 2026-11-25T02:53:29Z. --- On `940d32f`, `writing(base + 1, 0)` reports a write to a clean 64 KiB page and its alias. Rounding the unaligned start down and the identical end up produces a one-page range. The same rounding in `title_memory_remapped` can remove an alias link on an empty remap. The regression links two tracked pages and consumes the initial dirty range. It checks the empty write both while the guard lives and after dropping it, checks the empty remap, and then verifies that a real one-byte write through the first address still dirties the second. It uses the existing test helpers. I reproduced the first empty-write assertion failure on Windows x64 at the revision above. With the small guard and range changes, the regression and the GPU library suite pass. Apply the linked patch, then run `cargo test --locked -p victory-gpu --lib watch::tests::empty_writes_and_remaps_leave_a_clean_page_and_its_alias_untouched -- --exact`. [Standalone patch and regression test](https://github.com/tyr0nsur/PortVI/blob/1443a990c4fc84bf9de250cf456ea84c0edd2f02/patches/0007-empty-memory-ranges.patch)
BaggyALPHA commented 2026-11-25 04:06:45 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by BaggyALPHA on 2026-11-25T03:07:34Z.


Independent Windows validation on 940d32f. I split the two behaviors into separate synthetic probes so each executes on the upstream baseline.

  • Unaligned empty write: upstream dirtied the alias both while the guard was alive and when it was dropped. With the linked patch, the alias stayed clean at both points.
  • Unaligned empty remap: upstream dirtied the alias immediately and then failed to propagate the next real one-byte write. With the linked patch, the empty remap left it clean and the real write reached the alias.

All 9 watch tests passed with the linked patch, including its original regression and both local probes. The full GPU library suite with that patch had 144 passed, 2 failed, 2 ignored on RTX 3080. Both failures were the known NVIDIA descriptor-heap tests. Adding #1751 separately brought it to 146 passed, 0 failed, 2 ignored.

All inputs were synthetic. No game files were used. AI-assisted (OpenAI Codex).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7151614096 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/2011#issuecomment-7151614096). Originally posted by [BaggyALPHA](https://github.com/BaggyALPHA) on 2026-11-25T03:07:34Z. --- Independent Windows validation on `940d32f`. I split the two behaviors into separate synthetic probes so each executes on the upstream baseline. - Unaligned empty write: upstream dirtied the alias both while the guard was alive and when it was dropped. With the linked patch, the alias stayed clean at both points. - Unaligned empty remap: upstream dirtied the alias immediately and then failed to propagate the next real one-byte write. With the linked patch, the empty remap left it clean and the real write reached the alias. All 9 watch tests passed with the linked patch, including its original regression and both local probes. The full GPU library suite with that patch had 144 passed, 2 failed, 2 ignored on RTX 3080. Both failures were the known NVIDIA descriptor-heap tests. Adding #1751 separately brought it to 146 passed, 0 failed, 2 ignored. All inputs were synthetic. No game files were used. AI-assisted (OpenAI Codex).
Marvisak commented 2026-11-25 13:03:00 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T12:49:48Z.


Automated triage for the maintainers.

Confirmed in main (940d32f). In crates/victory-gpu/src/watch.rs, both writing and title_memory_remapped compute (at / PAGE, (at + len).div_ceil(PAGE)) with no check for len == 0, so an unaligned empty range covers one page: writing marks it (and its aliases) changed, and title_memory_remapped removes that page's alias links.

Open PR: #2021, which carries this change against main, so review can continue there rather than on the patch file in the fork.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7162915030 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/2011#issuecomment-7162915030). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T12:49:48Z. --- <!-- victory-issue-triage v1 verdict=confirmed seen=2026-11-25T03:07:34Z at=2026-11-25T12:55:00Z --> Automated triage for the maintainers. Confirmed in `main` (`940d32f`). In `crates/victory-gpu/src/watch.rs`, both `writing` and `title_memory_remapped` compute `(at / PAGE, (at + len).div_ceil(PAGE))` with no check for `len == 0`, so an unaligned empty range covers one page: `writing` marks it (and its aliases) changed, and `title_memory_remapped` removes that page's alias links. Open PR: #2021, which carries this change against `main`, so review can continue there rather than on the patch file in the fork. --- _Generated by [Claude Code](https://claude.ai/code)_
Sign in to join this conversation.
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
Marvisak/VIctory#2009
No description provided.