Shaders: stop ray traversal sooner (512) in programs with the node test #305

Open
github-bot wants to merge 6 commits from github-bot/gh-305 into main AGit
Owner

@⁠urielbeaupre on GitHub · 2026-11-27 15:08 UTC · original
urielbeaupre:nvidia-trace-loop-limit → main · +447 −14 · 7 files · 6 commits · open

Summary

With -RayTracing on an NVIDIA RTX 4070 Ti (12 GB), most of the ray-tracing cost was lanes that never finish traversal. This stops traversal loops sooner, in the programs that walk structures only.

  • Change: loops of programs that contain image_bvh*_intersect_ray now stop at 512 iterations (VICTORY_SHADER_TRACE_LOOP_LIMIT; part of the translation). Every other compute loop keeps 4,096; pixel/mesh limits are unchanged.
  • Result (Series S, -Machine 4070 -RayTracing, same unattended opening, warm caches, run twice):
limit 4,096 limit 512
Median fps over the run 12.1 13.9
Dorm room: render fps / GPU EST 11.7 / 72.8 ms 15.8 / 41.5 ms
Orange light patches in the dorm present present (same)

No difference in lighting seen between the two in the same scenes; the existing patches are there at both limits.

How it was found

  • VICTORY_GPU_TIMING=1 with VICTORY_D3D12_DRED=1 (per-command times need full DRED, not light): CS_ScreenProbes_TraceRays_RayBinning_BVH_Mixed (f22a76fcb967ee59) took 41 ms a frame, single dispatches up to 157 ms; RaytraceVBuffer (6d7fe7745ab9c6d8) 8.8 ms; everything else under 1 ms.
  • Their time follows the translator's loop limit (4,096 → 41 ms, 512 → 4.9 ms), so most lanes run until the limit stops them.
  • Not wave64 emulation: both are wave32 with no barriers (VICTORY_SHADER_CENSUS).
  • The title's own iteration cap in that program (s_cmp_le_u32 s32, s43, s32 from the constant buffer at user data 5, table byte 0x1c0, dword 0x78) reads 65,535 at run time (VICTORY_PROBE_ROOT, added here): the title counts on sound structures.
  • A VICTORY_MEMORY_DUMP walked offline: PC-built structures (0x8000, 0x8004) have thousands of nodes reached twice and children outside them; a few static ones are still packed on the card (byte for byte title memory) though a builder dispatch named them.
  • Ruled out with measurements:
    • stale compacted sizes: only 4 of 1,364 copies in 2.5 min used a size that was too small (counter added to VICTORY_BVH_TRACE);
    • missing real pages: all ~620 pages left without a copy were uncommitted addresses;
    • packed structures streaming in after the dispatch was recorded: none;
    • upload order: the late uploads go up before the lists.

The root cause of the broken PC-built structures is still open (notes added to docs/fork-ray-tracing.md under Known gaps). This limits the cost of the lanes that walk them.

Diagnostics added (diagnostics builds only)

  • VICTORY_SHADER_COMPUTE_LOOP_LIMIT=<n>: the loop limit for every compute program.
  • VICTORY_PROBE_ROOT=<hash>,<user data>[,<table byte>]: logs a program's constant buffer at its dispatches.
  • VICTORY_BVH_TRACE=1: also counts copies recorded while the size slot still held its old value, and whether the size was too small.
  • VICTORY_MEMORY_DUMP: also writes title memory laid out like the arenas (title-<n>.bin).

Tests

  • cargo test -p victory-shader --lib: 321 passed, 0 failed, 4 ignored (before rebasing onto b67e8d8).
  • cargo test -p victory-gpu --features diagnostics --lib memory: 25 passed.
  • cargo clippy -p victory-shader -p victory-gpu --features victory-gpu/diagnostics: no warnings.
  • In game: the runs above, RTX 4070 Ti 12 GB, Ryzen 9 7900X, 64 GB, driver 621.40.

🤖 Generated with Claude Code

