shader: SafeSingleWave widening for 64-lane compute shaders and IC SH integration #1006
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1006"
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 whoalin1 on 2026-11-28T10:59:10Z.
Summary
Adds
WidenMode::SafeSingleWaveincrates/victory-shader/src/emit/mod.rsfor single-wave64 compute shaders (threads == 64), and addsCS_IrradianceCache_IntegrateIrradianceSH_cb05754f(eb1c062c...) toscene_kernel.Problem
Without
VICTORY_WAVE_WIDE=1, 64-lane compute shaders needing wave-wide branch widening fell back tolocal waves(approximate, no cross-half synchronization), breaking cross-half prefix sums, LDS reductions, and lane-63 broadcasts in GI and bin-offset passes (e.g.,CS_GenerateShaderBinOffsets_84edd24cproduced 269 overlapping shader-bin intervals;CS_IrradianceCache_*broke outdoor auto-white-balance / irradiance integration). FullWidenMode::Allcannot be turned on globally because widening inside divergent loops can deadlock at group barriers.Change (
crates/victory-shader/src/emit/mod.rs)active_loop_only: boolonwidenwithWidenMode::{All, SafeSingleWave, DriverLoop}.safe_single_wave_widen, which only permits widening forward branches in RPO (never loop latches) and rejects any natural loop enclosing a meeting/widened block if it is irreducible, hasEnd/Indirectexits, or has non-Uniformloop exits/back-edges.CS_IrradianceCache_IntegrateIrradianceSH_cb05754f(eb1c062c..., 5-stage LDS tree reduction + bounded uniform-exit SH loop) inscene_kernel.Verification
Verified on Windows (
x86_64-pc-windows-msvc, RTX 4070 SUPER):git diff --check origin/main..HEAD— cleancargo run --locked -p xtask -- policy—asset policy: 294 files okcargo clippy --workspace --all-targets --locked&--all-features— 0 new warnings incrates/victory-shader/src/emit/mod.rs(1 pre-existinglet_and_returnon untouched line 2961)cargo test --release -p victory-shader --locked --lib -- --test-threads=1— 293 passed, 0 failed, 5 ignored (including all 13wave64_tests)Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Bj0rnis on 2026-11-28T12:47:18Z.
Independent RTX 5070 Ti 16 GB (Blackwell, Wave32 host) verification on
101cdf28(Windows 11, Ryzen 7 9800X3D, 32 GB RAM, driver621.24, Rust 1.98.1,--releasebuild from source).Automated checks & Wave32 shader corpus:
main(63b902f);cargo xtask policy: 294 files ok.cargo test --release --locked -p victory-shader --lib -- --test-threads=1: 293 passed, 0 failed, 5 ignored (233.35 s, including allwave64_testsandbvh::tests).VICTORY_HOST_WAVE=32):25,763translated /222failed vs25,760/225onmain(63b902f) — unsupported wave64→wave32 count dropped22 → 19(+3 shaders lowered cleanly, 0 new translation errors).Live gameplay check (~4 min, opening diner → prison cell → prison break room; Series X, 2560×1440, DLSS Quality, FG off):
28.9 fpsmedian in mid-scenes (3.5k–6.5kdraws, avg4,941— vs27.6 fpsonmain),27.3 fpsin break room (avg9,849draws; RAM27.0 GB, VRAM12.8/14.3 GB),27.4 fpsoverall world median (35samples).Not tested:
VICTORY_BVH_BUILDER=1(RT) orVICTORY_WAVE_WIDE=1comparison. No game data, shader hashes, logs, or captures attached.AI-assisted test run and summary.