Commit Graph

11 Commits

Author SHA1 Message Date
00639af3dd Merge pull request #1663 from IlyassRS3/fix/f64-diff-cli-oracle-and-shrink
f64_diff: harden CLI guards, validate hw oracle batch/word counts, and propagate HarnessError out of shrink()
2026-11-28 15:47:41 +01:00
11df2b0069 Merge pull request #1112 from klikso/carry/shader-f64-omods
rdna2spirv: the binary64 VALU ops take clamp and nothing else from their omod (SHADER-F64-OMODS-CARRY)
2026-11-28 12:52:22 +01:00
2ddbf4b48b f64_diff: harden --ops/--hw-arch/--exe/zero-case CLI guards, validate hw oracle results, and propagate shrink HarnessError 2026-11-25 08:30:15 +01:00
8f498bed96 rdna2spirv: the f64 VALU ops keep only clamp, not their omod
RDNA2 ignores the VOP3 output modifier of the f64 VALU arithmetic and rounding
ops while f64 denormals are kept, which is the MODE this translator models. I
measured it with tools/hw_oracle raw kernels on a gfx1036 iGPU (the Radeon
iGPU of a Ryzen 7 7800X3D, Windows driver 31.0.24002.92, code object v5),
wave32 and wave64 identical, over the four combinations of MODE.IEEE and
denorm_mode_16_64. mul:2 / mul:4 / div:2 changed nothing for v_add_f64,
v_rcp_f64, v_rsq_f64, v_sqrt_f64, v_trunc_f64, v_ceil_f64, v_floor_f64 and
v_rndne_f64 while f64 denormals were kept, applied only with MODE.IEEE off and
the denormals flushed, and clamp applied in every one of those runs. The two
f64 call sites that still forwarded a full modifier list now hand
clamp_mods_f64 only the clamp they act on, and the rows that described the
scaling for those ops are corrected to what the hardware does.