**@⁠urielbeaupre** on GitHub · 2026-11-27 15:08 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/305) `urielbeaupre:nvidia-trace-loop-limit` → `main` · +447 −14 · 7 files · 6 commits · open ## Summary With `-RayTracing` on an NVIDIA RTX 4070 Ti (12 GB), most of the ray-tracing cost was lanes that never finish traversal. This stops traversal loops sooner, in the programs that walk structures only. - **Change:** loops of programs that contain `image_bvh*_intersect_ray` now stop at **512** iterations (`VICTORY_SHADER_TRACE_LOOP_LIMIT`; part of the translation). Every other compute loop keeps 4,096; pixel/mesh limits are unchanged. - **Result** (Series S, `-Machine 4070 -RayTracing`, same unattended opening, warm caches, run twice): | | limit 4,096 | limit 512 | |---|---|---| | Median fps over the run | 12.1 | **13.9** | | Dorm room: render fps / GPU EST | 11.7 / 72.8 ms | **15.8 / 41.5 ms** | | Orange light patches in the dorm | present | present (same) | No difference in lighting seen between the two in the same scenes; the existing patches are there at both limits. ## How it was found - `VICTORY_GPU_TIMING=1` with `VICTORY_D3D12_DRED=1` (per-command times need full DRED, not `light`): `CS_ScreenProbes_TraceRays_RayBinning_BVH_Mixed` (`f22a76fcb967ee59`) took **41 ms** a frame, single dispatches up to 157 ms; `RaytraceVBuffer` (`6d7fe7745ab9c6d8`) 8.8 ms; everything else under 1 ms. - Their time follows the translator's loop limit (4,096 → 41 ms, 512 → 4.9 ms), so most lanes run until the limit stops them. - Not wave64 emulation: both are wave32 with no barriers (`VICTORY_SHADER_CENSUS`). - The title's own iteration cap in that program (`s_cmp_le_u32 s32, s43`, `s32` from the constant buffer at user data 5, table byte `0x1c0`, dword `0x78`) reads **65,535** at run time (`VICTORY_PROBE_ROOT`, added here): the title counts on sound structures. - A `VICTORY_MEMORY_DUMP` walked offline: PC-built structures (`0x8000`, `0x8004`) have thousands of nodes reached twice and children outside them; a few static ones are still packed on the card (byte for byte title memory) though a builder dispatch named them. - **Ruled out** with measurements: - stale compacted sizes: only 4 of 1,364 copies in 2.5 min used a size that was too small (counter added to `VICTORY_BVH_TRACE`); - missing real pages: all ~620 pages left without a copy were uncommitted addresses; - packed structures streaming in after the dispatch was recorded: none; - upload order: the late uploads go up before the lists. The root cause of the broken PC-built structures is still open (notes added to `docs/fork-ray-tracing.md` under Known gaps). This limits the cost of the lanes that walk them. ## Diagnostics added (diagnostics builds only) - `VICTORY_SHADER_COMPUTE_LOOP_LIMIT=<n>`: the loop limit for every compute program. - `VICTORY_PROBE_ROOT=<hash>,<user data>[,<table byte>]`: logs a program's constant buffer at its dispatches. - `VICTORY_BVH_TRACE=1`: also counts copies recorded while the size slot still held its old value, and whether the size was too small. - `VICTORY_MEMORY_DUMP`: also writes title memory laid out like the arenas (`title-<n>.bin`). ## Tests - `cargo test -p victory-shader --lib`: 321 passed, 0 failed, 4 ignored (before rebasing onto `b67e8d8`). - `cargo test -p victory-gpu --features diagnostics --lib memory`: 25 passed. - `cargo clippy -p victory-shader -p victory-gpu --features victory-gpu/diagnostics`: no warnings. - In game: the runs above, RTX 4070 Ti 12 GB, Ryzen 9 7900X, 64 GB, driver 621.40. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
On an RTX 4070 Ti (Series S, -RayTracing) the screen probes' trace
(CS_ScreenProbes_TraceRays_RayBinning_BVH_Mixed, f22a76fcb967ee59) took
41 ms of the card's time a frame and RaytraceVBuffer (6d7fe7745ab9c6d8)
8.8 ms, and both scaled with the translator's loop limit (4.9 and 0.7 ms
at 512): lanes in structures the host got wrong go round their parent
links until the limit stops them. The title's own cap is 65,535.

