GPU: free memory is not the runtime's to watch (fixes a world-load deadlock under Wine) #1849

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

@⁠crashbashash on GitHub · 2026-11-24 23:24 UTC · original
crashbashash:fix/watch-free-memory → main · +46 −12 · 1 files · 1 commits · open

Under Wine/Proton, main at 70564ae stops at the end of loading or just after entering the world: no frames, no audio, the title idle, no GPU fault. Six of six runs here (RX 6800 XT, RADV, GE-Proton11-14). This is the cause and a one-condition fix.

What happens

  1. shadow::loose() makes a 4 MiB window copy for an address outside every known buffer. For a null address that window is 0x0..0x400000, and Shadow::new asks watch::track(0, 4 MiB, true) to track it.
  2. runtime_memory(0, true) accepts it: GetWriteWatch fails, and the view test is "anything but committed private memory", which free memory (MEM_FREE) passes.
  3. The window's blocks get guarded. On Windows there is usually nothing committed below 4 MiB, so the VirtualProtect calls just fail (I haven't checked on Windows). Under Wine the process heap lives there (here, heap writes faulted on guarded blocks from 0x140000 to 0x260000), and its pages become read-only.
  4. From then on, any heap write faults into on_write. When the faulting thread already holds GUARDS (it allocates inside Tracked::take, writing(), or on_write itself), on_write waits for the lock its own thread holds, forever. Audio (apu::XApuEnqueueCommand), GPU submission (Host::execute → Tracked::take) and the title's workers then queue behind it.

