Add opt-in tiled ambient GI passes #1736
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!1736
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1736"
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?
@Gauss999 on GitHub · 2026-11-28 23:48 UTC · original
Gauss999:patch-8→main· +532 −5 · 1 files · 1 commits · openWhat it changes
VICTORY_AMBIENT_TILED=1as an opt-in; it does not enable the ambient stand-in by itself.meanandgatherPSOs as the default and as independent fallbacks if either tiled PSO cannot be created.mean_tiled.gather_tiled; both barriers are reached by padding lanes, and only valid 160x90 points write output.Adapted only for mean/gather from ToLIManl/VIctory-Hydra@a7bfab0. The unrelated
raisechanges are deliberately excluded.The Hydra author reports roughly 1.7-2.1 ms to 0.21-0.24 ms, but that is third-party, unreproduced data, and the source item also includes other work; it is not an isolated or guaranteed gain here. The reduction order,
rsqrtand reciprocal multiplies mean scalar/tiled output should be compared with a numerical tolerance, not bit-for-bit.How it was tested
Checked for overlap
GATHEREDhandling and UAV barriers are preserved.@nick0451 on GitHub · 2026-11-29 01:26 UTC · original
Tested, since the PR says nothing has been run yet. RTX 3090 24 GB (driver 610.88), i9-14900K, Windows 11, release build of this PR merged onto main
f9dfb76, Series S, DLSS performance, no frame generation,VICTORY_AMBIENT=0.8(the launcher's default).Tests:
cargo test -p victory-gpu --libpasses 552, including the 13 ambient tests (both new HLSL entries compile, and the layout check at rows 89/90 holds). Clippy has nothing inambient.rs.In game: the same executable, tiled unset against
VICTORY_AMBIENT_TILED=1, alternating, 3 rounds each after a warm-up, the same frozen save (a balcony, about 5,800 draws a frame), a 60 s window each:tiled ambient … unavailablewarning in any run, so no fallback.ERRORline.Not done: the WARP scalar-against-tiled differential and per-pass timestamps that the PR lists before leaving draft.
🤖 Generated with Claude Code
@ -332,0 +372,4 @@g_col[gi] = cells[base + gi];GroupMemoryBarrierWithGroupSync();if (valid) {[unroll(8)]@Yoshi-233 on GitHub · 2026-11-29 06:21 UTC · original
On Windows, the system FXC (
D3DCompile,cs_5_1, flags 0) at369af03bcompiles the tile accumulation to eight constant-index reads of each groupshared array (indices 0 through 7). The only remaining loop advances the tile base by 128. That uses 144 of the 2,304 cell contributions in the scalar gather.I checked the production
gatherandgather_tiledentries with a D3D12 readback on an RTX 4070 Ti SUPER. All cells had the same position, radius and weight. In each tile the first eight cells were red(1,0,0)and the other 120 were(0,1,0.25). From the same query point the scalar entry returned(0.062502,0.937503,0.234376)and the tiled entry returned(1,0,0).With this one-line change, the compiler emits an inner loop bounded by 128. The hardware and WARP both return the scalar RGB for the tiled entry. This gives a fixed-workload baseline for pricing the optimization. A two-colour fixture like this would also catch a future compiler regression that a layout/compile-only test misses.
github-bot referenced this pull request2026-11-29 18:28:55 +00:00
@Gauss999 on GitHub · 2026-11-29 18:33 UTC · original
Fixed with one adjustment to the suggestion: the system FXC (D3DCompile, cs_5_1, flags 0) rejects [unroll(8)] and [loop] on the same loop — compilation fails with E_FAIL, so the suggested change as shown does not build. A plain [loop] compiles, emits the inner loop bounded by 128, and makes the tiled entry return the scalar RGB, on hardware and on WARP.
Added the two-colour differential regression along these lines: gather and gather_tiled run on the same buffers, all cells with equal position/radius/weight, the first eight cells of each 128-cell tile red (1,0,0) and the other 120 (0,1,0.25), so the expected light is analytic — (0.0625, 0.9375, 0.234375). It fails if only the first elements of each tile are read. Scalar and tiled outputs are compared with a documented tolerance (2e-3; no bit equality), the points buffer is NaN-filled as a sentinel so any texel the shader leaves unwritten fails the test, and the probes cover the boundary row y=89 and column x=159 (the tiled dispatch's y=90+ padding lanes must not write them).
Validation run locally: the 14 ambient tests pass, including the new differential on hardware and WARP, and the full victory-gpu lib suite passes (553 tests). Default behaviour is unchanged — the tiled passes remain opt-in via VICTORY_AMBIENT_TILED=1, with the scalar fallbacks intact.
4f30610cb2to46b0cbc7a6@Yoshi-233 on GitHub · 2026-11-30 01:09 UTC · original
@Gauss999 Thanks for checking the exact FXC behaviour and correcting my suggestion. I checked the updated diff: the inner loop now has just
[loop], and putting the red cells in the first eight positions makes the previous eight-read result distinguishable from the expected full-tile colour. That addresses the issue I raised in review. The hardware and WARP runs are yours; I’ve only checked the updated source here.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.