Loops of programs with image_bvh*_intersect_ray now stop at 512
(VICTORY_SHADER_TRACE_LOOP_LIMIT); other compute loops keep 4,096.
Same unattended opening twice: median 12.1 -> 13.9 fps, dorm 11.7 -> 15.8
fps (GPU 72.8 -> 41.5 ms), no difference seen in the light.

Diagnostics used to find it (diagnostics builds only):
- VICTORY_SHADER_COMPUTE_LOOP_LIMIT: the limit for every compute program
- VICTORY_PROBE_ROOT: logs a program's constant buffer at its dispatches
- VICTORY_BVH_TRACE: counts copies recorded with a stale size slot
- VICTORY_MEMORY_DUMP: also writes title memory beside the arenas
docs/fork-ray-tracing.md: the findings under Known gaps.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 15:10:55 +00:00
Keep the default traversal limit at 4,096. Store both effective loop limits in the shader cache key so explicit traversal and compute settings can be compared safely.
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-27 15:26 UTC · original

@⁠urielbeaupre The 4070 Ti runs show the cost of the long traversal on that route. I updated 81bd48d to keep 4,096 as the default and key the disk cache on both loop limits. This lets VICTORY_SHADER_TRACE_LOOP_LIMIT=512 use its own translations in the same-scene comparison. The dorm artefacts are still part of the image check.

**@⁠TaynanGT** on GitHub · 2026-11-27 15:26 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/305#issuecomment-7222058598) @⁠urielbeaupre The 4070 Ti runs show the cost of the long traversal on that route. I updated `81bd48d` to keep 4,096 as the default and key the disk cache on both loop limits. This lets `VICTORY_SHADER_TRACE_LOOP_LIMIT=512` use its own translations in the same-scene comparison. The dorm artefacts are still part of the image check.
Title buffers took stores by address only once a builder dispatch had
been given them as an unordered access view; the builder also writes
structures into buffers it is given only by address, and those stores
were dropped. VICTORY_MEMORY_CLOSED_NOTES=1 (new, diagnostics) logs such
stores: about 1,000 pages of 10 title buffers (1.5-12 MiB) in two
minutes of ray tracing on an RTX 4070 Ti.

The structures built there came out with children outside them, wrong
parent links and nodes reached twice, and the trace programs went round
them until their loop limit. Every title buffer's copy now takes the
stores (VICTORY_BVH_OPEN_ALL=0: as before). At a trace loop limit of
4,096: the screen probes' trace 41.8 -> 6.0 ms a frame, RaytraceVBuffer
10.5 -> 2.8 ms; a dump's compacted structures 2,972 -> 140 children
outside them, 2,884 -> 77 wrong parent links; the same unattended
opening's median 12.1 -> 14.1 fps, its slowest quarter 8.2 -> 10.9. No
crash or device removal in four runs. The stores still go to the copies
on the card, not to title memory.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

@⁠urielbeaupre on GitHub · 2026-11-27 15:44 UTC · original

Thanks for 81bd48d. Keeping 4,096 as the default fits what I found next. I've added 8137f71 on top of it with the cause of the long traversal:

  • Title buffers took stores by address only after a builder dispatch had been given them as a UAV. The builder also writes structures into buffers it only gets by address, and those stores were dropped.
  • The new VICTORY_MEMORY_CLOSED_NOTES=1 (diagnostics) logs them: about 1,000 pages across 10 title buffers (1.5 to 12 MiB) in two minutes of ray tracing.
  • With every title buffer's copy taking the stores (new default, VICTORY_BVH_OPEN_ALL=0 restores the old behaviour), at the default 4,096 limit, RTX 4070 Ti, Series S, -RayTracing:
closed (before) open
CS_ScreenProbes_TraceRays_RayBinning_BVH_Mixed, ms/frame (median, VICTORY_GPU_TIMING) 41.8 6.0
RaytraceVBuffer, ms/frame 10.5 2.8
Compacted structures in a dump: children outside them / wrong parent links 2,972 / 2,884 140 / 77
Same unattended opening, median fps (slowest quarter) 12.1 (8.2) 14.1 (10.9)
Dorm, GPU EST 72.8 ms 46.2 ms

There was no crash or device removal in four runs. The stores still go to the copies on the card, not to title memory.

