Repository navigation
Conversation
…tion
A whole-wave section's value leaves it lowered only where every lane
agrees on one shape. The wave64 OR (and the like) reductions the console
compiler writes reduce each half with DPP and v_permlanex16_b32, then
read lane 0 and combine it into every lane, so that only the high half
holds the whole wave's result; the program restores EXEC and reads lane
63 with v_readlane_b32. The lanes of that value differ, so it had no
shape and the read was refused ("a whole-wave section step the
simulation does not follow"). Three compute passes of the title's
FidelityFX upscaler end so.
The simulation now also keeps, for a value whose lanes differ, what each
lane holds where that does not depend on the lane reading it (a
reduction over all lanes, a constant, a uniform value; never a lane's
own value). A v_readlane_b32 of such a value at a constant lane, outside
the section, is lowered by that lane's shape.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Dukestar69
left a comment
There was a problem hiding this comment.
LGTM — verified on RTX 5090 and VICTORY_WARP=1 (Windows / D3D12) against origin/main (63bcca4).
- Tracking per-lane results of a whole-wave section so a subsequent single-lane read (including lane 63 of a wave64 reduction) lowers accurately passes cleanly on both RTX 5090 and WARP.
cargo test -p victory-shader --lib emit::wave:: -- --test-threads=1: 8 passed, 0 failed (a_wave64_reduction_finished_in_the_high_half_is_known_per_lane).cargo test -p victory-shader --lib emit::crosslane_tests:: -- --test-threads=1: 7 passed, 0 failed on RTX 5090 and 7 passed, 0 failed onVICTORY_WARP=1(whole_wave_section_read_at_one_lane_after_it_on_gpu,wave64_section_read_at_lane_63_after_it).cargo clippy -p victory-shader --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
|
Ran the whole-wave-section tests at Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, Rust 1.98.1 (pinned by Both pass: the wave32 fixture ran a dispatch on the real 32-lane adapter, and the wave64 reduction test passed at translation level. I did not run Not tested: the wave64 GPU dispatch, the title's FidelityFX shaders, a paired smoke run, the full workspace suite, AMD and Intel GPUs, native wave64 hosts, Wine, release profile, game data. AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used. |
fuzeofficlal
left a comment
There was a problem hiding this comment.
Tracking per-lane Shape in Section::lanes for whole-wave Wave64 split-half reductions is a very clean idea, and both new tests pass validation (with Wave32 GPU readback passing on RTX 5090, 48/48 tests green).
However, there is one P1 regression in how section_lane materializes the read shape:
- Unlike
shapes— which callsself.shape(sh)immediately atsection_inst(crates/victory-shader/src/emit/lower.rs:1162) whileself.curis still in the section's block —section_lanesdefers callingself.shape(shape)until thev_readlane_b32consumer (lower.rs:6682-6686). - If there is a divergent branch between the whole-wave section and the
v_readlane_b32(for example, the section computes an all-laneOp::Orreduction0xFFFFFFFFbefore an even-lane branch, andv_readlane_b32 s15, v7, 31executes inside that even-lane branch),self.shape(shape)emitswaveActiveBitat the divergent branch block (self.cur), which only sees the even lanes and silently returns0x55555555instead of0xFFFFFFFF.
Materializing (and caching) the needed section_lanes shapes eagerly at section_inst (just like shapes) — or rejecting deferred reads across divergent control flow — would close this cleanly.
Non-blocking notes:
- P1 (pre-existing):
v_readfirstlane_b32(lower.rs:6715) does not consultsection_lanesand can pick host lane 0 when restoredEXECexcludes lane 0. - P2: dynamic/SGPR lane indices, out-of-range indices (
>= wave_size), and values flowing through a non-trivial VGPR phi beforev_readlane_b32misssection_lanesand fall back toVal::Missing.
|
Following up on the Wave64 runtime check, I combined this exact head The regression runs the two patterns in a single synthetic shader. The first true comparison is in lane 63 on iteration 2 of a bounded poll. The shader then performs the whole-wave OR and reads lane 63 after restoring EXEC. Readback must contain With the identical fixture, #3402 alone stops at The merge retains both parent commits and both sets of tests. It moves the mask-SCC helpers to keep |
|
@Lyrnc f9e2015 is directly on I reproduced the review case on app-local WARP. An all-lane OR followed by a read inside an even-lane branch returned If you take the patch, please retain Git authorship when cherry-picking or rebasing. If folded into another commit, please add AI-assisted with Codex. Synthetic shaders only. I also resolved the test-file overlap and the shader file-size limit in c75cc68, which combines the two reviewed follow-ups. Both SCC regressions and both section-lane tests passed in the combined app-local WARP build. |
What was refused
Three wave64 compute programs of the title's FidelityFX upscaler DLL (
amd_fidelityfx_upscaler_xbox.dll):17af85f170e66f30,477b52e73ddeb6f2,8b437ab61d8008fe. On main they stop earlier, ata lane mask read as data(fixed by #3401); past that, each stops ata whole-wave section step the simulation does not follow, at its final store.Each ends with a wave OR reduction of the form the console compiler writes for wave64 (as this PR's test
writes it):
The section simulation lowers a value that leaves the section only where every lane agrees on one shape.
Here the low half holds its own lanes' OR and the high half the whole wave's, so
v7had no shape, and theread at lane 63 after the section was refused.
What changed
emit/wave.rs:Section::laneskeeps, for a value whose lanes differ, what each lane holds where that does notdepend on the lane reading it: a reduction over all lanes, a constant, a uniform value (never a lane's own value
of a VGPR). Values with one shape are unchanged.
emit/lower.rs: av_readlane_b32at a constant lane, outside the section, of such a value is lowered by thatlane's shape (
shape(), the same lowering as a section value with one shape). A lane without one (here lane 0,which holds only the low half's OR) is still refused.
Tests
wave::tests::a_wave64_reduction_finished_in_the_high_half_is_known_per_lane(no GPU): the sequence above;lanes 32-63 are the reduction over the wave, lanes 0-31 have no lane-independent shape, the value no shape.
crosslane_tests::whole_wave_section_read_at_one_lane_after_it_on_gpu(wave32, 32 lanes, hardware adapter):the same idea within one wave32: rows reduced with DPP, row 0's result (lane 0) ORed in, so only row 1 holds the
whole wave's, read at lane 31 after EXEC is restored; under a branch on three of four lanes, on
1 << lane, sothe answer (0x77777777) differs from a dropped row (half of it) and from counting inactive lanes (0xFFFFFFFF).
crosslane_tests::wave64_section_read_at_lane_63_after_it: the wave64 sequence above under a branch on the laneswith
lane & 2 == 0, on1 << (lane >> 1): 0x55555555 (a dropped half gives 0x5555 or 0x55550000, inactivelanes counted 0xFFFFFFFF). Lowered and validated everywhere, run where the host has 64-lane waves.
Results:
NVIDIA).
the wave64 program dispatched on 64-lane waves.
wave.rsandlower.rsthe two GPU tests fail at lowering witha whole-wave section step the simulation does not follow.sequences run natively give 0x77777777 (wave32, read at lane 31) and 0x55555555 (wave64, read at lane 63) in
every running lane: 0 differences from the tests' expected values.
cargo clippy -p victory-shader --lib --tests -- -D warnings: clean.cargo xtask policy: 191 files ok.cargo test -p victory-shader --lib -- --test-threads=1on the RTX 5080, skippingheap_direct_texture_reads_mark_their_heap_index(it kills the test process here, as Shader tests: heap_direct_texture_reads_mark_their_heap_index kills the test process on a real GPU (RTX 5070, main 67e8ae1) #2571 reports): 301 passed,3 failed, 3 ignored; the three (
stride_tests::a_heap_buffer_read_*twice,synthetic_tests::gathers_at_a_level_match_the_hardware) fail the same way on main63bcca4here.Census (offline, the title's shader pack, exe and DLLs)
translate --list --validateovershaders.rpf, the executable,XboxBvhBuilder.dllandamd_fidelityfx_upscaler_xbox.dll, validator dxc 1.9.2609dxil.dll, compared program by program:63bcca4hash): the three programs stop at the earlier refusal first.
8e614708143ef917,17af85f170e66f30,477b52e73ddeb6f2,8b437ab61d8008fe); against Shaders: the SCC of a lane-mask operation, read as data, is whether the mask is not zero #3401 alone, exactly thethree wave64 ones change, from
a whole-wave section step the simulation does not followto validated, and noother program changes outcome or DXIL. The five new tests of both branches pass together on the RTX 5080.
Both this and #3401 append tests at the end of
emit/crosslane_tests.rs; whichever mergessecond has a trivial conflict there (keep both blocks; git takes the closing brace as shared, so check it).
Not tested
VICTORY_FIDELITYFX_DIR; the game wasnot started).
AI use: Claude Code (Claude Opus 5.5) found the refusal in the offline census, wrote the change, the tests and
this text, and ran the checks on our machine; Lyrnc reviews what goes out. No game data is included (hashes,
counts and error text only; the sequence above is the test's, written by hand).
🤖 Generated with Claude Code