The translator turns a -0 v_mul_legacy_f32 result into +0 under an output
modifier (the measured IEEE-off rule, docs/design.md), but the translator side
of check() still expected the ISA-text model's -0, so
f32_fuzz --programs 1500 --seed 53 reported a false mismatch (program 246).
The hardware side is unchanged: it already files this as dev_omod_neg_zero.
AI-assisted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both tools set sys.dont_write_bytecode and imported rdna2spirv at the
top, so on a checkout without __pycache__ every start compiled the
translator before parsing the arguments: about 20 s to print a usage
line, which made test_no_arguments_prints_usage time out (5 s) in
tests/test_f32_fuzz.py and tests/test_cf_diff.py. They now import it in
the functions that use it.
Also removes the second, identical CliTests class in
tests/test_f32_fuzz.py, which replaced the first one at import.
Supersedes #5056, which conflicts with main.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tools/f32_fuzz.py --oracle hw, seeds 1 to 6, on an RX 6700 XT (gfx1031,
AMD Windows driver 26.11.2): 39,101 programs, 0 mismatch, 66 omod -0 -> +0
deviations. mul:2/mul:4/div:2 behave as measured on gfx1150: applied with
IEEE off and f32 denormals flushed (a -0 result becomes +0), ignored by the
ALU ops with denormals kept (the transcendental and cube ops still apply
them), ignored with MODE.IEEE = 1.
- docs/design.md: merge the two duplicated "Output modifiers on hardware"
rows (one said RDNA2 was unmeasured, the other cited gfx1036) and add the
gfx1031 numbers.
- docs/shader_validation.md: the gfx1031 run and its omod table.
- tools/f32_fuzz.py: omod_label no longer counts a -0 result that the omod
cannot change as "applied" (65 such programs showed up as "applied" in
the ieee column); widen the table's label column; drop "RDNA2 unmeasured".
- tests/test_f32_fuzz.py: the omod_label labels, the -0 case included.
AI-assisted (Claude Code).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
open(path, "w") without newline= turns each \n into \r\n on Windows, so the same JSON report, manifest or assembly
listing was CRLF there and LF elsewhere. 91 text-mode writes (open, os.fdopen, Path.write_text) under tools/, scripts/,
make_game.py and runtime/test/shaders/ now pass newline="\n". tests/test_text_write_line_endings.py reads the source
with ast and fails for a writer that forgets it; CONTRIBUTING.md names the convention.
AI-assisted (Claude), on behalf of dev-ewann.
tools/f32_fuzz.py gains v_rcp_iflag_f32, sharing v_rcp_f32's model (bit-identical on gfx1030 per design.md);
clamp and omod are what is new. On the integrated GPU of a Ryzen 7 9800X3D (gfx1036, AMD driver 32.0.13036.4,
Windows HIP launcher), seeds 1 to 6:
- full sweep on main 41f44826: 38,858 programs, 28,671 match, 0 mismatch, 56 known deviation, the same in
every column as the Linux libdrm run on gfx1036; the negative control catches all six wrong models.
- --ops v_rcp_iflag_f32: 6,552 programs, 5,971 match, 0 mismatch, 35 omod_neg_zero deviations.
design.md's output-modifier row no longer says RDNA2 is unmeasured; shader_validation.md records both runs.
Tested: tests/test_f32_fuzz.py, f32_fuzz --self-test, tests/semantic (1,338 tests), compileall. AI-assisted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On Windows a redirected stdout uses the console's ANSI code page, and python -I ignores PYTHONUTF8 and
PYTHONIOENCODING, so a caller path with a character outside that code page ended a run with
UnicodeEncodeError as soon as a tool printed it. #1406 fixed make_game.py; every CLI tool in tools/ now starts
its __main__ block the same way (stdout errors="replace").
tests/test_tool_stdout_encoding.py checks every tool's __main__ block and reruns two measured crashes
(analyze_4240_full.py, meshlet_page.py) with a private-use-named input. Found by @abilliontokens.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GLSL.std.450 Fma may be split into two roundings by a driver (Vulkan
environment: inherited from OpFMul followed by OpFAdd); RDNA2 v_fma_* round
once. --fma khr (default stays glsl) emits OpFmaKHR with capability FMAKHR and
SPV_KHR_fma and lists shaderFmaFloat32 in the index. Runtime device creation
and the vk_* test programs enable VK_KHR_shader_fma when present; cs_fma_fused
tests single rounding; the mini interpreter learns OpFmaKHR.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- own 'asm rej' column; any rejection outside the GFX11 table exits 2
- known deviation omod_neg_zero only where the omod was active
- omod wording/citations (SIFoldOperands.cpp, D30209), v_min_legacy_f32 is in no GFX10/11 part
- zero_inf probes so the DX9-multiply negative control is caught at small sizes
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Runs the FUZZ-3 programs natively wave32 and judges the hardware against F32Model, with MODE
probes, known deviations, denormal/NaN/clamp/omod tables, probes and a negative control.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tools/f32_fuzz.py runs seeded VOP1/VOP2/VOP3 float programs (neg/abs, clamp,
omod) through an exact-arithmetic RDNA2 model and through the translated
SPIR-V in tests/semantic's interpreter, and compares them bit-exact.
Denormals, and inputs the emitted SPIR-V leaves undefined, are counted
separately instead of being compared.
Translator fixes it found:
- v_mac_f32 is the VOP2 form of v_mad_f32 (product rounded before the add),
not of v_fma_f32 (LLVM getNewFMAInst: V_MAC_F32 -> V_MAD_F32_e64). It
emitted Fma.
- VOP3 clamp and mul:2/mul:4/div:2 were dropped on v_cvt_f32_i32/u32,
v_cvt_f32_ubyte0..3, v_cvt_f32_f16 and v_rcp_iflag_f32 (LLVM
VOPProfileI2F: $src0, $clamp, $omod).
Interpreter: RoundEven keeps the sign of a zero result; Fma rounds once
(it double-rounded through a double); adds OpFDiv, OpIsNan, OpIsInf,
Floor/Ceil/Trunc/Exp2/Log2/Sqrt/InverseSqrt, raising where SPIR-V or
GLSL.std.450 leave the result undefined.
Pinned by runtime/test/shaders/ps_f32_mods.asm (check.py, run_gpu_tests.py,
tests/semantic/test_f32_valu.py) and tests/test_f32_fuzz.py.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>