The orange light patches in the dorm look the same with the buffers open or closed, and at 512 or 4,096, so I think they're a separate issue. Still open, also in the notes: non-compacted built structures (0x8000; my offline walk may misread their layout) and an occasional static structure left packed on the card.

Tests: victory-shader lib 327 passed; victory-gpu (diagnostics) memory tests 25 passed; clippy clean on both crates.

**@⁠urielbeaupre** on GitHub · 2026-11-27 15:44 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/305#issuecomment-7222415181) Thanks for `81bd48d`. Keeping 4,096 as the default fits what I found next. I've added `8137f71` on top of it with the cause of the long traversal: - Title buffers took stores by address only after a builder dispatch had been given them as a UAV. The builder also writes structures into buffers it only gets by address, and those stores were dropped. - The new `VICTORY_MEMORY_CLOSED_NOTES=1` (diagnostics) logs them: about 1,000 pages across 10 title buffers (1.5 to 12 MiB) in two minutes of ray tracing. - With every title buffer's copy taking the stores (new default, `VICTORY_BVH_OPEN_ALL=0` restores the old behaviour), at the **default 4,096** limit, RTX 4070 Ti, Series S, `-RayTracing`: | | closed (before) | open | |---|---|---| | `CS_ScreenProbes_TraceRays_RayBinning_BVH_Mixed`, ms/frame (median, `VICTORY_GPU_TIMING`) | 41.8 | **6.0** | | `RaytraceVBuffer`, ms/frame | 10.5 | **2.8** | | Compacted structures in a dump: children outside them / wrong parent links | 2,972 / 2,884 | **140 / 77** | | Same unattended opening, median fps (slowest quarter) | 12.1 (8.2) | **14.1 (10.9)** | | Dorm, GPU EST | 72.8 ms | 46.2 ms | There was no crash or device removal in four runs. The stores still go to the copies on the card, not to title memory. The orange light patches in the dorm look the same with the buffers open or closed, and at 512 or 4,096, so I think they're a separate issue. Still open, also in the notes: non-compacted built structures (`0x8000`; my offline walk may misread their layout) and an occasional static structure left packed on the card. Tests: `victory-shader` lib 327 passed; `victory-gpu` (diagnostics) memory tests 25 passed; clippy clean on both crates.
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-27 15:54 UTC · original

@⁠urielbeaupre The drop from 41.8 to 6.0 ms at the full 4,096 limit is the result to follow. It ties the slow traversal to builder stores that were being dropped. I’d compare the same route with the buffer change alone and track VRAM and copy-back alongside the timings. The orange patches still have their own repro.

**@⁠TaynanGT** on GitHub · 2026-11-27 15:54 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/305#issuecomment-7222616788) @⁠urielbeaupre The drop from 41.8 to 6.0 ms at the full 4,096 limit is the result to follow. It ties the slow traversal to builder stores that were being dropped. I’d compare the same route with the buffer change alone and track VRAM and copy-back alongside the timings. The orange patches still have their own repro.
Author
Owner

@⁠urielbeaupre on GitHub · 2026-11-27 16:16 UTC · original

Same route (the unattended opening), -RayTracing, trace limit 4,096. The only difference between the two runs is the buffer change. Medians over the run come from the frame lines; VRAM is the "card's own: in use" line (43 and 46 samples):

VICTORY_BVH_OPEN_ALL=0 open (default)
fps (slowest quarter) 12.1 (8.2) 14.1 (10.9)
VRAM in use, median / max 8,264 / 9,051 MB 8,393 / 9,068 MB
copy-back per frame 23.9 ms, 57 MB 20.9 ms, 55 MB
copies up per frame 22.0 ms, 146 MB 24.9 ms, 144 MB
preparing total 59.7 ms 58.0 ms

VRAM is up about 130 MB at the median, and copy-back and copies are within noise.

One thing to check before you merge. In a non-RT run with the buffers open, I saw multicoloured garbage on a character's face and neck in the bar cutscene. The same moment rendered cleanly in an earlier run with the buffers closed. It may be intermittent and unrelated, but opening every title buffer also lets non-builder shaders that store by address reach those buffers. I'm running the closed/open pair on that cutscene now. I'm also preparing a narrower version that opens a buffer only when a builder dispatch names an address inside it (root views or 64-bit constants), so other shaders keep the old behaviour. I'll post both.

