Skip to content

GPU: a fifth root constant is not a root view's offset (BVH build kernels stay dropped) - #10

Merged
wbkepler merged 3 commits into
mainfrom
gpu/root-view-without-copy
Nov 25, 2026
Merged

wbkepler merged 3 commits into
mainfrom
gpu/root-view-without-copy

Conversation

@wbkepler

@wbkepler wbkepler commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Cause

State::bind (crates/victory-gpu/src/draw.rs) treated any user-data entry with dword == ROOT_VIEW_OFFSET (4) as a root view's byte offset, whatever its root parameter was. The arm was missing the u.root == Descriptor check that is_root_view already has. A root constants parameter has a dword 4 as well, so every program that reads a fifth root constant looked up its constants' slot, found Root::Constants there instead of Root::View, and returned false. Each draw or dispatch of such a program was dropped, and no reason was recorded (~190 of the ~265 "dropped" per world frame had no reason).

Fix

  • is_root_view_offset(u) = u.root == Descriptor && u.dword == ROOT_VIEW_OFFSET, and the offset arm uses it. Dword 4 of root constants now goes to user_value like the other constants.
  • Every path that drops a draw for want of a root view now gives a reason, counted with the other drop reasons (title set no root view, no host copy at the address, past 4 GiB of the copy, no host view heap, no dynamic slots), plus a rate-limited warning with slot, kind, address and shadow::about(address).
  • Kept dropped, now with a reason: compute programs that use title memory and read a fifth root constant (the console ray-tracing library's BVH build kernels). Run, they make a later refit dispatch of the same library climb node links without end: DEVICE_HUNG at world load (+54 s). DRED put the stop in a segment of 12 refit dispatches (bottom-up climb with per-node atomic counters); skipping half of the newly running kernels, and then one more (the LDS treelet kernel), still hung, so the bad data comes from one of the four remaining ones (two TLAS instance kernels, the scene-bounds kernel, the triangle-leaf kernel) or from their combination. Reason in the drop stats: "title-memory compute reading a fifth root constant". Every other program reading a fifth root constant now runs.
  • Tests: draw::tests::root_constants_are_not_root_views (incl. reads_fifth_constant).

Gate (after merging main 5f9d059): clippy -D warnings (victory-gpu, victory+diagnostics), cargo test -p victory-gpu -- --test-threads=1 (187 passed, 5 ignored), cargo xtask policy. No translator change.

Measured (RTX 5090, diag build, capped pacing, cache of base 1104646, GPU upload + lazy copy-back on), 240 s

reference (fork main + lazy copy-back) this branch
stability stable stable 240 s, no device removal
world 325–355 ms/frame, GPU 84–93 ms 300–333 ms/frame, GPU 75–85 ms
dropped/frame ~265 + 18 indirect, ~190 without a reason ~265 + 18 indirect, 235 of them "title-memory compute reading a fifth root constant", the rest the known untranslated programs

So in this title every program the bug hid is a BVH build kernel: the branch changes no frames, but the drops now say why, and the root-constants mapping is right for anything else. Captures at world+30/60/120 look as on main (dark cutscene interior, same lighting).

Next

Make the BVH build kernels run: find which of the four remaining kernels writes the links the refit loops on (dump parent links/counters before the refit, or skip them one at a time), fix its translation, then lift the drop.

🤖 Generated with Claude Code

wbkepler and others added 3 commits November 25, 2026 18:07
A user-data entry was taken for a root view's offset by its dword (4)
alone, whatever its root parameter was. Root constants have a dword 4
too: a program reading its fifth root constant found no root view in
its constants' slot, and every draw or dispatch of it was dropped
without a reason. Only a root descriptor's entry takes the offset now.

The paths that drop a draw for want of a root view now give a reason
(counted with the other drop reasons) and a rate-limited warning with
the root parameter, the kind, the address and what is known of it.

Live run on the RTX 5090: the BVH builder kernels this dropped now run
at world load, and a later bottom-up refit pass in the same list then
runs for over 5 s and the device is removed (DEVICE_HUNG). That refit
already ran before this change; it is the newly built data it walks
that makes it run long.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With dword 4 of root constants no longer taken for a root view's offset,
the console ray-tracing library's BVH build kernels (title-memory compute
programs reading a fifth root constant) start to run, and a later refit
dispatch of the same library then climbs node links without end: device
hung at world load (three live runs, also with half of the newly running
kernels skipped). Until that is understood, such programs stay dropped as
before, now with a logged reason; every other program reading a fifth
root constant runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wbkepler wbkepler changed the title GPU: a fifth root constant is not a root view's offset GPU: a fifth root constant is not a root view's offset (BVH build kernels stay dropped) Nov 25, 2026
@wbkepler
wbkepler marked this pull request as ready for review November 25, 2026 17:48
@wbkepler
wbkepler merged commit 9713e8f into main Nov 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant