Shaders: the ray-tracing structure builder's three wave64 programs on 32-lane hosts (exact, no write-only shortcut) #1700
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1700"
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 L-696 on 2026-11-28T23:35:59Z.
Fixes #1475
What it changes
On a 32-lane host (NVIDIA), three of the ray-tracing structure builder's 53 compute programs are refused ("no wave32 lowering for this wave64 program"). The builder's stages run all or none, so the builder stays off (
missing=3 of=53). This PR translates the three with exact forms. It does not use the LDS write-only shortcut, so no approximation is involved.28918b7150a7aad5,caa78b8ca62bc3d6(groups of 64): their per-lane loops write LDS that other lanes read, inside per-lane skips (s_cbranch_execz). Onlywiden()translates them, with 3 branches taken wave-wide in each. Each group is a single console wave, so the group barriers meet exactly its two host waves. Both shaders join the programs that are widened by default.wide_by_default(digest, threads), keyed by group size: 64, 128 or 512.CS_CollisionRaytraced.water_portalsand the DefragHeapwith_half_meetspath are untouched.e63d22c4def9ba6a(groups of 512, eight console waves): 8 rounds of a 4-bit ballot. Each console wave's first lane counts the ballot withs_bcnt1inside a skip.once_per_threadmarks the blocks that every thread of the group runs exactly once: blocks that post-dominate the entry and are on no cycle. They are combined withall_lane_blocks_of(st, true).Synthetic regression tests (
wave64_tests.rs, no game code):lds_exchange_in_a_loop_inside_a_lane_skip_needs_the_skip_wave_wide: the 28918b71/caa78b8c shape. Run on the card, the result matches the console model.a_ballot_before_a_first_lane_skip_is_exchanged_with_the_whole_group: the e63d shape, in a group of 128 (two console waves).[min(s0,64), min(s0-64,64)], the console's counts.a_ballot_inside_a_wave_wide_branch_of_several_console_waves_stays_refused: the same code inside a branch that console waves may take differently is still refused, with the exact message.the_structure_builders_programs_are_widened_by_default: each digest is enabled only at its own group size.How it was tested
VICTORY_BVH_BUILDER=1, cold shader cache.32ecacfa):32ecacfa; this rebase ontod4b5d517has not been run in-game): About 13 minutes of play followed. The log has no ERROR, TDR or device-removed lines, and the run ended with a normal exit.d4b5d517+ this commit):cargo test: yes.victory-shader --lib352 passed, 0 failed, 9 ignored;victory-gpu --lib550 passed, 43 ignored;cargo build --release -p victorysucceeds.cargo clippy --workspace --all-targets -- -D warnings: fails on two findings that are already on main and not in this diff:lower.rsspare / per(manual checked division) and the unusedcolour. It reports nothing for this diff.Not verified, and help is welcome
once_per_thread, and the exchange inexchange_halves) is welcome.Checked for overlap
emit/lower.rs.AI assistance: written and tested with Claude (Anthropic); the in-game run was done by hand on the card above.
🤖 Generated with Claude Code
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by eleboucher on 2026-11-29T00:53:45Z.
On an RTX 4070 Ti SUPER (32 lanes) this PR gets the builder running. The runs that died ran out of memory; nothing points at this change.
Setup: Ryzen 7 9800X3D, 16 GB RAM, Windows 11 build 26300. Native 1440p,
VICTORY_BVH_BUILDER=1 VICTORY_ACTIVATE_RAYS=1, diagnostics build. Base is mainf9dfb76f+ #1640 + this PR. Conflict with main:emit/mod.rs, where main had added the fourCS_Tree_BatchCulldigests to the inline list. I kept yourwide_by_defaultand added those four toGROUPS_OF_64.structure builderlines throughout, no TDR line.crash::tests::memory_at_names_what_an_access_hit,policy::tests::repository_passes_policy).So on 16 GB the builder fits only briefly. Trying the windows-in-card-memory / texture-room trade next.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by NotADonky43 on 2026-11-29T08:34:31Z.
RTX 5070 Ti / Series X: on a cumulative descendant with the reflection fold scoped separately, asking for RT left the builder off, missing 1 of 53 stages (the 512-thread ballot). With the shader changes from this PR integrated, both ballot tests passed and the real game explicitly activated all 53 stages. In an exact-executable warmed release with #1878 and BVH_SIZE_COPY also enabled, six settled heavy reports ranged from 0.5 to 15.1 rendered FPS. This verifies builder activation, not visual parity or sustained performance. Static-sampler and GPU wait safeguards retained.