**@⁠urielbeaupre** on GitHub · 2026-11-27 16:16 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/305#issuecomment-7223067189) Same route (the unattended opening), `-RayTracing`, trace limit 4,096. The only difference between the two runs is the buffer change. Medians over the run come from the frame lines; VRAM is the "card's own: in use" line (43 and 46 samples): | | `VICTORY_BVH_OPEN_ALL=0` | open (default) | |---|---|---| | fps (slowest quarter) | 12.1 (8.2) | 14.1 (10.9) | | VRAM in use, median / max | 8,264 / 9,051 MB | 8,393 / 9,068 MB | | copy-back per frame | 23.9 ms, 57 MB | 20.9 ms, 55 MB | | copies up per frame | 22.0 ms, 146 MB | 24.9 ms, 144 MB | | preparing total | 59.7 ms | 58.0 ms | VRAM is up about 130 MB at the median, and copy-back and copies are within noise. One thing to check before you merge. In a non-RT run with the buffers open, I saw multicoloured garbage on a character's face and neck in the bar cutscene. The same moment rendered cleanly in an earlier run with the buffers closed. It may be intermittent and unrelated, but opening every title buffer also lets non-builder shaders that store by address reach those buffers. I'm running the closed/open pair on that cutscene now. I'm also preparing a narrower version that opens a buffer only when a builder dispatch names an address inside it (root views or 64-bit constants), so other shaders keep the old behaviour. I'll post both.
Author
Owner

@⁠urielbeaupre on GitHub · 2026-11-27 16:19 UTC · original

Follow-up on the face artefact: it isn't from this change. The same multicoloured garbage on the bar cutscene character's face and neck showed up in a run with VICTORY_BVH_OPEN_ALL=0 (buffers closed, otherwise identical, ray tracing off). It's intermittent and happens with or without the buffer change, so it has its own repro like the orange patches.

I'll still post the narrower variant (open only the title buffers a builder dispatch names) with its own timings, in case you'd rather keep other programs' stores by address closed.

**@⁠urielbeaupre** on GitHub · 2026-11-27 16:19 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/305#issuecomment-7223115274) Follow-up on the face artefact: it isn't from this change. The same multicoloured garbage on the bar cutscene character's face and neck showed up in a run with `VICTORY_BVH_OPEN_ALL=0` (buffers closed, otherwise identical, ray tracing off). It's intermittent and happens with or without the buffer change, so it has its own repro like the orange patches. I'll still post the narrower variant (open only the title buffers a builder dispatch names) with its own timings, in case you'd rather keep other programs' stores by address closed.
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-27 16:20 UTC · original

@⁠urielbeaupre The closed-buffer run confirms the face mosaic has its own repro. At 4,096, the full-buffer change adds about 130 MB of median local VRAM and takes copy-back from 23.9 to 20.9 ms in this pair. The builder-targeted variant is the next one I’d measure on that same route, including builders that pass addresses through constants.

**@⁠TaynanGT** on GitHub · 2026-11-27 16:20 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/305#issuecomment-7223154102) @⁠urielbeaupre The closed-buffer run confirms the face mosaic has its own repro. At 4,096, the full-buffer change adds about 130 MB of median local VRAM and takes copy-back from 23.9 to 20.9 ms in this pair. The builder-targeted variant is the next one I’d measure on that same route, including builders that pass addresses through constants.
Instead of every title buffer taking every program's stores by address,
a title buffer is opened when a builder dispatch names an address inside
it: a root view, a 64-bit address in two constants, or one in 256-byte
units (VICTORY_BVH_OPEN_NAMED=0: closed as before). Other programs'
stores by address keep the old rule. VICTORY_BVH_OPEN_ALL=1 keeps the
open-everything variant as a test.

With VICTORY_MEMORY_CLOSED_NOTES=1, two minutes of ray tracing dropped no
store by address (about 1,000 pages of 10 buffers closed before), and 34
buffers were opened for the builder. The screen probes' trace in the same
100 s of the unattended opening (VICTORY_GPU_TIMING, median): 14.6 ms a
frame closed, 11.2 builder-named, 12.3 all open.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