Evidence

  • Stacks taken from outside the process (gdb; in-process dumpers hang on this lock), unwound on the Windows side and symbolized with the build's PDB: a title thread in xmem::map_alias → watch::title_memory_remapped faulting into on_write → Mutex::lock_contended; others waiting in on_write (audio) and Tracked::take (GPU submission).
  • A local diagnostic build that detects a write fault on a thread holding GUARDS logged faults at 0x1400d8 (RtlEnterCriticalSection on the process heap's lock) and 0x1de770 (ucrtbase memcpy into the heap), with the lock taken in Tracked::take, writing() and on_write. With those faults let through, the title ran 5 minutes in the world.
  • Logged at track(): 0x0+0x400000 from shadow.rs:205, VirtualQuery state 0x10000 (MEM_FREE).

The change

runtime_memory also requires State != MEM_FREE. Placeholders and views, which it is meant to accept, are reserved or mapped, never free. New test free_memory_is_not_tracked (track(0, 4 MiB, true) is None): it fails without the change and passes with it. All 7 watch tests pass under Wine.

In the title

70564ae + the watchdog hook (#454) + three of #994's Proton commits (4828716, e5a8c2f, d469fe9), shaders and pipelines precached with translate --cache --pipelines, RX 6800 XT, RADV / Mesa 26.2.6, GE-Proton11-14:

runs reached the world stalled
without this change 6 1 6 (five at the end of loading, one seconds after entering)
with this change 3 3 0 (5 min in the world each: two stopped by me, one ended in the crash below)

With it, the opening renders: sky, skyline, characters and credits, 2,500–3,600 draws per frame, 4.8–6.2 s per frame. One of the three runs ended at 5 minutes in an access violation in title code (+0x35a4245, reading -1, no VIctory frames on the stack); the other two didn't, so I take it to be unrelated.

Not tested on Windows. The change only turns away free memory, so there it should only mean fewer VirtualProtect calls that fail anyway.

AI-assisted (Claude Code). No game data attached.

**@⁠crashbashash** on GitHub · 2026-11-24 23:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/1849) `crashbashash:fix/watch-free-memory` → `main` · +46 −12 · 1 files · 1 commits · open Under Wine/Proton, `main` at `70564ae` stops at the end of loading or just after entering the world: no frames, no audio, the title idle, no GPU fault. Six of six runs here (RX 6800 XT, RADV, GE-Proton11-14). This is the cause and a one-condition fix. ### What happens 1. `shadow::loose()` makes a 4 MiB window copy for an address outside every known buffer. For a null address that window is `0x0..0x400000`, and `Shadow::new` asks `watch::track(0, 4 MiB, true)` to track it. 2. `runtime_memory(0, true)` accepts it: `GetWriteWatch` fails, and the view test is "anything but committed private memory", which free memory (`MEM_FREE`) passes. 3. The window's blocks get guarded. On Windows there is usually nothing committed below 4 MiB, so the `VirtualProtect` calls just fail (I haven't checked on Windows). **Under Wine the process heap lives there** (here, heap writes faulted on guarded blocks from `0x140000` to `0x260000`), and its pages become read-only. 4. From then on, any heap write faults into `on_write`. When the faulting thread already holds `GUARDS` (it allocates inside `Tracked::take`, `writing()`, or `on_write` itself), `on_write` waits for the lock its own thread holds, forever. Audio (`apu::XApuEnqueueCommand`), GPU submission (`Host::execute` → `Tracked::take`) and the title's workers then queue behind it. ### Evidence - Stacks taken from outside the process (gdb; in-process dumpers hang on this lock), unwound on the Windows side and symbolized with the build's PDB: a title thread in `xmem::map_alias` → `watch::title_memory_remapped` faulting into `on_write` → `Mutex::lock_contended`; others waiting in `on_write` (audio) and `Tracked::take` (GPU submission). - A local diagnostic build that detects a write fault on a thread holding `GUARDS` logged faults at `0x1400d8` (`RtlEnterCriticalSection` on the process heap's lock) and `0x1de770` (`ucrtbase` `memcpy` into the heap), with the lock taken in `Tracked::take`, `writing()` and `on_write`. With those faults let through, the title ran 5 minutes in the world. - Logged at `track()`: `0x0+0x400000` from `shadow.rs:205`, `VirtualQuery` state `0x10000` (`MEM_FREE`). ### The change `runtime_memory` also requires `State != MEM_FREE`. Placeholders and views, which it is meant to accept, are reserved or mapped, never free. New test `free_memory_is_not_tracked` (`track(0, 4 MiB, true)` is `None`): it fails without the change and passes with it. All 7 `watch` tests pass under Wine. ### In the title `70564ae` + the watchdog hook (#454) + three of #994's Proton commits (`4828716`, `e5a8c2f`, `d469fe9`), shaders and pipelines precached with `translate --cache --pipelines`, RX 6800 XT, RADV / Mesa 26.2.6, GE-Proton11-14: | | runs | reached the world | stalled | |---|---|---|---| | without this change | 6 | 1 | 6 (five at the end of loading, one seconds after entering) | | with this change | 3 | 3 | 0 (5 min in the world each: two stopped by me, one ended in the crash below) | With it, the opening renders: sky, skyline, characters and credits, 2,500–3,600 draws per frame, 4.8–6.2 s per frame. One of the three runs ended at 5 minutes in an access violation in title code (`+0x35a4245`, reading `-1`, no VIctory frames on the stack); the other two didn't, so I take it to be unrelated. Not tested on Windows. The change only turns away free memory, so there it should only mean fewer `VirtualProtect` calls that fail anyway. AI-assisted (Claude Code). No game data attached.
A loose copy of title memory for a null address covers 0..4 MiB, and
`runtime_pages` takes free memory for the runtime's (its `shortcut:`),
so free parts of the window are tracked and guarded once something is
committed there. On Windows nothing is. Under Wine the process heap is:
its pages became read-only, and a heap write by a thread holding the
guard lock (in `Tracked::take`, `writing` or the fault handler itself)
faulted into the handler, which waited for that lock forever: the title
stopped at the end of loading.

The region check now leaves free memory out, as it leaves out plain
committed memory and images; reserved memory still counts (the
shortcut keeps that part).

Test: a block reserved and released (free memory at a known address)
is not tracked. It fails without the change; it only counts if the
block is still free afterwards, since other tests allocate meanwhile.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:46:33 +00:00
Author
Owner

@⁠astrosteveo on GitHub · 2026-11-25 03:57 UTC · original

Tested on an RTX 5080, Wine 11.22, on 940d32f plus open PRs. free_memory_is_not_tracked fails without the change and passes with it, in MinGW and MSVC builds.

I forced the hang by allocating plain memory at 0x200000 after track(0, 4 MiB): it became read-only, and a write with the guard lock held never returned. With the change it stays writable.

On this Wine the process heap was above 4 GiB in 13 of 13 probes, so the null window wouldn't reach it here.

A gap that remains: runtime_memory checks only the first page, so private committed memory later in a range that starts in a reservation is still guarded (shown with a synthetic test; I don't know if the title hits it). Not tested: Windows, the title. AI-assisted (Claude).

**@⁠astrosteveo** on GitHub · 2026-11-25 03:57 UTC · [original](https://github.com/Marvisak/VIctory/pull/1849#issuecomment-7152395911) Tested on an RTX 5080, Wine 11.22, on `940d32f` plus open PRs. `free_memory_is_not_tracked` fails without the change and passes with it, in MinGW and MSVC builds. I forced the hang by allocating plain memory at `0x200000` after `track(0, 4 MiB)`: it became read-only, and a write with the guard lock held never returned. With the change it stays writable. On this Wine the process heap was above 4 GiB in 13 of 13 probes, so the null window wouldn't reach it here. A gap that remains: `runtime_memory` checks only the first page, so private committed memory later in a range that starts in a reservation is still guarded (shown with a synthetic test; I don't know if the title hits it). Not tested: Windows, the title. AI-assisted (Claude).
Author
Owner

@⁠coil111 on GitHub · 2026-11-25 04:34 UTC · original

Tested on Linux/Proton with an AMD RDNA4 card: without this PR, current main freezes at the end of loading in the same way the description says; with it, the title reaches the world and keeps running.

Setup: RX 9070 XT (RDNA4), Mesa RADV, Gentoo, kernel 7.3.4, 64 GB RAM. Proton Experimental experimental-11.0-20261112 (its Wine; vkd3d-proton 2576c0b4a; DXVK dxgi). Diagnostics build of main 940d32f, cross-built with cargo-xwin (x86_64-pc-windows-msvc). Title 1.0.2.1, Series X, pipelines prebuilt with translate --cache --pipelines.

What the freeze looked like here (940d32f alone):

  • The log stops mid-load, with no error, no exception and no GPU fault. The kernel log shows no amdgpu reset either.
  • The process is still alive: ~22 GB resident, 96 threads, all of them idle (no CPU time over several seconds).
  • The window title (frame rate and draw count) stopped updating at the same moment the log did.
  • winedbg could not attach to the process (error 87), so I have no stacks of my own. The symptoms match the description, but I have not shown it is the same lock.

With this pr the 7 watch tests pass under this Wine (cargo xwin test -p victory-gpu -- watch, Wine as the runner), including the new free_memory_is_not_tracked. In the title, the run went from loading into the world without stopping.

**@⁠coil111** on GitHub · 2026-11-25 04:34 UTC · [original](https://github.com/Marvisak/VIctory/pull/1849#issuecomment-7152967915) Tested on Linux/Proton with an AMD RDNA4 card: without this PR, current `main` freezes at the end of loading in the same way the description says; with it, the title reaches the world and keeps running. **Setup:** RX 9070 XT (RDNA4), Mesa RADV, Gentoo, kernel 7.3.4, 64 GB RAM. Proton Experimental `experimental-11.0-20261112` (its Wine; vkd3d-proton `2576c0b4a`; DXVK dxgi). Diagnostics build of `main` `940d32f`, cross-built with cargo-xwin (`x86_64-pc-windows-msvc`). Title 1.0.2.1, Series X, pipelines prebuilt with `translate --cache --pipelines`. **What the freeze looked like here (`940d32f` alone):** - The log stops mid-load, with no error, no exception and no GPU fault. The kernel log shows no amdgpu reset either. - The process is still alive: ~22 GB resident, 96 threads, all of them idle (no CPU time over several seconds). - The window title (frame rate and draw count) stopped updating at the same moment the log did. - `winedbg` could not attach to the process (error 87), so I have no stacks of my own. The symptoms match the description, but I have not shown it is the same lock. With this pr the 7 `watch` tests pass under this Wine (`cargo xwin test -p victory-gpu -- watch`, Wine as the runner), including the new `free_memory_is_not_tracked`. In the title, the run went from loading into the world without stopping.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 07:25 UTC · original · edited 2026-11-25 18:24 UTC

Automated triage for the maintainers.

runtime_pages in crates/victory-gpu/src/watch.rs no longer counts MEM_FREE regions as the runtime's GPU memory, so free parts of a tracked range (for example the 4 MiB window around a null address) are never guarded. I checked this against origin/main. Since 280b150, the region walk counts free memory as "ours". Under Wine the process heap is later committed there and gets guarded, and a heap write made while holding the guard lock deadlocks. The change only moves free pages into the untracked set, which Shadow::update_free copies whole each use, so correctness on Windows is unchanged. Reserved memory and placeholders are still tracked. The new test free_memory_is_not_tracked reserves and releases a block and fails without the change. Several independent Wine/Proton runs in the thread (NVIDIA and AMD) report that the freeze at world entry is gone.

One thing to keep an eye on: free pages inside a tracked range are now copied whole (as failing reads) on every use instead of counted as zero pages, so a range with large free parts may cost a bit more per frame.

CI: passing.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 07:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/1849#issuecomment-7155847814) · edited 2026-11-25 18:24 UTC <!-- victory-triage v1 head=4f6bacef7f53e781bf0a48eca8cd223402092d76 verdict=merge-candidate at=2026-11-25T18:24:18Z --> Automated triage for the maintainers. `runtime_pages` in `crates/victory-gpu/src/watch.rs` no longer counts `MEM_FREE` regions as the runtime's GPU memory, so free parts of a tracked range (for example the 4 MiB window around a null address) are never guarded. I checked this against `origin/main`. Since `280b150`, the region walk counts free memory as "ours". Under Wine the process heap is later committed there and gets guarded, and a heap write made while holding the guard lock deadlocks. The change only moves free pages into the untracked set, which `Shadow::update_free` copies whole each use, so correctness on Windows is unchanged. Reserved memory and placeholders are still tracked. The new test `free_memory_is_not_tracked` reserves and releases a block and fails without the change. Several independent Wine/Proton runs in the thread (NVIDIA and AMD) report that the freeze at world entry is gone. One thing to keep an eye on: free pages inside a tracked range are now copied whole (as failing reads) on every use instead of counted as zero pages, so a range with large free parts may cost a bit more per frame. CI: passing. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠crashbashash on GitHub · 2026-11-25 11:14 UTC · original

Thanks for testing this on NVIDIA, and for the gap.

You're right: runtime_memory looks only at the first page, so a range that starts in a reservation with plain committed memory further in is still guarded. That's older than this PR, so I've kept the fix separate to leave this one as reviewed: #2345 checks every region of the range, with your case as a test (a reserved block plus a committed one is refused; the reserved block alone is still tracked).

I don't know whether the title hits it either; in our runs the change made no measurable difference.

AI-assisted (Claude Code). No game data attached.

**@⁠crashbashash** on GitHub · 2026-11-25 11:14 UTC · [original](https://github.com/Marvisak/VIctory/pull/1849#issuecomment-7160787554) Thanks for testing this on NVIDIA, and for the gap. You're right: `runtime_memory` looks only at the first page, so a range that starts in a reservation with plain committed memory further in is still guarded. That's older than this PR, so I've kept the fix separate to leave this one as reviewed: #2345 checks every region of the range, with your case as a test (a reserved block plus a committed one is refused; the reserved block alone is still tracked). I don't know whether the title hits it either; in our runs the change made no measurable difference. AI-assisted (Claude Code). No game data attached.
Author
Owner

@⁠Impre-visible on GitHub · 2026-11-25 14:43 UTC · original

Test report, as asked in #1921: five runs with this PR on the setup where main froze at world entry.

Setup: Linux (Arch, kernel 6.18 LTS), GTX 1660 6 GB, NVIDIA 620.73.04 (open modules), Wine from GE-Proton11-6 with vkd3d-proton 2576c0b. Tree: main as fetched this morning (after 86a5ed6) plus a few other open PRs (#1722, #1769, #1583's branch, #1523, #454) and this PR at de95e51. VICTORY_NO_WATCHDOG=1, 15-minute limit per run, one run at a time.

runs that reached the world froze at world entry Xid in the kernel log
same tree without this PR 3 3 0
with this PR 5 0 0

All five runs with the PR ran to the 15-minute limit in the world. Two started from warm shader and pipeline caches, three from empty ones. Per run: 788 to 855 compute pipelines made, last frame 2,834 to 3,002, frame time in the world about 1.3 s once loading settles (one run 2.4 s at the cut), 0.3 to 24 s during loading.

The freeze without the PR was the one described in #1921: no log line and no present any more, sync_heaps stuck inside Viewed::set with the other threads behind SHADER_HEAPS.

Not part of this PR, but for the record on this card with that tree: 153 compute pipelines refused per run (wave64 on a 32-lane host) and 149 to 195 no dynamic slots for its tables drops per run (#1548 is not in it).

Not tested: Windows, AMD, anything past the first playable scene (the runs only press Enter).

🤖 Generated with Claude Code

**@⁠Impre-visible** on GitHub · 2026-11-25 14:43 UTC · [original](https://github.com/Marvisak/VIctory/pull/1849#issuecomment-7165718918) Test report, as asked in #1921: five runs with this PR on the setup where `main` froze at world entry. **Setup:** Linux (Arch, kernel 6.18 LTS), GTX 1660 6 GB, NVIDIA 620.73.04 (open modules), Wine from GE-Proton11-6 with vkd3d-proton `2576c0b`. Tree: `main` as fetched this morning (after `86a5ed6`) plus a few other open PRs (#1722, #1769, #1583's branch, #1523, #454) and this PR at `de95e51`. `VICTORY_NO_WATCHDOG=1`, 15-minute limit per run, one run at a time. | | runs that reached the world | froze at world entry | `Xid` in the kernel log | |---|---|---|---| | same tree without this PR | 3 | 3 | 0 | | with this PR | 5 | 0 | 0 | All five runs with the PR ran to the 15-minute limit in the world. Two started from warm shader and pipeline caches, three from empty ones. Per run: 788 to 855 compute pipelines made, last frame 2,834 to 3,002, frame time in the world about 1.3 s once loading settles (one run 2.4 s at the cut), 0.3 to 24 s during loading. The freeze without the PR was the one described in #1921: no log line and no present any more, `sync_heaps` stuck inside `Viewed::set` with the other threads behind `SHADER_HEAPS`. Not part of this PR, but for the record on this card with that tree: 153 compute pipelines refused per run (wave64 on a 32-lane host) and 149 to 195 `no dynamic slots for its tables` drops per run (#1548 is not in it). Not tested: Windows, AMD, anything past the first playable scene (the runs only press Enter). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Owner

@⁠crashbashash on GitHub · 2026-11-25 16:49 UTC · original

Rebased onto main (67e8ae1). Since 280b150 checks every region of a tracked range, this PR is down to one condition in that check: free memory is not the runtime's. 280b150 still counts free memory as the runtime's (its shortcut: note says so). Under Wine that's the deadlock this PR was opened for: Wine's process heap gets committed where the range was free, and the heap's writes fault into the guard handler while a thread holds the guard lock.

The test changed with it. The old one tracked the window of a null address, but with the region walk that window is no longer all free under Wine: Wine maps read-only locale files there, which count as views. The new test reserves a block and releases it, so it has free memory at a known address, and checks that it isn't tracked. It fails without the change.

Tests: victory-gpu under Wine (GE-Proton11-14 with vkd3d-proton, RX 6800 XT): 193 passed, 3 failed. The same 3 fail on main there: a_texture_written_in_one_format_reads_in_another_through_a_placed_view (castable formats, #2101) and the two pipeline::library blob tests. cargo clippy is clean with and without --all-features.

@⁠Impre-visible, thanks for the five runs on the GTX 1660. That's the clearest evidence this PR has had.

AI-assisted (Claude Code). No game data attached.

**@⁠crashbashash** on GitHub · 2026-11-25 16:49 UTC · [original](https://github.com/Marvisak/VIctory/pull/1849#issuecomment-7168585010) Rebased onto `main` (`67e8ae1`). Since `280b150` checks every region of a tracked range, this PR is down to one condition in that check: free memory is not the runtime's. `280b150` still counts free memory as the runtime's (its `shortcut:` note says so). Under Wine that's the deadlock this PR was opened for: Wine's process heap gets committed where the range was free, and the heap's writes fault into the guard handler while a thread holds the guard lock. The test changed with it. The old one tracked the window of a null address, but with the region walk that window is no longer all free under Wine: Wine maps read-only locale files there, which count as views. The new test reserves a block and releases it, so it has free memory at a known address, and checks that it isn't tracked. It fails without the change. Tests: `victory-gpu` under Wine (GE-Proton11-14 with vkd3d-proton, RX 6800 XT): 193 passed, 3 failed. The same 3 fail on `main` there: `a_texture_written_in_one_format_reads_in_another_through_a_placed_view` (castable formats, #2101) and the two `pipeline::library` blob tests. `cargo clippy` is clean with and without `--all-features`. @⁠Impre-visible, thanks for the five runs on the GTX 1660. That's the clearest evidence this PR has had. AI-assisted (Claude Code). No game data attached.
Author
Owner

@⁠catminou4 on GitHub · 2026-11-24 23:47 UTC · original · reviewed

Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.

Free memory is not the runtime's to watch (fixes a world-load…): stops the runtime treating free pages as its own — likely a crash/OOM fix on world load. Windows-only.

**@⁠catminou4** on GitHub · 2026-11-24 23:47 UTC · [original](https://github.com/Marvisak/VIctory/pull/1849#pullrequestreview-6049282413) · **reviewed** Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff. Free memory is not the runtime's to watch (fixes a world-load…): stops the runtime treating free pages as its own — likely a crash/OOM fix on world load. Windows-only.
Author
Owner

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

Verified 4f6bacef7f53e781bf0a48eca8cd223402092d76 merged cleanly onto 63bcca43 on Windows 11 with both an RTX 5090 (VICTORY_D3D12_DEBUG=1) and WARP (--features diagnostics, VICTORY_D3D12_DEBUG=1).

Code review

  • Adding info.State != MEM_FREE in runtime_pages (crates/victory-gpu/src/watch.rs:333-368, condition at watch.rs:361) cleanly excludes free address space from being treated as runtime GPU memory while keeping write-watched pools (watched(...)), MEM_RESERVE reservations/placeholders, and MEM_COMMIT | MEM_MAPPED views tracked, and keeping MEM_IMAGE and plain MEM_COMMIT | MEM_PRIVATE excluded.
  • Because any 64 KiB page touching a MEM_FREE region is added to other and removed by runtime.difference(&other) (watch.rs:364-367), a range straddling a reservation and adjacent free space leaves the free page untracked and never registers it in g.protected, preventing future allocations into that free region from faulting into on_write while GUARDS is held.

Verification

  • cargo xtask policy: 191 files ok.
  • cargo clippy --locked -p victory-gpu --all-targets -- -D warnings (default and --all-features): clean.
  • RTX 5090 + VICTORY_D3D12_DEBUG=1: watch:: 16 passed, 0 failed (including free_memory_is_not_tracked at watch.rs:1049).
  • WARP + --features diagnostics + VICTORY_D3D12_DEBUG=1: watch:: 16 passed, 0 failed.
  • Additional probe on both RTX 5090 and WARP verifying: (1) a 128 KiB MEM_FREE range returns None from track_copy, (2) a mixed [MEM_RESERVE 64 KiB | MEM_FREE 64 KiB] range tracks page 0 and puts page 1 in untracked without ever inserting page 1 into g.protected, (3) committing plain PAGE_READWRITE memory at that formerly free page 1 and writing to it while holding guards() completes with no fault or deadlock, and (4) a write-watched pool remains 100% tracked with zero untracked bytes.
**@⁠fuzeofficlal** on GitHub · 2026-11-26 16:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/1849#pullrequestreview-6077691300) · **approved these changes** Verified `4f6bacef7f53e781bf0a48eca8cd223402092d76` merged cleanly onto `63bcca43` on Windows 11 with both an RTX 5090 (`VICTORY_D3D12_DEBUG=1`) and WARP (`--features diagnostics`, `VICTORY_D3D12_DEBUG=1`). ### Code review - Adding `info.State != MEM_FREE` in `runtime_pages` (`crates/victory-gpu/src/watch.rs:333-368`, condition at `watch.rs:361`) cleanly excludes free address space from being treated as runtime GPU memory while keeping write-watched pools (`watched(...)`), `MEM_RESERVE` reservations/placeholders, and `MEM_COMMIT | MEM_MAPPED` views tracked, and keeping `MEM_IMAGE` and plain `MEM_COMMIT | MEM_PRIVATE` excluded. - Because any 64 KiB page touching a `MEM_FREE` region is added to `other` and removed by `runtime.difference(&other)` (`watch.rs:364-367`), a range straddling a reservation and adjacent free space leaves the free page untracked and never registers it in `g.protected`, preventing future allocations into that free region from faulting into `on_write` while `GUARDS` is held. ### Verification - `cargo xtask policy`: `191 files ok`. - `cargo clippy --locked -p victory-gpu --all-targets -- -D warnings` (default and `--all-features`): clean. - RTX 5090 + `VICTORY_D3D12_DEBUG=1`: `watch::` **16 passed, 0 failed** (including `free_memory_is_not_tracked` at `watch.rs:1049`). - WARP + `--features diagnostics` + `VICTORY_D3D12_DEBUG=1`: `watch::` **16 passed, 0 failed**. - Additional probe on both RTX 5090 and WARP verifying: (1) a 128 KiB `MEM_FREE` range returns `None` from `track_copy`, (2) a mixed `[MEM_RESERVE 64 KiB | MEM_FREE 64 KiB]` range tracks page 0 and puts page 1 in `untracked` without ever inserting page 1 into `g.protected`, (3) committing plain `PAGE_READWRITE` memory at that formerly free page 1 and writing to it while holding `guards()` completes with no fault or deadlock, and (4) a write-watched pool remains 100% tracked with zero untracked bytes.
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/1849/head:github-bot/gh-1849'
git switch 'github-bot/gh-1849'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1849'
git switch 'github-bot/gh-1849'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1849'
git switch 'github-bot/gh-1849'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1849'
git switch 'main'
git merge --squash 'github-bot/gh-1849'
git switch 'main'
git merge --ff-only 'github-bot/gh-1849'
git switch 'main'
git merge 'github-bot/gh-1849'
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!1849
No description provided.