Repository navigation
Conversation
…at the same address When a known packed structure gave way to another one at the same address, `land` called `gone`: the pages went back to the free list (last in, first out) and the re-insert placed them elsewhere, while the submission had already asked the write watch. The builder unpacked the new structure where the card's directory still pointed, the packed bytes went up to the new places, and rays walked them as nodes until their iteration limit. `Memory::replaced` drops the structure as `gone` does but keeps its pages where they are, so the new structure takes the same places. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
|
A note on #1161, since it is merged but off by default ( With the title's ray tracing on (
So it may be worth turning |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No issue filed: found while profiling city driving with ray tracing on.
What it changes
What was wrong. With ray tracing on, driving fast through a city made the game drop to 0.3-2 fps for 5-60 s at a time. Often it did not recover even when standing still, and on the release build it often ended in a device removal (
0x887A0005, the card hung past the TDR delay). GPU timing showed the ray walk shaders (indirect-walk) going from 2-15 ms to 340-670 ms a frame. The builder itself stayed cheap.Memory dumps (
VICTORY_MEMORY_DUMP) taken during the slowdown showed 23-36 instances of the walked top level structures pointing at bottom level structures whose arena pages still held the packed header (0x...81020006). Rays walked packed bytes as nodes until their iteration limit.A per-structure history of
Memory::landshowed the same sequence for every one of them:landsees another header and callsgone(A): A's pages go back to the free list and their directory entries become 0.Structures landing at a fresh address never broke. Only replacements at the same address did. That happens a lot when streaming in fast.
What this does. When a known packed structure gives way to another one at the same address, the new
Memory::replaceddrops it likegonedoes, but keeps its pages where they are. The new structure takes the same places, so the directory does not change and the builder unpacks where the rays later read.Works together with #1161 (merged, off by default). This fix only shows when the compacted sizes reach the title's copies (
VICTORY_BVH_SIZE_COPY=1). Without that, the copies of compacted structures are still wrong and the slowdown stays, with or without this change. Neither of the two alone stops it; together they do (numbers below).Trade-off. If the new structure is shorter than the old one, the old one's tail pages stay held with no owner until the address is reused. This is a small, bounded leak, traded for not touching the directory in the middle of a submission.
How it was tested
VICTORY_BVH_BUILDER=1,VICTORY_AMBIENT=0). The same city route at high speed by car in every run. Numbers are fps per 5 s interval, in game only.v2026.11.28.03 + #1161 cherry-picked (
VICTORY_BVH_SIZE_COPY=1):0x887A0005)v2026.11.28.03 alone (no #1161): with or without this fix, the slowdown to 0-3 fps and a device removal at speed.
A build close to v2026.11.27.9 that already has the compacted size copies, switching one thing at a time:
Diagnostics build, same place and route:
memory.rsgained Memory by address: the arenas' writes are told, the kernel is not asked about them #1062 and gpu: keep faulted pages under a budget #722 (gonenow tells the write watch about the directory entries it clears, and faulted pages are kept under a budget); the only conflict was the two new functions sitting next to each other. The driving runs above are on v2026.11.28.03 and on a build close to v2026.11.27.9,cargo teston d4b5d51; this exact rebased commit was not driven again.cargo testpassed for the crates it touches: yes,cargo test --release -p victory-gpuon main at d4b5d51 with this change: 550 passed, 0 failed. In one earlier rundescriptor::host::tests::views_off_their_elements_get_a_copy_of_their_bytesfailed once (view width 6291456 instead of 65536) and passed on the next run with no change; it does not touch title memory by address, so it looks flaky (tests sharing a pool while running in parallel?).Checked for overlap
landdrops a replaced packed structure.🤖 Generated with Claude Code