@⁠urielbeaupre on GitHub · 2026-11-27 17:05 UTC · original

e7de67f is the builder-targeted variant, now the default. A title buffer is opened when a builder dispatch names an address inside it: root views, 64-bit addresses in two constants, and 256-byte-unit constants. Other programs keep the old rule. VICTORY_BVH_OPEN_NAMED=0 restores closed buffers, and VICTORY_BVH_OPEN_ALL=1 keeps the open-everything variant as a test.

With VICTORY_MEMORY_CLOSED_NOTES=1, two minutes of ray tracing dropped no store by address. Before, about 1,000 pages across 10 buffers were dropped. 34 buffers were opened for the builder.

A correction to my earlier 41.8 → 6.0 ms. Those two numbers came from different stretches: the 41.8 is the dorm, played by hand; the 6.0 is the unattended opening. Measured side by side with the same method (unattended opening, warm-up run first, 0 pipelines being made, 100 s, VICTORY_GPU_TIMING=1, VICTORY_D3D12_DRED=1, 4,096):

CS_ScreenProbes_TraceRays_RayBinning_BVH_Mixed, ms/frame median worst dispatch
closed (OPEN_NAMED=0) 14.6 255
builder-named (default) 11.2 238
all open (OPEN_ALL=1) 12.3 431

In this window, mostly cutscenes, run-to-run variation is about as large as the differences, so it doesn't show the large effect. The dump result stands (compacted structures: 2,972 → 140 children outside them, 2,884 → 77 wrong parent links). The dorm still needs a side-by-side; I'll run the three variants for long enough to reach it and post the numbers.

Separately, on the CPU side, same method with ray tracing off: PR #284 + PR #294 merged on this branch gave a median of 20.0 fps (slowest quarter 16.2), against 16.5 and 16.9 (12.5 and 13.7) for two baseline runs. I'll post that on those PRs too.

**@⁠urielbeaupre** on GitHub · 2026-11-27 17:05 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/305#issuecomment-7224021916) `e7de67f` is the builder-targeted variant, now the default. A title buffer is opened when a builder dispatch names an address inside it: root views, 64-bit addresses in two constants, and 256-byte-unit constants. Other programs keep the old rule. `VICTORY_BVH_OPEN_NAMED=0` restores closed buffers, and `VICTORY_BVH_OPEN_ALL=1` keeps the open-everything variant as a test. With `VICTORY_MEMORY_CLOSED_NOTES=1`, two minutes of ray tracing dropped **no** store by address. Before, about 1,000 pages across 10 buffers were dropped. 34 buffers were opened for the builder. **A correction to my earlier 41.8 → 6.0 ms.** Those two numbers came from different stretches: the 41.8 is the dorm, played by hand; the 6.0 is the unattended opening. Measured side by side with the same method (unattended opening, warm-up run first, 0 pipelines being made, 100 s, `VICTORY_GPU_TIMING=1`, `VICTORY_D3D12_DRED=1`, 4,096): | `CS_ScreenProbes_TraceRays_RayBinning_BVH_Mixed`, ms/frame | median | worst dispatch | |---|---|---| | closed (`OPEN_NAMED=0`) | 14.6 | 255 | | builder-named (default) | 11.2 | 238 | | all open (`OPEN_ALL=1`) | 12.3 | 431 | In this window, mostly cutscenes, run-to-run variation is about as large as the differences, so it doesn't show the large effect. The dump result stands (compacted structures: 2,972 → 140 children outside them, 2,884 → 77 wrong parent links). The dorm still needs a side-by-side; I'll run the three variants for long enough to reach it and post the numbers. Separately, on the CPU side, same method with ray tracing off: PR #284 + PR #294 merged on this branch gave a median of 20.0 fps (slowest quarter 16.2), against 16.5 and 16.9 (12.5 and 13.7) for two baseline runs. I'll post that on those PRs too.
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-27 17:08 UTC · original

@⁠urielbeaupre The 41.8 and 6.0 ms came from different scenes, and I treated them as a pair earlier. I’ll use 14.6, 11.2 and 12.3 ms for closed, named and all-open in the matched opening at 4,096. For the dorm, keep the three modes on the same save and camera. The 34 opened buffers and zero dropped stores give us a concrete result to check again alongside local VRAM and copy-back time.