This is SHADER-721, the binary64 counterpart of the f16 omod row (#4542,
"an f16 destination ignores omod"). The row for v_add_f64 records the sweep and
how it was confirmed and keeps the LLVM VOP3 citation main already had; the
rcp/rsq/sqrt and rounding rows keep the measurements others contributed (the
v_sqrt_f64 ulp errors, @timelery's sweep of the four rounding ops) and only
change the sentence about the omod. One contradiction is removed on the way:
main's rounding row said the translator applies the modifiers "as those rows
do" while the code applied them to ops whose own row says they are ignored.

Ops with their own rows are left exactly as they are - v_cvt_f64_i32/u32,
v_cvt_f32_f64, v_frexp_mant_f64, v_div_fixup_f64 and v_ldexp_f64 keep what
their rows measure. The same rule probably reaches the first three as well, and
tests/semantic/test_alu_ldexp_f64.py already knows it for ldexp; I raised that
in #5256 as a finding instead of folding unmeasured ops into this change.

Counted over the whole corpus, not a sample: 216 v_add_f64 in 5 of the 26,503
listings, none carrying an omod or a clamp, and no f64 mnemonic in the corpus
carries one, so no game shader changes behaviour here. The two translated
fixtures that do carry a modifier move to the unmodified result, which is what
the sweep predicts: cs_f64_add now reads 0x0 0x3ff40000.

Expectations follow the rule in tests/semantic/test_valu_add_f64.py,
tests/semantic/test_f64_round.py, tests/test_f64_output_modifiers.py,
tests/test_f64_transcendentals.py and the two fixtures with their runners.
tools/f64_diff.py keeps its f64-omod case as a known divergence and
tests/test_f64_diff.py now expects it to mismatch the ISA reference rather than
match it: the reference applies the omod the ISA text describes, the translator
no longer emits it, and that case is the one MODE in which the hardware does
apply it. ps_f64_mods, cs_f64_add and ps_f64_round pass on an NVIDIA RTX 4090
(driver 32.0.16.2124) and on the gfx1036 iGPU above, 3/3 on both; cs_f64_add
reads the same words on Intel UHD 630 / Mesa ANV at this head (@gertify).
2026-11-25 00:45:11 +00:00
3edc26bad8 f64_diff: v_div_fixup_f64 reference follows the gfx1036 measurement (F64-DIFF-DIV-FIXUP-REF) 2026-11-24 10:43:46 -06:00
450f321127 Merge remote-tracking branch 'origin/pr/8996' 2026-11-23 17:40:54 -05:00
0b69f14d03 rdna2spirv: an f64 literal's printed width picks the one-dword rule
A literal source is one ISA dword (bits 63:32 of the constant) only when its
printed spelling fits one dword. LLVM pads nothing, so such a literal prints in
at most 8 hex digits; a 16-digit spelling is the whole binary64 value. The
magnitude check from the previous commit read 0x0000000012345678 as the high
word 0x12345678 instead of the low one, and tools/f64_diff.py's CPU reference
made the same mistake, so a generated program could agree with the translator on
the wrong operand.

tools/shader_ir.py records the literal's hex-digit count next to f64_literal
(and now marks v_ldexp_f64's sources too); tools/rdna2spirv.py decides with it at
all three literal readers, and tools/f64_diff.py's read_source mirrors the rule.

Tests: tests/semantic/test_f64_literal_whole.py gains the padded-width case
(0x0000000012345678 -> low word 0x12345678, high word 0) next to the 8-digit
control, and tests/test_f64_diff.py checks the reference reads both spellings the
same way.
2026-11-23 21:26:43 +01:00
f114bfb35c f64_diff: the hw oracle's reference starts with one lane in EXEC
ref_program began with EXEC = 0xffffffff, but the hardware kernel runs one lane, so EXEC is 1 there. Every v_cmpx case (the program reads exec_lo back with s_mov_b32 s22, exec_lo) therefore differed in one word, --oracle hw stopped at the first such case with a false mismatch, and the shrinker reduced it to an unrelated program. ref_program takes exec_lo (default unchanged for the translator and gpu oracles) and run_one passes 1 for hw; the FakeHW test double answers as a one-lane kernel. On gfx1036 the run now gives 294 match, 0 mismatch (it stopped at the first v_cmpx before).
2026-11-23 20:56:24 +01:00
166fd116a8 Round 44 test clashes: CI registration sees inherited tests, runner skips, v_cmpx's EXEC def, wave32-half shuffles, OpFOrdLessThanEqual in spirv_interp, fixed f64 div_fixup divergence, 10_11_11 stores; the macOS runtime configure requires Vulkan
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 04:23:34 -05:00
7bd5f01dd1 FUZZ-55: Route --oracle hw through hw_oracle, fix zero-sum sign, pin the reference
Review follow-up on #4536 (CHANGES_REQUESTED by Flyander; coverage note by kapitche).

- --oracle hw no longer always exits 77. It opens tools/hw_oracle (same pattern as
  tools/fmisc_diff.py), runs each program as a one-lane wave32 raw kernel in the game's
  inferred MODE, honours --hw-arch, and compares the four words with the reference. 77 is
  returned only when the oracle is unavailable. v_rcp/v_rsq/v_sqrt_f64 are counted skips
  there (native results are approximations, PROC-216); the translator-only known-divergence
  exclusions do not apply to hardware.
- add_bits: an exact zero sum now follows IEEE 754-2019 6.3. +0 + +0 stays +0 in every
  mode; only opposite-signed zeros and x + (-x) give -0 when rounding toward negative.
  Before, every exact zero was -0 in that mode.
- tests: direct table tests for compare (16 conditions x 28 operand pairs), class (10
  classes plus boundaries), div_fixup, frexp and add_bits (NaN, inf, zero signs in all four
  modes), plus fake-oracle tests for hw routing, --hw-arch, exit 77, skips and shrinking.
  Mutating lt to <=, add_bits NaN to 0, or dropping the signed-zero rule now fails them.
- docs/shader_validation.md describes the hw contract. No AMD hardware run has been done.

KNOWN_DIVERGENCES keeps div-fixup-nan-s0 (it waits for TEST-983 to reach main).

AI-assisted (OpenBot team).

Co-authored-by: OpenBot <335604065+openbotgit[bot]@users.noreply.github.com>
2026-11-22 23:55:19 -03:00
50b889e3c1 FUZZ-55: Harden binary64 differential probes
AI-assisted (OpenBot team).

Explicitly count FTZ and implementation-defined GPU precision skips, execute known divergence probes, correct compare modeling, and reuse prepared GPU context when shrinking. CPU campaigns and RTX 4070 Vulkan shaderFloat64 campaigns finished with zero unexpected mismatches.

Co-authored-by: OpenBot <335604065+openbotgit[bot]@users.noreply.github.com>
2026-11-22 22:57:33 -03:00