perf(victory-gpu): direct BVH arena staging, partial updates, and fence-safe reclamation #477
No reviewers
Labels
No labels
accessibility
bloqué : binaire console
bug
chargeur
console-dll
cpu
documentation
duplicate
enhancement
good first issue
gpu
help wanted
invalid
performance
question
runtime-gdk
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LooperSalty--AnyXboxX!477
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-477"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@mauroalvare on GitHub · 2026-11-27 01:33 UTC · original
mauroalvare:rt/bvh/arena-direct-upload-residency→main· +1375 −109 · 4 files · 4 commits · openChange
Synthetic verification
The fixture builds box and triangle nodes from source and compares the translated RDNA 2 ray instruction against
victory_shader::bvh::intersectbit for bit. It checks the old and new ray results after a move, the miss after removal, and both sets of results across consecutive asynchronous submissions. A queue fence holds the first submission until after the CPU removes its BVH.b62053freturns[0, 0, 0, 0]for a late-streamed box whose expected child is48, withVICTORY_REFRESH_FRONT=1andVICTORY_JOIN_PARTS=8.VICTORY_MEMORY_CARD_MB=0, the single-buffer fallback on the earlier PR revision returns a miss from the first submission. It should still hit child64. The ordered shared-memory copy ina58deb9passes this check on RTX and WARP.memory::tests passed with the 0 MiB limit on both adapters (4 passed, 1 ignored on each). The lifetime fixture also passed with the 4096 MiB limit on both and with the 16 MiB limit on RTX.cargo run --offline --locked --quiet --package xtask -- policyfromthird_party/victoryreported 290 files OK.Sustained benchmark
Release with diagnostics on RTX 5070 Ti, driver 621.40. Both builds used
VICTORY_REFRESH_FRONT=0andVICTORY_JOIN_PARTS=1for the timed comparison. Baseb62053fcontains the same test-only fixture and submission helpers. Heada58deb9includes that main revision. One warm-up run per build preceded the order base/head/head/base. Each run used 20 warm-up frames and 120 measured frames per scene and checked all measured frames against the CPU oracle. The static scene streams 128 meshes (16 MiB). The dynamic scene moves 16 meshes each frame and replaces a 256 KiB packed BVH every eighth frame.b62053fa58deb9A second pair with a 0 MiB local BVH limit and the same settings measured dynamic p50/p95 of 0.332/0.523 ms on main and 0.181/0.343 ms on the PR. Process private commit grew by 590.1 vs 348.3 MiB. Both tracked 0 MiB of local BVH VRAM.
From the repository root, set the same environment on both builds and run the benchmark.
For the baseline overlay, copy the PR's
memory_tests.rsand the#[cfg(test)]hooks inmemory.rsandhost.rs. Omit the two inspections of the PR's retirement queue from the lifetime test when compiling on main. The benchmark code is the same on both builds.For the lifetime regression, set
VICTORY_REFRESH_FRONT=1,VICTORY_JOIN_PARTS=8, andVICTORY_MEMORY_CARD_MB=0and run the exact testmemory::gpu_tests::synthetic_bvh_static_dynamic_move_remove_and_lifetime_on_gpuwith--nocapture --test-threads=1. SetVICTORY_D3D12_WARP=1with diagnostics for the WARP run.In-game validation remaining
Measure world-streaming frame times and peak residency, and check for lighting flicker with the title's builder active. Compacted-size readback and overlapping dynamic allocations remain open as documented in the ray-tracing notes.
This pull request was prepared with AI assistance.
@mauroalvare on GitHub · 2026-11-27 01:40 UTC · original
Independent two-build check on RTX 5070 Ti, driver 621.40. I used release with
--features diagnostics,VICTORY_REFRESH_FRONT=0, andVICTORY_JOIN_PARTS=1in both builds. The base wasa40ed684341fbd2cc6d27c171af9ae27bbc56018(BVH code matches4340aac1a494b9649c00e0e1ad2c6fbe6ea00e80) with the shared benchmark and test-only hooks. The head wasb30bd612c9486e7825fd948f9cc41e2ed3ddd7c2. All four base/head/head/base runs passed the frame oracle at 120 samples per mode.Initial upload was 80.0 → 16.0 MiB. Private commit growth fell from 590.0–607.3 MiB to 348.9–362.7 MiB, with the same 144 MiB of tracked BVH VRAM. That host figure is the before/after
PrivateUsagedelta.With
VICTORY_REFRESH_FRONT=1andVICTORY_JOIN_PARTS=8, the lifetime/movement test passed on the RTX and on WARP with--features diagnosticsandVICTORY_D3D12_WARP=1. The diagnostic run printedMicrosoft Basic Render Driverandcard_memory=true, so it exercised the GPU fixture. The WARP selector requires the diagnostics feature.For the table I used nearest-rank p95 in both test overlays. In the committed
stats_summary,v[v.len() * 95 / 100]selects the 115th of 120 samples. The nearest-rank index is(95 * v.len()).div_ceil(100) - 1, which selects the 114th sample.Reproduction files in the local registry are
pr477-base-fixture.rs(copy tosrc/memory_tests.rs),pr477-base-test-hooks.patch,pr477-head-percentiles.patch, and thepr477-bvh-{base,head}-{a,b}logs.@mauroalvare on GitHub · 2026-11-27 02:15 UTC · original
Independent integration check on RTX 5070 Ti (driver 621.40), Windows x64, release diagnostics. The same queue-fenced test passed with a 4096 MiB local limit on both integrated revisions. At a 0 MiB limit, the previous stack
8e0f6d9ce7e693bf9745f36f6c9ad73b980e8e2elost a hit that was queued before the CPU removed the BVH. Flight 1 returned fourNONEvalues where it expected child64. The integrated0de11a1d06dca2e3174ed92133d03083fcd90051, including #477 ata58deb9, passed the same forced shared-memory test and the normal-budget control. This was the exact same test implementation on each integrated revision.The warmed fixture used 128 static meshes and 16 moving meshes, with 20 warmups and 120 measured frames per scene in each process. Base (
28fd0a7, main plus #472) and the updated stack ran in ABBA order per budget. Each cell pools 240 frames. The CPU oracle matched all measured frames.The dynamic median improves by 43.1% at the normal budget and 44.5% without local BVH VRAM. Peak process working set at the normal budget was 405.6 MiB base and 260.7 MiB integrated. Both tracked 144 MiB resident BVH VRAM. With forced shared memory, peak process working set was 549.5 and 404.5 MiB and both tracked 0 MiB BVH VRAM. Static CPU prep moved from about 91 to 95–96 µs while full static frame time fell. This stack comparison does not isolate the 4–5 µs prep difference to a single change. The normal-budget integrated diagnostics suite passed 511 tests (47 ignored).
Repeat with
VICTORY_MEMORY_CARD_MB=4096for the control. Timings use the exact ignored testmemory::gpu_tests::bench_bvh_static_and_dynamic_sustained,VICTORY_REFRESH_FRONT=0, andVICTORY_JOIN_PARTS=1at both budgets. The common registry entryintegration-0de11a1/summary.jsonlists the raw sample logs and build identifiers. The same directory contains the test overlays.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.