**@⁠TaynanGT** on GitHub · 2026-11-27 17:08 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/305#issuecomment-7224080235) @⁠urielbeaupre The 41.8 and 6.0 ms came from different scenes, and I treated them as a pair earlier. I’ll use 14.6, 11.2 and 12.3 ms for closed, named and all-open in the matched opening at 4,096. For the dorm, keep the three modes on the same save and camera. The 34 opened buffers and zero dropped stores give us a concrete result to check again alongside local VRAM and copy-back time.
Author
Owner

@⁠urielbeaupre on GitHub · 2026-11-27 17:22 UTC · original

These are dorm dumps for the builder-named default (e7de67f) and VICTORY_BVH_OPEN_NAMED=0, on the same save and camera: the unattended opening, idle in the dorm, VICTORY_MEMORY_DUMP taken 190 s after input starts, -RayTracing, limit 4,096. The structures the trace walks were checked offline (children walked from the 4 top levels and their instances, parent links checked against the tree):

compacted built structures (0x8004) closed builder-named
structures walked 166 354
children outside the structure 4,614 (27.8 per structure) 1,866 (5.3)
wrong parent links 4,705 (28.3) 575 (1.6)
nodes reached twice 3,020 (18.2) 4,999 (14.1)
structures with any defect 35% 34%

With the builder's stores reaching their buffers, roughly twice as many compacted structures exist, which suggests many builds never got that far when closed. Per structure, children outside them drop by 81% and wrong parent links by 94%. Nodes reached twice only drop by 22%, and a third of the structures still have some defect, so a second, smaller cause remains. Static structures left packed on the card are unchanged: 3 in each dump.

The dorm timing for the three modes on this save/camera is queued for the next window, alongside VRAM and copy-back.

**@⁠urielbeaupre** on GitHub · 2026-11-27 17:22 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/305#issuecomment-7224332277) These are dorm dumps for the builder-named default (`e7de67f`) and `VICTORY_BVH_OPEN_NAMED=0`, on the same save and camera: the unattended opening, idle in the dorm, `VICTORY_MEMORY_DUMP` taken 190 s after input starts, `-RayTracing`, limit 4,096. The structures the trace walks were checked offline (children walked from the 4 top levels and their instances, parent links checked against the tree): | compacted built structures (`0x8004`) | closed | builder-named | |---|---|---| | structures walked | 166 | 354 | | children outside the structure | 4,614 (27.8 per structure) | 1,866 (5.3) | | wrong parent links | 4,705 (28.3) | 575 (1.6) | | nodes reached twice | 3,020 (18.2) | 4,999 (14.1) | | structures with any defect | 35% | 34% | With the builder's stores reaching their buffers, roughly twice as many compacted structures exist, which suggests many builds never got that far when closed. Per structure, children outside them drop by 81% and wrong parent links by 94%. Nodes reached twice only drop by 22%, and a third of the structures still have some defect, so a second, smaller cause remains. Static structures left packed on the card are unchanged: 3 in each dump. The dorm timing for the three modes on this save/camera is queued for the next window, alongside VRAM and copy-back.
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-27 17:29 UTC · original

@⁠urielbeaupre The per-structure counts make the dorm comparison clear even though 354 structures were available with the named buffers and 166 with them closed. I’ll record 27.8 to 5.3 for out-of-range children and 28.3 to 1.6 for parent links. About a third still show a defect. Keep the timings and memory measurements tied to this same save and camera.

**@⁠TaynanGT** on GitHub · 2026-11-27 17:29 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/305#issuecomment-7224463182) @⁠urielbeaupre The per-structure counts make the dorm comparison clear even though 354 structures were available with the named buffers and 166 with them closed. I’ll record 27.8 to 5.3 for out-of-range children and 28.3 to 1.6 for parent links. About a third still show a defect. Keep the timings and memory measurements tied to this same save and camera.
Memory::place took a page of title memory into an arena at a submission
but left it marked as never taken (held.taken 0). The next bring() of
that page (the sweep, a fault, another dispatch naming it) then sent all
of title memory's bytes up again, over what the card had made of them.
Nothing the builder stores comes back to title memory, so a static
structure unpacked on the card went back to its packed bytes (header
marks 0x8102, byte for byte title memory) and stayed that way.

