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

Merged
Yorivel merged 1 commit from upstream-pr/88 into main 2026-11-27 20:07:59 +00:00
Yorivel commented 2026-11-27 17:50:45 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Yorivel on 2026-11-27T17:50:45Z.


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

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5530928636 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/88). Originally posted by [Yorivel](https://github.com/Yorivel) on 2026-11-27T17:50:45Z. --- 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)
Sign in to join this conversation.
No reviewers
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
trustno1-coder/VIctory-NVIDIA!88
No description provided.