shader: let the ray structure builder run on 32-lane GPUs (NVIDIA) #35
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/DexNom--VIctory!35
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-35"
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?
@pr0vId3nce on GitHub · 2026-11-25 20:03 UTC · original
pr0vId3nce:builder-32-lane→main· +507 −58 · 7 files · 4 commits · open--rtcannot start the structure builder on a card whose waves are 32 lanes (the block reported in #14 and #15): five of its 52 programs get no host pipeline there, and its stages run all or none. With this branch all 52 do on an RTX 4080, and in game the builder runs on that card: a ten-minute--rtrun held to its time limit with no exception.What stopped it (RTX 4080,
host wave lanes min=32 max=32):a first-lane read where not every lane runs(39321a95223001ed,77360df21e12ea43,9fc111d3be79364fin the runtime's log; the 512-thread prefix-sum passes). They fetch a running total withv_readfirstlaneinside a loop; the total is the same in every lane of the console wave, but the proof of that (lane_uniform) did not see through a write under a lane guard, the wave numbertid >> 6, an LDS read or a loop phi.host pipeline refused … The parameter is incorrect.lower_with_thread_limitlets lanes past the count return at once and, for that, keeps the program one 64-lane wave, which a 32-lane card does not take.The change.
emit/uniform.rs(new;lane_uniformmoved out oflower.rs, which is 228 bytes under the 512 KiB policy limit onmainand gets 2.3 KB back): the proof now also takes guarded writes over values already alike,tid >> 6in groups whose x size is a multiple of 64,ds_read_b32at an address alike in the wave, and phis whose predecessors are entered by all arriving lanes or none. This is the proof of fxceless/victory-fork PR #156 by sedzz with ryotdev's correction and test; I only moved it. It keeps that PR's marked shortcut: an LDS read is taken to see what the other host wave's read of the same instruction sees (the scan programs read after a barrier).spill::thread_limited(new), used when the host's waves are 32 lanes: a compute program with a spilled user-data table gets the dispatch's thread count as one more parameter (the existingUSER_DISPATCH_THREADS_Xword, set by the host as it is today) and seven GFX10 instructions ahead of its code that AND its EXEC with "thread number < count". That is what the hardware's launch leaves in EXEC, so the program's own lane count, saved EXECs and scans that turn every lane on behave as on the console while the wave runs as two host waves that exchange their halves and every thread stays. On such a host this covers every builder program dispatched by thread count, not only the two that the early exit picks by digest; for a dispatch of whole groups the word is 0 and EXEC is left alone. Hosts with 64-lane waves keep the early exit unchanged; nothing invictory-gpuchanges.The cause (DispatchX's flag 0x20 counts threads) is Yorivel's finding in fxceless/victory-fork issue #16; PR #646 there (mynzjerko) has a predicated form for 32-lane hosts. The instruction-prologue form here is my own.
Relation to #22 (from reading its diff; I have not run it yet). #22 gives the two rehydration kernels a 32-lane form, which is point 2 above done another way. It does not touch the three prefix-sum programs of point 1, and with those untranslated the builder still stays off on a 32-lane card. In the shared half the two differ like this:
s_or_saveexec_b64 -1, as the console compiler's wave totals and prefix sums do) they compute as on the console.Whether that difference shows in the builder I have not measured. #22 on top of the first two commits here is queued on the same card (its card test, the test below in its form, the builder list, in game), and I will post the comparison in #22. If #22 is preferred for point 2, the first two commits stand alone: they merge cleanly with it. The whole branch conflicts with #22 only where both append tests to
wave64_tests.rs.Tests (RTX 4080, driver 32.0.16.1088, Windows 11 26200; on
2e01ab4).emit::uniform::tests::a_guarded_uniform_write_can_keep_different_values_in_each_lane(no device) fails on the first commit (old and new values are uniform) and passes on the second.scans_in_a_partly_launched_group_count_the_launched_lanes_onlyfails on the third commit (the stub:the count's entry code is there) and passes on the fourth on the card: two groups of 64, counts 70, 100, 33, 1 and none, the console compiler's wave total and prefix sum with every lane turned on; all 256 dwords right, host waves of 32.victory translate --validate --pipelines XboxBvhBuilder.dllwithVICTORY_HOST_MAX_WAVE=32:52 emitted of 52 compute programs; 52 validated, 52 pipelines. (On the previous base921d8d3,maingave 49 emitted, 49 validated, 47 pipelines, and the first fix alone 52 validated, 50 pipelines.)cargo test --no-fail-fast -p victory-shader: 239 passed, 0 failed, 4 ignored (the two new tests among them).cargo test --no-fail-fast -p victory-gpu(this branch does not touch the crate): 188 passed, 0 failed, 3 ignored.cargo xtask policypasses on every commit (196 files).cargo clippy --workspace --all-targets --locked -- -D warnings, and the same with--all-features: clean. The registry testsource_tests::every_shader_source_is_classified_by_pathpasses on every commit (the new file is listed).2e01ab4(the same four commits on921d8d3; the rebase had two one-line conflicts, the source list and one call), the scan test and the shader suite also ran on a Ryzen 9 7900X's iGPU (gfx1036, wave lanes 32..64), chosen with a local test-only patch that is not in this branch: the test passed in the 32-lane form, the suite gave 238 passed, 0 failed, 4 ignored, and at the iGPU's own 64 lanesmainand the branch listed the same 52 builder pipelines.In game (RTX 4080, Ryzen 9 7900X, 32 GB RAM; this branch on
2e01ab4;VICTORY_BVH_BUILDER=1 VICTORY_BVH_QUARANTINE=0 VICTORY_ACTIVATE_RAYS=1 VICTORY_RT_RESOLVE=1, a checkpoint that opens with a cutscene and ends in a room with a window):the ray-tracing structure builder runs: all of its programs have host pipelines pipelines=5381 s in, then 608 s to the time limit: no exception, no device loss, no memory stop. About 170 world frames, 2.0 to 7.6 s each, median 2.8 s. Peak commit 45.1 GB.shaders touched pages that had no copywarnings over the run. That is where the frame time is, not in the builder's programs.--rt; in the room the walls, the posters and the character's back are lit, with no tiles and no wash. I do not have a default-switches run of this same build to set beside it yet (it is queued, and I will add the pair as a comment). Against a default run of the previous base the--rtframe of the room is a little brighter in the shade (pixels under 16 of 255: 2.7% against 6.3%), which is not a like-for-like comparison.mainthe--rtswitches leave the builder off on this card (the three programs above are logged as not translating).921d8d3the same commits started the builder too, but frames took 9 to 14 s and my runner's memory guard stopped both runs within four minutes;b8ff22eonmainis what changed that.Not tested: a 64-lane host in game (the iGPU ran only the card tests and the offline list);
--rtbeyond ten minutes or in another scene; #22 (above).No game data: counts, hashes and log lines only.
AI-assisted (Claude Code); measured on my machine.
🤖 Generated with Claude Code
A dispatch that counts threads (DispatchX with its thread-count flag) starts its last group with only the first lanes in EXEC. A 64-lane program with a spilled user-data table takes the console compiler's wave total and prefix sum, which turn every lane on and mask by the saved EXEC, and stores both per thread; two groups of 64, counts 70, 100, 33, 1 and none. The lanes past the count must count as zero and store nothing, with the console wave run as two host waves that exchange their halves. Fails: spill::thread_limited, which is to mask EXEC by the count ahead of the program, is a stub ("the count's entry code is there"). Co-Authored-By: Claude Fable 5.2 <[email protected]>The structure builder's two passes over shipped structures are dispatched by thread count, and lower_with_thread_limit lets the lanes past the count leave at once. That needs the program as one 64-lane wave: a card whose waves are 32 lanes refuses such a pipeline ("The parameter is incorrect"), so two of the builder's 52 stages had none and the builder stayed off. On a host of 32-lane waves a compute program with a spilled user-data table now gets the count as one more parameter (USER_DISPATCH_THREADS_X, as the host already sets it) and seven instructions in front that AND its EXEC with "thread number < count" (spill::thread_limited), which is what the hardware's launch leaves there. The title's code runs unchanged behind them in the form the translator has for such a host: two host waves that exchange their halves, every thread staying. Hosts of 64-lane waves keep the early exit. XboxBvhBuilder.dll as a host of 32-lane waves on an RTX 4080: 52 emitted, 52 validated, 52 pipelines (was 50 pipelines). Co-Authored-By: Claude Fable 5.2 <[email protected]>@pr0vId3nce on GitHub · 2026-11-25 20:22 UTC · original
Two follow-ups, both on the same RTX 4080 (driver 32.0.16.1088,
host wave lanes min=32 max=32),main2e01ab4.#22 against this branch.
VICTORY_HOST_MAX_WAVE=32,victory translate --validate --pipelines XboxBvhBuilder.dll:92897d2)a first-lane read where not every lane runsprograms remain, so the builder stays off.--rt:the ray-tracing structure builder runs: all of its programs have host pipelines pipelines=5387 s in, no exception, about 100 world frames at a median of 2.8 s (this branch: 2.8 s). It ended at 420 s on my runner's memory guard, which watches the whole PC (92 GB committed with other work running; the process itself peaked at 45.4 GB, this branch's run at 45.1 GB), so not a fault of #22. It got to the same room shot, and the part that default switches leave black is lit there as it is with this branch.So either works for the two kernels; what only this branch has is the first two commits. If #22 goes in, I can cut this PR down to those two.
The picture, default switches against
--rt, same build (this branch, the same checkpoint and keys, the last frame of each ten-minute run; both end in the same static shot of a room with a window):--rt: the run in the description. The bunk and the wall behind it are lit warm from the window side, with what hangs on the wall readable; the character's back and the left wall are brighter. The view through the window is the same in both. No tiles, no wash.--rt; right of the window 98.8% against 4.8%; the character's back 19.0% against 5.8%.Judged by eye and by those counts against the default renderer on this card; I have no console reference.
AI-assisted (Claude Code); measured on my machine. No game data.
@Ashley123477 on GitHub · 2026-11-25 20:43 UTC · original
RTX 4090, driver 621.40, i9-14900K, 64 GB, Windows 11 26200; this branch at
46fa699with the four --rt env vars (VICTORY_BVH_BUILDER=1 VICTORY_BVH_QUARANTINE=0 VICTORY_ACTIVATE_RAYS=1 VICTORY_RT_RESOLVE=1), TdrDelay=30.Result: into the world, 12 min 43 s, no device loss. Started at ~11.5 s/frame (GPU wait 2.2 s, CPU prep 1.7 s, copy-back 2.2 s, 0 dropped) and reached ~2.7 s/frame at the end (948 draws/frame, GPU 27% busy, RAM ~23 GB). Characters and sky/water render and are lit; near ground/terrain is black.
How it ended: a title null write at
victory-image+0x23cf683(frames+0x2215c35/+0x2215eca), the same address and registers I get on upstream builds without --rt.rcx 0xd0024c348andr8–r11are identical across four different builds (upstream #1763, DexNom main, upstream #2628+#2626, this branch with --rt). The title's Breakpad report showed memory.load 88%, about 8 GB free, about 8.6 GB commit free.The title's own crash context (
T:\victory-*.crash.log) for two of these runs (upstream #2628+#2626 at 4:42, and this branch with --rt at 12:43) shows the same state both times:That's at different running times (4:42 vs 12:43), frames (9358 vs 6194) and positions. It matches the "3/3 crashes in the fbk_stry000_FBK_STRY000_INTRO Prestream" reported in Marvisak/VIctory#71. The title's physical memory and pool are ~95% used with nothing unused in both, so the
+0x23cf683null write may be a failed allocation during the intro's prestream rather than a GPU or --rt problem.No game data: counts, hashes and log lines only. AI-assisted (Claude).
@Artking175 on GitHub · 2026-11-25 20:58 UTC · original
Independent RTX 2060 check of
46fa699aad9ae28397e2439b13ccc93cd93dc608against2e01ab4760db91820ef5f9a9f85761f83cd6b5d0. Windows 10, NVIDIA 531.41, Agility 1.614.1 and the same DXIL validator on both builds. Both used the #12 SDK loader overlay (999fd75) andVICTORY_HOST_MAX_WAVE=32.victory translate --jobs 1 --validate --pipelines --list XboxBvhBuilder.dll:The guarded uniform-write test passed. The partial-launch scan test also passed and explicitly reported hardware readback on 32-lane waves for limits 70, 100, 33, 1 and no limit over two groups. This was an offline check. Runtime builder activation and the prologue rendering remain untested with this PR on the RTX 2060.
@Castyan on GitHub · 2026-11-25 21:08 UTC · original
PR #35 on an RTX 5060
On 25 November 2026, I built
46fa699aad9ae28397e2439b13ccc93cd93dc608, the head of PR #35, in release mode and tested it on Windows 11 with an NVIDIA GeForce RTX 5060. D3D12 reported a minimum and maximum wave size of 32 lanes.I ran
victory.exe warm <path-to-XboxBvhBuilder.dll> --jobs 2against the same local DLL with separate empty runtime caches. The comparison build was the installed shader preload runtime at8c53afbfrom PR #47. The comparison measures the difference between those two builds.8c53afb46fa699The three baseline translation refusals were
77360df21e12ea43,39321a95223001ed, and9fc111d3be79364f. The PR build completed the first isolated warm-up in 9 seconds. All eight tests inemit::wave64_testspassed on the PR head.This run covered translation and D3D12 compute pipeline creation for the builder DLL. In-game execution, ray-tracing output, and frame time still need a gameplay run on this commit.
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.Merge
Merge the changes and update on Forgejo.