Repository navigation
shader: let the ray structure builder run on 32-lane GPUs (NVIDIA) - #35
pr0vId3nce wants to merge 4 commits into
Conversation
…ave number and from LDS lane_uniform moves from lower.rs into emit/uniform.rs unchanged (lower.rs is 350 bytes under the 512 KiB policy limit), with a test of what the structure builder's prefix-sum passes need on a host of 32-lane waves: a value written under a lane guard over a value that was alike already, the wave number (tid >> 6) and an LDS read count as alike in the wave; over a value that differs by lane they do not. The test is ryotdev's, from fxceless/victory-fork PR Marvisak#156. Fails: the proof leaves out every guarded write ("old and new values are uniform"). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ane waves On a GPU whose waves are 32 lanes (NVIDIA) three programs of the structure builder stopped on "a first-lane read where not every lane runs": the 512-thread prefix-sum passes fetch a running total with v_readfirstlane inside a loop. One stage without a host pipeline keeps the whole builder off (its stages run all or none), so there was no ray tracing on such a card. The lane-uniformity proof now also takes the wave number (tid >> 6), an LDS read at an address alike in the wave, and values joined by a phi where every predecessor is entered by all arriving lanes or none. It is the proof of fxceless/victory-fork PR Marvisak#156 by sedzz, with ryotdev's correction for writes under a lane guard. As a host of 32-lane waves, XboxBvhBuilder.dll: 52 of 52 programs emitted (was 49). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…aves
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 <noreply@anthropic.com>
…masks EXEC ahead of the program
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 <noreply@anthropic.com>
|
Two follow-ups, both on the same RTX 4080 (driver 32.0.16.1088, #22 against 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
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. |
|
RTX 4090, driver 621.40, i9-14900K, 64 GB, Windows 11 26200; this branch at 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 The title's own crash context ( 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#71. The title's physical memory and pool are ~95% used with nothing unused in both, so the No game data: counts, hashes and log lines only. AI-assisted (Claude). |
|
Independent RTX 2060 check of
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. |
PR #35 on an RTX 5060On 25 November 2026, I built I ran
The three baseline translation refusals were 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. |
--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 Shaders: lower v_mul_hi_u32_u24 and v_mul_hi_i32_i24 Marvisak/VIctory#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 Marvisak#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