Repository navigation
Conversation
An ignored test runs every VOP3-encoded opcode the translator lowers as a one-thread compute shader on each hardware adapter and on WARP, on the same inputs (signed zeros, denormals, infinities, quiet and signalling NaNs, integer and f16 edges, pseudo-random dwords), and reports where the devices disagree: any NaN matches any NaN, approximate operations get a few ULPs. A disagreement means the translation leans on behaviour DXIL leaves to the device. cargo test -p victory-shader --lib fuzz_tests -- --ignored --nocapture VICTORY_FUZZ_CASES, VICTORY_FUZZ_OPS and VICTORY_FUZZ_OUT set the inputs per opcode, an opcode-name filter and a Markdown report. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DenRakEiw
left a comment
There was a problem hiding this comment.
Verified locally merged onto origin/main (Windows 11 x64, Rust 1.98.1 MSVC):
cargo test -p victory-shader --lib emit::fuzz_tests::— compiles cleanly and respects#[ignore]cargo clippy -p victory-shader --all-targets— 0 warningscargo xtask policy— ok
Clean opt-in cross-device VALU fuzzer comparing hardware adapters against WARP. Looks good.
AI-assisted (Gemini 4 Neon).
catminou4
left a comment
There was a problem hiding this comment.
Static review only: fuzz_tests is #[cfg(all(test, windows))] and every case is #[ignore]d (run via cargo test -p victory-shader --lib fuzz_tests -- --ignored), so nothing here executes on macOS (suite stays at 96). The harness design is sound — deterministic cross-device VALU fuzzing of hardware adapters vs WARP with per-case reporting is exactly what this codebase needs for the lowering churn. Two requests: (1) wire the --ignored run into the Windows CI leg (or document the exact command in the PR/README), since ignored tests rot quickly; (2) a note on how failures are minimized/reportered (shrinking to a minimal VALU case would make reports actionable).
The fuzzer also runs every VOP3P opcode the translator lowers
(v_pk_*, v_fma_mix*), comparing each f16 half on its own and the high
half of v_fma_mixhi_f16, with any NaN matching any NaN.
On main, v_pk_add_f16, v_pk_fma_f16 and v_fma_mix{lo,hi}_f16 differ on
AMD (f16 rounded toward zero by legacyF32ToF16); with Marvisak#422 the RX 9070,
a gfx1036 iGPU and WARP agree on all of them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ices Review follow-up. Each finding lists its simplest disagreeing inputs first (fewest non-zero dwords) and ends with the instruction words and the v1..v4 inputs a regression test needs. With fewer than two devices (CI's runners have WARP only) the test returns instead of failing. The README names the command. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@catminou4 thanks, both done in
|
- VICTORY_FUZZ_MODS=1 also runs each float VOP3 opcode with abs, neg, clamp and omod (seven combinations). - v0 now starts as v4, so v_mac_*/v_fmac_*, which read their destination, no longer accumulate an undefined register. Their earlier signed-zero "differences" were that. - A conversion's result type is the first one in its name (v_cvt_f32_f16 gives f32), and v_cvt_pkrtz_f16_f32 is compared half by half, so NaNs no longer count as differences there. - The report shows v4 too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
A run on RDNA3 (RX 7900 XT): same findings as on the RX 9070 and gfx1036, nothing specific to RDNA3.
The full report is available if useful. AI-assisted (Claude Code); every run was on this machine. |
…r fields Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The new
So on all three AMD generations the f16 rounding, min/max/med3 and WARP device-loss findings are gone with AI-assisted (Claude Code); every run was on this machine. |
|
Ran the fuzzer at
I also ran the earlier head,
I stopped the No game data used. AI-assisted (Claude Code). |
|
Automated triage for the maintainers. Merge candidate. This adds an Thanks for taking up the adapter nit; that point is resolved. CI: passing ( Generated by Claude Code |
…eir own The lowering's Parts and HostShader gained view_marks (cd94d35). And as host.rs's hardware_adapter (Marvisak#1911, Marvisak#1925), an adapter without dedicated video memory (CI's basic render driver) is not a hardware column. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Merged |
v_dot2_f32_f16 counted as an f16 result (its name has 16 and _f), so two f32 NaNs with different payloads read as a disagreement. The first type in the name (v_cvt_f16_f32, v_dot2_f32_f16) is the result's. A full run on 940d32f (RX 9070, gfx1036, WARP) gives the same 17 disagreements as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The full fuzz of |
v_cubeid/sc/tc/ma_f32 pick a coordinate (or its negation) as the result, so a denormal coordinate came out as the host's: kept on AMD, flushed to -0 on WARP, where the console's float mode reads it as a zero of its sign. The coordinates now go through ftz first, as min and max's operands do (77053a0). A semantics probe runs the four over signed zeros, denormals, infinities and NaN in each coordinate (14,440 inputs) against the RDNA2 model. Without the change: 2,193 model mismatches on an RX 9070, 1,276 on WARP, and the two disagree on 917. Found by the cross-device fuzzer (Marvisak#1614). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… ignored by default Every VOP3/VOP3P opcode the translator lowers runs alone on every adapter and on WARP, on special floats, integer and f16 edges and random dwords; the test reports each opcode whose results differ, simplest inputs first, with the words and inputs a regression test needs. Ignored by default (minutes of GPU time); with one device it returns. A port of the fuzzer of Marvisak/VIctory#1614. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… ignored by default Every VOP3/VOP3P opcode the translator lowers runs alone on every adapter and on WARP, on special floats, integer and f16 edges and random dwords; the test reports each opcode whose results differ, simplest inputs first, with the words and inputs a regression test needs. Ignored by default (minutes of GPU time); with one device it returns. A port of the fuzzer of Marvisak/VIctory#1614. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…re adapters vs WARP)
v_cubeid/sc/tc/ma_f32 pick a coordinate (or its negation) as the result, so a denormal coordinate came out as the host's: kept on AMD, flushed to -0 on WARP, where the console's float mode reads it as a zero of its sign. The coordinates now go through ftz first, as min and max's operands do (77053a0). A semantics probe runs the four over signed zeros, denormals, infinities and NaN in each coordinate (14,440 inputs) against the RDNA2 model. Without the change: 2,193 model mismatches on an RX 9070, 1,276 on WARP, and the two disagree on 917. Found by the cross-device fuzzer (#1614). Co-authored-by: alexdeliu <240865807+alexdeliu@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|
Code review and triple-adapter (NVIDIA RTX 5090 + AMD Radeon iGPU + WARP) verification at head
Updating line 716 to |
What was wrong: the `neg` source modifier was lowered as `-0.0 - x`. IEEE 754 leaves the sign of a NaN out of a subtraction to the host, and WARP keeps it: a negated NaN reached the instruction with the sign it had. The console's modifier flips bit 31 alone, NaN or not. The floor conversions show it, as they saturate a NaN by its sign: `v_cvt_rpi_i32_f32 -v1` and `v_cvt_flr_i32_f32 -v1` of 0x7fc00000 gave 0x7fffffff on WARP, 0x80000000 on an RX 7900 XTX (RDNA3) and the model. Found by the VALU fuzzer of Marvisak#1614 with VICTORY_FUZZ_MODS=1 (20 and 9 of 200 inputs differed, all NaNs). `neg` is now an integer XOR of the sign bit (`fneg`), the same on every host, for f32 sources, v_fma_mix sources, f16 sources read as f32 and packed f16 sources. The 16-bit and select paths already flipped the bit. New test: source_modifiers_set_the_sign_of_a_nan checks both floor conversions with abs, neg and -|x| against the model on the hardware adapter and WARP; without the fix it fails on WARP only. Checked on Windows 11, RX 7900 XTX (driver 32.0.32029.2010) and WARP: cargo test --workspace --locked passes (780), both CI clippy runs are clean, and the fuzzer with modifiers on the four float-to-integer conversions shows 0 of 400 inputs differing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
RDNA1 run on current main — RX 5700 XT (Navi 10), driver 32.0.21045.29003, Windows 11 26200; main Build note: on current main 251 opcodes × 160 inputs: 4 differ, 99 refused, 0 device losses. All four are transcendental:
None of the findings in the PR description (i64 shared-dword compares, f16 rounding, denormals) show up on RDNA1 at current main. AI use: Claude Code (Claude Opus 5.5). |
An ignored test that looks for shaders that compute different values on different GPUs. Every VOP3-encoded opcode the translator lowers runs as a one-thread compute shader on every hardware adapter and on WARP, on the same inputs, and the test reports where the devices disagree. The inputs are signed zeros, denormals, infinities, quiet and signalling NaNs, integer and f16 edges in either half, and seeded pseudo-random dwords.
Comparison rules:
rcp,rsq,sqrt,log,exp,sin,cos) get a few ULPs.A disagreement means the translation leans on behaviour that DXIL leaves to the device. The test is test-only and doesn't run in CI:
Environment variables:
VICTORY_FUZZ_CASES: inputs per opcode (default 160).VICTORY_FUZZ_OPS: comma-separated name filter.VICTORY_FUZZ_OUT: write a Markdown report.Each device runs alone, because two at once suspend WARP. A removed device is released before a new one is made, because D3D12 hands back the same removed device while a reference is alive.
What it found on
main@ffe310ebDevices: RX 9070 (RDNA4), Ryzen 7700 iGPU (gfx1036, RDNA2) and WARP. 212 opcodes, 200 inputs each.
v_cmp_*_{i64,u64}wrong when the operands share a dwordlegacyF32ToF16fcmp false/fcmp true(v_cmp_f/tru_f{16,32}) remove the devicev_min/max/min3/max3/med3_f32,v_cubesc/tc_f32,v_sin_f32v_fma_f32/v_fmac_f32are fused on AMD and not on WARP (1 ULP)FMadshortcut (lower.rs)v_cvt_f32_u32misrounds,v_log_f32is 20% off at1 - 2^-24The full report and the per-opcode tables are in the gist: https://gist.github.com/alexdeliu/ef9ef0ebc1776ff104b5aa8eaea18e87
Later commits add VOP3P (
v_pk_*,v_fma_mix*) and modifier variants (VICTORY_FUZZ_MODS=1): #422 also fixes the packed f16 ops andv_fmac_f16/v_fma_f16on AMD.Checks
#[ignore]d, socargo test --workspaceis unchanged.🤖 Generated with Claude Code