Ray tracing: no arena storm when the low range is full (the 30 s watchdog crash); reserve the arenas' room at the start #88

Manually merged
github merged 1 commit from github-bot/gh-88 into main 2026-11-27 20:10:01 +00:00 AGit
Owner

@⁠Yorivel on GitHub · 2026-11-27 17:50 UTC · original
Yorivel:fix/rt-arena-room → main · +118 −1 · 3 files · 1 commits · merged 2026-11-27 20:07 UTC

With the structure builder on (VICTORY_BVH_BUILDER=1), ray tracing ended 1-3 minutes in at +0x23cf683 (write to 0x0). That address is the title's own hang watchdog: it fires when no frame has been presented for 30 s. Not a bad pointer.

Cause: an arena storm.

  • memory::ready asks for another arena (Memory::another, 64 MiB through upload::reserve) at every build dispatch while the spares are low.
  • Once the low range [4 GiB, 2^37) had no 64 MiB gap left (19 arenas on this PC), nothing remembered the failure.
  • Every one of the thousands of build dispatches a frame searched the address range again, under the MEMORY lock.
  • A profile showed the recording threads ~70 % in the kernel under VirtualAlloc2, frames of 7-32 s, then the watchdog.

Changes

  • Memory::another: after a failure, no other arena is tried before the next frame. The reason is logged (no room, or its copy could not be made), and a reservation whose copy could not be made is released.
  • upload::reserve_early, called at host creation: when the builder is on, 50 reservations of 64 MiB (VICTORY_LOW_EARLY_MB, 3200; 0 off) are made in the low range with write watch, before the title fills it. An arena commits one of them before it looks for room. They are separate pieces because, as one 3.2 GB reservation, the submissions' write-watch askings walked all arenas in single runs, about 2 ms a frame more.

Measured (RTX 4090, prison area, ray tracing on, frame generation off, 30 fps cap)

before after
arenas stuck at 19 28
pages a frame read as zeros (no copy), settled ~280-650 ~18
watchdog end 1-3 minutes in none in several sessions
steady fps after the first minute n/a 22-28

The first minute or two of a new area still stutters (waits for flights while the builder works). See the comments on #57 for what we found there.

Related, not in this PR: victory warm without VICTORY_BVH_BUILDER=1 skips the CS_RaytracingResolve pipelines (make.rs's leave-out), yet writes them into warm-done.txt, so later warms never make them. With VICTORY_BVH_BUILDER=1 victory warm --again --used the start-up RT pipeline builds (~670 "being made") went away. A separate small PR follows for that.

Testing

  • cargo check on this branch (rebased on 29d8dbf).
  • Played on the 959dcaf base with these two files, in several sessions of 3-10 minutes.
  • One unrelated-looking crash (+0xc18d1a, read 0x159c) was seen once in those sessions and did not repeat.

🤖 Generated with Claude Code

**@⁠Yorivel** on GitHub · 2026-11-27 17:50 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/88) `Yorivel:fix/rt-arena-room` → `main` · +118 −1 · 3 files · 1 commits · merged 2026-11-27 20:07 UTC With the structure builder on (`VICTORY_BVH_BUILDER=1`), ray tracing ended 1-3 minutes in at `+0x23cf683` (write to 0x0). That address is **the title's own hang watchdog**: it fires when no frame has been presented for 30 s. Not a bad pointer. **Cause: an arena storm.** - `memory::ready` asks for another arena (`Memory::another`, 64 MiB through `upload::reserve`) at every build dispatch while the spares are low. - Once the low range [4 GiB, 2^37) had no 64 MiB gap left (19 arenas on this PC), nothing remembered the failure. - Every one of the thousands of build dispatches a frame searched the address range again, under the `MEMORY` lock. - A profile showed the recording threads ~70 % in the kernel under `VirtualAlloc2`, frames of 7-32 s, then the watchdog. **Changes** - `Memory::another`: after a failure, no other arena is tried before the next frame. The reason is logged (no room, or its copy could not be made), and a reservation whose copy could not be made is released. - `upload::reserve_early`, called at host creation: when the builder is on, 50 reservations of 64 MiB (`VICTORY_LOW_EARLY_MB`, 3200; `0` off) are made in the low range with write watch, before the title fills it. An arena commits one of them before it looks for room. They are separate pieces because, as one 3.2 GB reservation, the submissions' write-watch askings walked all arenas in single runs, about 2 ms a frame more. **Measured** (RTX 4090, prison area, ray tracing on, frame generation off, 30 fps cap) | | before | after | |---|---|---| | arenas | stuck at 19 | 28 | | pages a frame read as zeros (no copy), settled | ~280-650 | ~18 | | watchdog end | 1-3 minutes in | none in several sessions | | steady fps after the first minute | n/a | 22-28 | The first minute or two of a new area still stutters (waits for flights while the builder works). See the comments on #57 for what we found there. **Related, not in this PR:** `victory warm` without `VICTORY_BVH_BUILDER=1` skips the `CS_RaytracingResolve` pipelines (`make.rs`'s leave-out), yet writes them into `warm-done.txt`, so later warms never make them. With `VICTORY_BVH_BUILDER=1 victory warm --again --used` the start-up RT pipeline builds (~670 "being made") went away. A separate small PR follows for that. **Testing** - `cargo check` on this branch (rebased on `29d8dbf`). - Played on the `959dcaf` base with these two files, in several sessions of 3-10 minutes. - One unrelated-looking crash (`+0xc18d1a`, read 0x159c) was seen once in those sessions and did not repeat. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
With the structure builder on (VICTORY_BVH_BUILDER=1), memory::ready asks
for another arena at every build dispatch while the spares are low. Once
upload::reserve could find no 64 MiB gap in [4 GiB, 2^37), nothing
remembered it: every one of thousands of dispatches a frame searched the
address range again under the MEMORY lock (the recording threads ~70 % in
the kernel under VirtualAlloc2), frames took 7 to 32 s, and the title's
own hang watchdog (the store to 0 at +0x23cf683) ended the run.

- Memory::another: after a failure, none is tried again before the next
  frame; the reason is logged (no room, or its copy could not be made),
  and a reservation whose copy could not be made is given back.
- upload::reserve_early, at host creation: 50 reservations of 64 MiB in
  the low range, with write watch, when the builder is on
  (VICTORY_LOW_EARLY_MB, 3200; 0 off). An arena commits one of them before
  looking for room. Separate pieces, not one 3.2 GB reservation: as one,
  the submissions' write-watch askings walked across all arenas in single
  runs, about 2 ms a frame more.

RTX 4090, prison area, ray tracing on, frame generation off:
- before: stuck at 19 arenas, ~280-650 pages a frame read as zeros,
  watchdog crash 1-3 minutes in;
- after: 28 arenas, ~18 pages a frame once settled, no watchdog crash,
  22-28 fps (30 cap) after the first minute.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 17:59:54 +00:00
github manually merged commit c5f7528bbf into main 2026-11-27 20:10:01 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.