shader, gpu: port 32-lane BVH builder lowering, structure views, and GPURT node answer #403
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/403"
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?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Kikoarl on 2026-11-27T21:55:18Z.
Summary
Ports the portable 32-lane BVH builder lowering fixes, placed acceleration-structure
view_address(Location), and GPURT[u32::MAX; 4]node answer fromfxceless/victory-forkcommits17533c5,1170216,1320dfd, and9a9091d(GPL-3.0-or-later), rebased ontomain(df2daaf).VICTORY_BVH_BUILDERremains opt-in (=1, off by default).Changes
crates/victory-shader/src/emit/lower.rs,emit/wave64_tests.rs: EnablesUSER_DISPATCH_THREADS_Xguarding (partial_active,effect_guard) for spilled 1D compute programs on 32-lane waves and programs with barriers instead of returning early; refineslane_uniformdword tracking, uniformds_readchecks, andv_readfirstlane_b32masking when halves match or are guarded.crates/victory-shader/src/bvh.rs,emit/intersect.rs: Returns[u32::MAX; 4](-1per AMD GPURT) for instance and procedural BVH nodes (kinds 6 and 7), and applieseffect_guardto BVH intersection loads.crates/victory-gpu/src/descriptor/host.rs: ExtractsLocation(words 4–5) for placed as well as shader acceleration-structure views inview_address, returningNonewhen zero.main: Omits17533c5(VICTORY_WAVE_PAIRS_SPILLED,paired.rsis absent onmain) and omits9a9091dwritten-page tracking becausemainusesShadow::by_addresssync (preserving PR #88 and PR #58).Verification
Verified on Windows (
x86_64-pc-windows-msvc) againstmain(df2daaf):git diff --check main..HEAD— cleancargo test -p xtask --locked— 6 passed, 0 failed (asset policy: 287 files ok)cargo clippy -p victory-shader -p victory-gpu --all-targets --locked— exit 0, 0 warnings in changed files (mainhas pre-existing clippy warnings in untouched files)cargo test -p victory-shader --locked emit::wave64_tests— 17 passed, 0 failedcargo test -p victory-gpu --locked descriptor::— 62 passed, 0 failedImported from trustno1-coder/VIctory-NVIDIA. Originally posted by Castyan on 2026-11-27T22:20:21Z.
i'm on it for testing
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Castyan on 2026-11-27T22:30:00Z.
#388 + #403 merged on
main(df2daaf): no conflict, no new failure. Windows, RTX 5060,cargo test --workspace --no-fail-fast: 1070 passed (main 1064, the +6 are #403's new tests), 2 failed (victory-gpuindirect::tests, the same 2 onmain). The clippy error atvictory-formats/src/texture.rs:1346is onmaintoo. Not tested in game or withtranslate --list.In game (RTX 5060 8 GB, 15 GB RAM, below the README's 32 GB):
CS_CollectTriangles_Meshletstranslates and gets its host pipeline. Series S + 2x frame gen ran 11 min, then device removed (0x887A0007). Series X runs out of memory after 2-3 min (E_OUTOFMEMORY), withmaintoo (driver access violation innvwgf2umx.dll). So the crashes look like this PC's memory, not these PRs. Not a like-for-like comparison.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by CowboyBingus on 2026-11-28T07:12:46Z.
A/B in game: with this PR, 1,626 of 1,635 static structures with header
0x80020006are sound; without it, 138 of 1,332.Setup: two builds that differ only by this PR's 5 files (
git diff --statbetween the arms):8fc2254+ 2 window-focus test commits;a265798merged + 3 diagnostics commits;Each arm was one run with
VICTORY_BVH_BUILDER=1,VICTORY_BVH_CALLS,VICTORY_MEMORY_DUMP,VICTORY_MEMORY_DUMP_BUFFERS=4andVICTORY_NO_ACTIVATE=1, the same scripted key presses, and a dump of title memory (23 arenas) started at 104.3 s (A) and 104.1 s (B) after launch. Counted: static structures (packed entries last given at least 16 frames before the dump's first copy). "Sound" means every reachable node is in the dump and in bounds, no box child is of kind 6/7, and at least one triangle node is reached (walks capped at 200,000 nodes).0x800200060x81020006)Two earlier dumps, from different builds and runs, split the same way: with this PR 1,845 of 1,912 sound (2,222,662 triangle nodes); without it 140 of 1,437 (294).
This is one run per arm.
Still open with this PR (measured, not attributed to it):
🤖 Generated with Claude Code
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by ANDREANIADS on 2026-11-28T08:13:41Z.
I added a two-line regression check on
a265798that expects[u32::MAX; 4]directly for instance and procedural nodes (kinds 6 and 7), independently of the CPU reference. With the same test file on both revisions, all four D3D12 readback tests failed ondf2daafat the first kind-6 case and passed on this PR’s head using Windows WARP. The runner had no SM 6.6 hardware adapter. This check covers synthetic node readbacks only.Two-line test · Windows job with before/after results
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by eleboucher on 2026-11-28T16:45:07Z.
Measured on an RTX 4070 Ti SUPER (32-lane waves), with the title's own ray tracing (
VICTORY_RT_NATIVE=1). This is a data point for theUSER_DISPATCH_THREADS_Xpart of this PR.Without it, the gate in
counted_in_threads(!wave64 || host_max_wave() >= 64) leaves the wave64 builder stagescaa78b8cand28918b71uncounted on NVIDIA. The last group of eachDispatchXruns all 64 lanes. Those lanes store past the structure's end, ands_bcnt1_i32_b64 execreturns 64 instead of n, which moves every lane's read.With a fix for that part alone, a card dump of the ray-tracing memory read with
bvhwalkchanges like this:In the prison-cell scene at the start, the room is no longer lit evenly by rays that pass through missing walls. Light now comes only through the window.
If it helps review, the fix for that one part is a single commit on top of
main:github.com/eleboucher/VIctory-NVIDIA@ff74e1c0. It keeps the lanes past the count in the wave and outside EXEC on entry, so the two halves can still exchange through LDS.victory-shader --libpasses on the card: 295 passed. I'm not opening a separate PR, to avoid a duplicate of this one.