Shaders: match RDNA2 NaN bits for negative F16 logarithms #3206
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!3206
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3206"
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?
@andrewpozdnakov7-jpg on GitHub · 2026-11-26 12:42 UTC · original
andrewpozdnakov7-jpg:fix/v-log-f16-negative-domain→main· +46 −0 · 2 files · 1 commits · openAMD specifies
0xfe00forv_log_f16(-1)andv_log_f16(-inf). A native RX 6700 XT sweep also records this word for negative nonzero inputs. In the current VIctory lowering the host logarithm supplies the NaN bits. WARP 1.0.22 returned0xffffafter narrowing. AMD RDNA 2 ISA · Native RDNA2 sweepSelect the documented quiet NaN for ordered
x < 0in the F16 log lowering. This keeps both zero signs on the existing logarithm path.The same synthetic test on upstream
63bcca4reported four mismatches forfc00,bc00,8400, and8001. With the fix all 11 input/output pairs pass on WARP 1.0.22 with D3D12 Agility 1.620.2. The controls cover both zero signs, a positive subnormal, powers of two and positive infinity. Every case checks that the high half of the destination is preserved.WARP suites passed (36 VALU, 34 semantics with 1 ignored), as did strict shader Clippy and
cargo xtask policy. Physical GPU and in-game behavior were outside this run.Claim in #1633
AI-assisted with Codex.
@Dukestar69 on GitHub · 2026-11-26 12:47 UTC · original · approved these changes
Verified on RTX 5090 & WARP against
origin/main(63bcca4):cargo test -p victory-shader --lib v_log_f16_matches_rdna2_special_values -- --test-threads=1: passed on RTX 5090 and WARP.cargo clippy -p victory-shader --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Clean fix matching RDNA2 NaN bits for negative F16 logarithms.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@oni-swr on GitHub · 2026-11-26 13:06 UTC · original
WARP test report (claim: #1633)
5398738488fb9c0f9a5304ae22d6ba15516799e0, base:origin/main63bcca43c6(head sits directly on it, no merge needed)rust-toolchain.toml,cargo test --locked -p victory-shader --lib -- --test-threads=1,VICTORY_D3D12_WARP=1andVICTORY_WARP=1(the shader tests only honour the latter, so every device in the run was WARP; no physical GPU). Validator: Windows SDK 10.0.26100dxil.dll. Synthetic word streams only, no game data.victory-shadersuite: 299 passed, 4 failed, 3 ignored. New testv_log_f16_matches_rdna2_special_valuespasses, not skipped (all 11 cases on WARP, including -inf, -1.0 and negative denormals expecting 0xfe00).mainit fails on all four negative inputs (got 0xabcdffff, want 0xabcdfe00for 0xfc00, 0xbc00, 0x8400, 0x8001). Suite on main alone: 298 passed, 4 failed, 3 ignored; the same 4 unrelated failures as on the PR (a_mask_joined_with_data_at_a_uniform_loop_is_its_number,gathers_at_a_level_match_the_hardware,permutes_mask_high_address_bits_and_divergent_branches,permutes_read_the_lane_named_and_zero_from_lanes_left_out).-0and+0are not< 0, so they still give -inf (0xfc00), and a NaN input is not< 0, so it still goes through the log. The 0xfe00 result relies on the host turning the f32 NaN0xffc00000into f16 0xfe00, which holds on WARP; the comment says so. I could not check other hosts.AI use: Claude Code (Claude Sonnet 5.5), coordinated by Claude Code (Claude Opus 5.5).
@Jackster on GitHub · 2026-11-26 16:06 UTC · original · edited 2026-11-26 16:08 UTC
AMD check on a Radeon RX 7900 XTX (gfx1100, 32.0.32029.2010),
victory-shaderbuilt with--features host:63bcca4with only the test applied, the hardware backend reports no mismatch — the card already returns0xfe00for the four negative cases; only WARP returns0xffff.So on AMD hardware this is a WARP/CI-facing fix. Synthetic only. AI-assisted.
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.