Shaders: the ray-tracing structure builder's three wave64 programs on 32-lane hosts (exact, no write-only shortcut) #1700
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!1700
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@L-696 on GitHub · 2026-11-28 23:35 UTC · original
L-696:wave32-structure-builder→main· +354 −33 · 3 files · 1 commits · merged 2026-11-29 08:16 UTCFixes #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
Three of the builder's 53 compute programs were refused on NVIDIA ("no wave32 lowering for this wave64 program"), so the builder stayed off (missing=3). - 28918b7150a7aad5 and caa78b8ca62bc3d6: groups of 64 whose per-lane loops write LDS inside execz skips. Only widen() translates them; they join the programs widened by default (now `wide_by_default`, keyed by group size). - e63d22c4def9ba6a: groups of 512 (eight console waves). A 4-bit ballot is counted by each console wave's first lane inside a skip, so the mask halves must be exchanged at the tail of a block already lowered, which pair meetings refused. Where that block is one every thread of the group runs exactly once (post-dominates the entry, on no cycle: `once_per_thread`), the exchange now uses the group-barrier path; everywhere else it stays refused. Synthetic tests: an LDS exchange in a loop inside a lane skip needs the skip wave-wide; a ballot before a first-lane skip in a group of two console waves is exchanged with the whole group (matches the console on the card); the same ballot inside a wave-wide branch stays refused; the default widening policy. Co-Authored-By: Claude Opus 5.5 <[email protected]>@eleboucher on GitHub · 2026-11-29 00:53 UTC · original
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.
@NotADonky43 on GitHub · 2026-11-29 08:34 UTC · original
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.