Shaders: preserve a broadcast FP16 wave reduction across EXEC restore #3342
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!3342
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3342"
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?
@draggygaggy-maker on GitHub · 2026-11-26 19:17 UTC · original
draggygaggy-maker:fix/shader-half-wave-broadcast→main· +109 −24 · 2 files · 1 commits · openA compute shader can read a complete FP16 reduction from lane 31 into an SGPR and broadcast that dword into a VGPR before restoring EXEC. VIctory's whole-wave simulation retains the reduction, its contributor mask and the lane supplying the upper 16 bits. When the VGPR is used after the restore, the vector classifier drops this otherwise representable result. Translation then fails at the consumer. Moving the copy immediately after the restore already translates.
Use the existing scalar classification rule when every symbolic vector lane agrees. The full contributor mask check still applies, and equality includes the source of the upper half. Continue using the existing DXIL lowering for the supported case. The change adds no GPU operation to the already supported equivalent shader, device synchronization, descriptors or resource allocations.
The integration regression uses synthetic Wave32 GFX10 instructions with a live LDS store. It compares the entire output shader for the two placements of the same register copy. Additional unit cases cover incomplete contributor sets and differing high-half source lanes for Wave32 and Wave64.
Related work
#1568's FP16 reduction fixture restores EXEC before copying the SGPR result into a VGPR and compares the low 16 bits. The new regression also moves the copy before the restore, keeps the vector live through an LDS store, and compares both complete DXIL containers. #2493 tests inline FP16 constants and inspects the scalar result. #3187 tests discovery past an unmatched saveexec and also checks the scalar result. #1486 tracks lane provenance for cross-lane reads. These are complementary to the vector classification change here.
Validation
The original scalar lowering sums FP16 inputs in FP32 and rounds once. This patch inherits that existing arithmetic and compute-stage restriction. No change to GPU timing or graphics memory was measured.
@Dukestar69 on GitHub · 2026-11-26 19:29 UTC · original · approved these changes
LGTM — verified on Windows against
origin/main(63bcca4).single(s, all)and reusing it inper_lanewhen all lanes share the same symbolic value cleanly preserves broadcastSym::Halfreductions across EXEC restore while still requiring every lane and a uniform high half.cargo test -p victory-shader --lib emit::wave:: -- --test-threads=1: all passed (includingvector_half_reductions_require_every_term_and_the_same_high_half).cargo test -p victory-shader --test half_wave_broadcast -- --test-threads=1: passed.cargo clippy -p victory-shader --all-targets -- -D warnings: clean.cargo xtask policy: 192 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
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.