shader: v_fmac/v_mac's accumulator takes its VOP3 abs/neg bits; a level query reads no array slice #2387
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2387"
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?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by FIocker on 2026-11-29T12:36:52Z.
Two translator fixes in
emit/lower.rs:absandnegbits (bit 2 of each field) were dropped, so the sign is wrong wherever the title sets them. They are now applied to the accumulator. After SmokinDoinkV1 (GPL-3.0).Checked: workspace check clean;
victory-shaderlib tests 462 passed (release, together with the two other open translator/HLE fixes from this account). Also played in our local fork since 2026-11-28 with no regressions seen.🤖 Generated with Claude Code
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Dukestar69 on 2026-11-29T12:49:53Z.
Review: APPROVED
Tested locally merged onto
main(829188e9).crates/victory-shader/src/emit/lower.rs.cargo test -p victory-shader --lib emit::tests::passed (26 passed; 0 failed; 1 ignored).cargo test -p victory-shader --lib emit::lower::tests::passed (25 passed; 0 failed; 1 ignored).Clean RDNA2 VOP3
abs/negaccumulator handling forv_fmac/v_macand level-query array-slice fix. LGTM.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Lyrnc on 2026-11-30T06:11:22Z.
Checked the
v_fmac_f32half of this against a Radeon gfx1036 (RDNA 2) running the same kernel natively, and ran the translator's output for main and for this PR on an RTX 5080 and on that Radeon through D3D12. The level-query half (imageop == 81) is not covered here.Setup
mainat41adb551with this PR's head (1799baa) merged locally, no conflict. The victory-shader test binary was built from that merged tree (own tree and target directory).v_fmac_f32forms are raw encodings (opcode 0x12B, the src2 field 0,abs/negbit 2 set for the accumulator).super::emit(32-lane host),dxil.dllvalidation, dispatched on the 5080 and on the Radeon (VICTORY_ADAPTER=radeon).Case
fmac_src2_mods: a in {1, 2, -1, 0.5}, b in {3, -5, 0.25, 7.5, 1e-3, -2, 100, 0}, the accumulator c in {1, -1, 4, -4, 0, -0, 10, -0.125}, mixed over the 64 lanes. Outputs (vdst holds c before each):The hardware column matches that formula in all 512 values, signed zeros included: the accumulator does take the VOP3
abs/negbits 2.Results (values that differ from the gfx1036, out of 64 lanes x 8 outputs)
Main drops the accumulator's bits on both cards (the same values on each), every lane where they change the result: lane 0 (a = 1, b = 3, c = 1) gives v11 = 4.0 where the gfx1036 gives 2.0, v15 = -2.0 where it gives -4.0; lane 3 (a = 0.5, b = 3, c = -0.125) gives v12 = 1.375 where it gives 1.625. The bits on sources 0 and 1 were already applied.
Verdict: correct for
v_fmac_f32: all 512 values exact on both cards, signed zeros included (2 of the results are -0, 22 are +0). The other wave32 cases in the run give the same values as main.Not covered:
v_mac_f32(the same code path in this PR, no case here) and the level-query change.AI use: Claude Code (Claude Opus 5.5) ran the oracle and host cases and wrote this comment.