Shaders: lower v_div_fixup_f32 and v_div_fixup_f16 #1149
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!1149
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1149/head"
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?
@DenRakEiw on GitHub · 2026-11-24 16:14 UTC · original
shader/v-div-fixup→main· +166 −1 · 2 files · 1 commits · closed without merging## Summary
Lowers RDNA2's IEEE-754 division-finalization instructions
v_div_fixup_f32(VOP30x15F) andv_div_fixup_f16(VOP30x35F) incrates/victory-shader/src/emit/lower.rs:Lower::div_fixup(quot, denom, num)implementing the full RDNA2 GFX10.3 special-case priority table in pure integer bit operations (immune to host-driver float NaN-folding differences):denomis NaN →quiet(denom)(highest priority, preserving payload)numis NaN →quiet(num)(denom == ±0 && num == ±0)or(denom == ±inf && num == ±inf)→ canonical qNaN (0x7FC0_0000)num == ±infordenom == ±0→±infwithsign(denom) ^ sign(num)denom == ±infornum == ±0→±0.0withsign(denom) ^ sign(num)quotis NaN (overflow in division sequence) →±infwithsign(denom) ^ sign(num), elsecopysign(quot, sign(denom) ^ sign(num)).v_div_fixup_f32throughf(self, 0..=2)andfloat(self, r)(preserving VOP3abs/neg/omod/clamp) andv_div_fixup_f16throughvalu16_op'sFLOAT3path (half_fsrc+float_result).Tests
Added two end-to-end synthetic GFX10 compute shader tests in
crates/victory-shader/src/emit/valu_tests.rs(validated viadxil.dlland executed on both host GPU and WARP):v_div_fixup_f32_matches_rdna2: 19 cases covering normalcopysign,NaNquotient overflow,±x / ±0,±inf / finite,finite / ±inf,±0 / finite,0/0,inf/inf, andsNaNpriority/quieting.v_div_fixup_f16_matches_rdna2: 9 cases covering f16copysign,NaNquotient overflow,±0/±infsign rules,0/0,inf/inf, andNaNpropagation.Verification
cargo test -p victory-shader v_div_fixup: 2 passed, 0 failed on Windows 11 x64 / NVIDIA GeForce RTX 5090 (Blackwell) + WARPcargo clippy -p victory-shader --all-targets: 0 warningscargo xtask policy:asset policy: 155 files okAI-assisted (Gemini 4 Neon).
@ghost on GitHub · 2026-11-24 16:35 UTC · original
Ran on RDNA2 hardware through vkd3d-proton on a Steam Deck (not native Windows): AMD Van Gogh, RADV 26.1.99, SteamOS 3.8.28, Proton 11.0-3 (wine-11.0) with its vkd3d-proton 212991fc. Windows MSVC test binary (rustc 1.100.0) built from head
4e35c96on mainffe310e. Your report lists NVIDIA and WARP, so this adds AMD hardware.v_div_fixup_f32_matches_rdna2andv_div_fixup_f16_matches_rdna2pass: signs, x/0, inf, 0/0, inf/inf, and NaN priority (denominator before numerator).stub_pipeline_is_created, fails on main too (likely vkd3d-proton accepting the zero DXIL digest the test expects refused; environment, not this PR).Not tested: native Windows AMD drivers; WARP (this setup has none, so the WARP leg ran on RADV too); whether the new test fails without the fix on this host.
AI-assisted (Claude Code, Claude Opus 5.5); no game data.
@shortselow-byte on GitHub · 2026-11-24 17:23 UTC · original
For triage: this overlaps two open PRs, #200 (
v_div_scale_f32,v_div_fmas_f32andv_div_fixup_f32) and #379 (v_div_fixup_f16).@Zipettte on GitHub · 2026-11-24 18:01 UTC · original
Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at
4e35c96:cargo test -p victory-shaderpasses, 122 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).Tested with AI assistance (Claude).
@Marvisak on GitHub · 2026-11-25 00:32 UTC · original
Automated triage for the maintainers. Closing because another open pull request covers the same change.
See #200. Lowers v_div_fixup_f32 and v_div_fixup_f16, which the title does not use. Both are covered by PRs that merge clean: #200 (f32, with v_div_scale/v_div_fmas) and #379 (f16).
If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.
Pull request closed