The page now takes the write-watch number from before the copy, as
bring() does (VICTORY_PLACE_TAKEN=0: as before). Dorm dumps on an RTX
4070 Ti (-RayTracing, the same save and camera): static structures left
packed 0, 0 and 0 with it, 3, 3, 2 and 0 without. The share of broken
compacted built structures does not change measurably (11 to 43% from
dump to dump either way).

Also VICTORY_BVH_TRACE_LINES=<n> (diagnostics): the trace's line cap
(6,000), which the opening reached before the dorm.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

@⁠urielbeaupre on GitHub · 2026-11-27 18:06 UTC · original

14c6a05 fixes the static structures left packed on the card.

Memory::place took a page into an arena at submission but left held.taken at 0. The next bring() of that page treated it as never taken and sent all of title memory's bytes up again. Title memory still holds the packed bytes, because nothing the builder stores comes back, so an unpacked structure reverted to 0x8102 and stayed that way.

The page now gets the write-watch number from before the copy, the same as bring(). VICTORY_PLACE_TAKEN=0 restores the old behaviour.

Dorm dumps, same save and camera, builder-named default:

static structures left packed
VICTORY_PLACE_TAKEN=0 (4 dumps) 3, 3, 2, 0
on (3 dumps) 0, 0, 0

It does not measurably change the share of broken compacted built structures: 11 to 43% from dump to dump either way, so that has another cause. For those, a BVH-trace pairing of compacted structures with their copy sources found that 11 of the 16 broken ones with a source still in the dump were copied from a sound source, so the damage happens at or after the copy. I don't expect a measurable frame-time change from this one and haven't timed it.

**@⁠urielbeaupre** on GitHub · 2026-11-27 18:06 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/305#issuecomment-7225132873) `14c6a05` fixes the static structures left packed on the card. `Memory::place` took a page into an arena at submission but left `held.taken` at 0. The next `bring()` of that page treated it as never taken and sent all of title memory's bytes up again. Title memory still holds the packed bytes, because nothing the builder stores comes back, so an unpacked structure reverted to `0x8102` and stayed that way. The page now gets the write-watch number from before the copy, the same as `bring()`. `VICTORY_PLACE_TAKEN=0` restores the old behaviour. Dorm dumps, same save and camera, builder-named default: | | static structures left packed | |---|---| | `VICTORY_PLACE_TAKEN=0` (4 dumps) | 3, 3, 2, 0 | | on (3 dumps) | 0, 0, 0 | It does **not** measurably change the share of broken compacted built structures: 11 to 43% from dump to dump either way, so that has another cause. For those, a BVH-trace pairing of compacted structures with their copy sources found that 11 of the 16 broken ones with a source still in the dump were copied from a sound source, so the damage happens at or after the copy. I don't expect a measurable frame-time change from this one and haven't timed it.
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-27 18:12 UTC · original

@⁠urielbeaupre All three captures with the stamp enabled had zero static structures left packed. I pulled the page-stamp change into #342 on current main. The isolated test reproduced the overwrite, preserved the GPU update, and still copied a later CPU write. The compacted structures remain a separate copy-path question.

**@⁠TaynanGT** on GitHub · 2026-11-27 18:12 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/305#issuecomment-7225239126) @⁠urielbeaupre All three captures with the stamp enabled had zero static structures left packed. I pulled the page-stamp change into #342 on current main. The isolated test reproduced the overwrite, preserved the GPU update, and still copied a later CPU write. The compacted structures remain a separate copy-path question.
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/memory.rs
  • crates/victory-shader/src/lib.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/305/head:github-bot/gh-305'
git switch 'github-bot/gh-305'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-305'
git switch 'github-bot/gh-305'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-305'
git switch 'github-bot/gh-305'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-305'
git switch 'main'
git merge --squash 'github-bot/gh-305'
git switch 'main'
git merge --ff-only 'github-bot/gh-305'
git switch 'main'
git merge 'github-bot/gh-305'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.