Repository navigation
Conversation
In the VOP3 encoding, bit 2 of abs and of neg names the accumulator of v_fmac_f32, which is the destination register. RDNA2 computes fma(a, b, -d) and fma(a, b, |d|) with them; the lowering read the accumulator without them. The expected values of the new test are 16 rows measured on RDNA2 (gfx1031) with IEEE mode off and f32 denormals flushed, published by the AnyPS5 project in VFmacF32AccumulatorModifiers.cpp. No code is taken from that project. v_mac_f32 and v_mac_legacy_f32 share the arm and get the same treatment; there is no measurement for those two. Co-Authored-By: Gemini 4 Neon <noreply@google.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Independent local verification of head
Host GPUs: RTX 5060 Laptop (driver 621.24) and Radeon 780M RDNA3; this run used WARP. A worktree-local |
|
Independent WARP verification of head cf8f543 (parent main 63bcca4). Synthetic only, no game data. Setup: Result: no defect found in the change.
Limits: the 16 expected rows in the PR's test are quoted from an external hardware measurement; I did not have that source or RDNA2 hardware, so I checked WARP against the PR's rows and my own model, not against a console. The edit sits in the arm shared by AI use: Claude Code (Claude Sonnet 5.5) ran this verification; Claude Code (Claude Opus 5.5) coordinated. No game files, dumps, shader names or hashes were used. |
Dukestar69
left a comment
There was a problem hiding this comment.
Verified on RTX 5090 & WARP against origin/main (63bcca4):
cargo test -p victory-shader --lib v_fmac_f32_accumulator_modifiers_match_rdna2_oracle -- --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 applying VOP3 abs/neg modifiers to the v_fmac_f32 accumulator.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
|
Hardware test report: head cf8f543 Environment: AMD Radeon RX 9070 XT (RDNA4), driver 32.0.32015.7029, Windows 11 (10.0.26200.9974), rustc 1.98.1. WARP not forced. The harness output does not name the adapter; the RX 9070 XT is the only physical GPU in this machine (the other adapters are virtual displays), so the "hardware" label is that GPU. cargo test -p victory-shader --lib --locked v_fmac_f32_accumulator_modifiers_match_rdna2_oracle -> 1 passed, 0 failed. Both probes: 16 inputs, model mismatches hardware 0, warp 0, hardware/warp differ on 0. Control: with lower.rs taken from main and the PR's test kept, the same test fails. Neg probe: hardware 13 and warp 12 of 16 mismatches. Abs probe: hardware 9 and warp 8 of 16. Hardware and warp also disagree on 2 rows in each probe on main (for example inputs 7f7fffff, 40000000, ff7fffff: hardware 7f7fffff, warp 7f800000); with the PR applied they agree on all rows. Not run: v_mac_f32 / v_mac_legacy_f32 with bit 2, Clippy, xtask policy, any game files. Synthetic tests only. AI use: this report was prepared with Claude (Claude Sonnet 5.5); the test run was done by me on my own machine. |
Problem
In the VOP3 encoding
v_fmac_f32(0x12B) has two explicit sources; the accumulator is the destination register. Bit 2 ofabsand ofnegstill acts on RDNA2: it applies to the accumulator.fields.rsdecodes the bit, but the arm inlower.rsreads the accumulator without it, so the modifier is dropped with no refusal.Example:
a = 1.0,b = 2.0, accumulator1.0,negbit 2. RDNA2 gives1.0(0x3f800000),maingives3.0(0x40400000).Source of the expected values
The AnyPS5 project measured this on RDNA2 (RX 6750 XT, gfx1031). Its PR 18285 reports 1,372 rows in each of four float-mode settings:
negbit 2 givesfma(a, b, -d)andabsbit 2 givesfma(a, b, |d|)on every row, and the src2 register field is ignored. It keeps 16 rows in its testcore/libs/prx/libSceAgcDriver/tests/execution/VFmacF32AccumulatorModifiers.cpp. The test here uses those 16 rows as numbers, from the table for IEEE mode off with 32-bit denormals flushed (the modesemantics_tests.rsmodels). No code is taken from that project.Fix
In the
v_fmac_f32arm oflower.rsthe accumulator getsabsandnegbit 2 the way a source gets its bits: the absolute value first, then a subtraction from -0.The arm is shared with
v_mac_f32andv_mac_legacy_f32, so they get the same treatment. There is no measurement for those two; before this change they dropped the bit asv_fmac_f32did.Test
New:
semantics_tests::v_fmac_f32_accumulator_modifiers_match_rdna2_oracle, the 16 measured rows throughnegbit 2 and throughabsbit 2 (signed zeros, infinities, NaN and denormal accumulators, a sum that cancels to zero). No existing test or model changes; the existing probes leave bit 2 out for the two-source forms.Verification
GitHub Actions on
windows-latest, on the fork, with the jobs narrowed tovictory-shaderandxtask. The runner has no hardware adapter, so the probes ran on WARP only.303 passed; 0 failed; 3 ignored; both probes report 0 model mismatches;302 passed; 1 failed, the new test only, with 12 of 16 mismatches fornegand 8 of 16 forabs.Not checked
v_mac_f32andv_mac_legacy_f32with bit 2: by analogy only, as said above.neg: RDNA2 flips the NaN's sign bit (two of the 16 rows). The test accepts any NaN there, as the other float probes do, and the negation is the same subtraction the sources use.— Gemini & Fable