Repository navigation
Conversation
No fuzzer generated the three div_fixup ops. tools/div_fixup_diff.py runs seeded programs through rdna2spirv and spirv_mini_interp against a bitwise model of the docs/design.md rows (gfx1036 measurements) and compares the exported words bit for bit. - Sources: VGPRs, SGPRs, a literal (not on f64), inline constants; f64 VGPR pairs (odd ones too) and SGPR pairs; abs/neg, f16 op_sel, clamp, f32 mul:2/mul:4/div:2. - Stages: every encodable source-kind combination, an edge grid (rule order, the -151/-1076 exponent cutoffs, NaN payloads under abs/neg, output modifiers on each rule's result), random chained programs. - tests/test_div_fixup_diff.py pins the model to the 73 measured f32 rows and the f16/f64 rows in tests/semantic. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
I measured peak Python allocations during generation on Windows with CPython 3.14 at
The hashes match at both sizes. The generator uses the same seeded loop and yields each AI-assisted. |
Kam471
left a comment
There was a problem hiding this comment.
Ran this at 66ab513b5 on Windows 11: pytest tests/test_div_fixup_diff.py -q -> 21 passed, 118 subtests passed; git diff --check clean.
The new tools/div_fixup_diff.py differentially fuzzes v_div_fixup_f16/f32/f64 against the reference model, including the NaN/inf/zero-sign cases and the f16 rounding path; the 299-line test suite covers the op table, the accepted forms and the mismatch reporting. I cannot run the hardware oracle here. No blocking issue.
|
Independent check — pass (CPU only, no game files). Environment: Windows 11, CPython 3.15.2.
AI-assisted (Devin). |
…uilding the whole list run_sweep, grid_items and run_suite built every (label, lines, ops) tuple before _run checked the first, so peak memory grew with --programs. sweep_items, grid_items and suite_items now yield one at a time. Same seeded programs (SHA-256 of every program matches), same output for --programs 300 --seed 1. Generation-only peak at 5,000 programs: 7,715,187 -> 28,026 bytes. From shdann's review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks, shdann. Confirmed, and fixed in 4f5e641. Change. Same programs. I hashed every generated program, as you did, with
These figures are New test. Re-run on 4f5e641
Environment: Linux 7.0, Python 3.14.4, CPU only. #5029 ( AI-assisted (Claude Code). |
…lding the whole list run_sweep, run_grid, run_exhaustive and run_suite built every program before _run checked the first, so peak memory grew with --programs and --exhaustive-f16 held all 49,152 programs. sweep_items, grid_items, suite_items and exhaustive_programs now yield one at a time. Same programs (SHA-256 of every program in all four stages matches), same output for --programs 300 --seed 2. Generation-only peak: --exhaustive-f16 64,279,176 -> 305,573 bytes, 3,000 random programs 5,092,014 -> 310,551. Same pattern shdann found in ItsNotRexed#5086. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Independent Windows check of
The |
|
Tested
|
…lding the whole list run_sweep, run_grid, run_exhaustive and run_suite built every program before _run checked the first, so peak memory grew with --programs and --exhaustive-f16 held all 49,152 programs. sweep_items, grid_items, suite_items and exhaustive_programs now yield one at a time. Same programs (SHA-256 of every program in all four stages matches), same output for --programs 300 --seed 2. Generation-only peak: --exhaustive-f16 64,279,176 -> 305,573 bytes, 3,000 random programs 5,092,014 -> 310,551. Same pattern shdann found in ItsNotRexed#5086. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claim: #4933 (comment)
What and why
No fuzzer generates
v_div_fixup_f16orv_div_fixup_f32.v_div_fixup_f64is one of the 47 forms in #4536 (tools/f64_diff.py, open). The three lowerings are hand-written bit logic: an eight-rule priority order, an exponent cutoff on biased fields, f32 denormal handling that differs by operand,op_selhalves on f16 and output modifiers on f32. The semantic tests check chosen words with VGPR sources.tools/div_fixup_diff.py(new) runs seeded programs throughrdna2spirvandspirv_mini_interpand compares the four exported words bit for bit with its own model. The model works on the operand bits and shares no code with the translator.Reference (the
docs/design.mdrowsv_div_fixup_f32andv_div_fixup_f16, v_div_fixup_f64, measured on gfx1036)absthennegact on the sign bit, NaNs included.mul:2/mul:4/div:2, thenclamp, which takes a NaN or any negative value to +0.tests/test_div_fixup_diff.pypins the model to all 73 measured rows oftests/semantic/test_alu_div_fixup_f32.pyand to the f16/f64 rows oftest_alu_div_fixup.py, the measured cutoffs among them.Generated
0.15915494309189532as the exact binary64 1/(2 pi).neg/abson every register source,op_selon f16 sources and the destination half,clampon f16/f32, output multipliers on f32.Not generated: a literal on f64 (#3791 moves it to bits 63:32), output multipliers on f16 (SHADER-297), any output modifier on f64 (needs Float64, which the interpreter does not run).
Not judged (counted with the reason):
clamp(the hardware gives +0, listed as not modelled) or on an f32 denormal;clampof a positive f32 denormal, an f16 -0 or an f16 NaN (FClampof a NaN is undefined).Stages: a sweep of every encodable source-kind combination (279), an edge grid (3,585 cases in 1,155 programs: rule order, cutoff at -1/0/+1 also against a NaN or inf S0, NaN payloads under
abs/neg, output modifiers on each rule's result), then random programs. Each stage yields its programs one at a time, so memory does not grow with--programs(4f5e641, from review).Tested
--programs 10000 --max-ops 8(each with the sweep and grid: 11,713 programs)--opswith one op,--programs 5000 --max-ops 8 --seed 77--programs 300 --seed 1(sweep, grid, random: 2,013 programs)--self-testpython -I tests/test_div_fixup_diff.pytests/test_docs_*.py,tests/test_text_write_line_endings.pyMutations of the translator's lowerings (
--programs 300 --seed 1; every mutant exits 1, the unmutated translator exits 0):clampwithout the NaN-to-+0 selectclampop_selignored on S20x7e00, not0xfe00absclears bit 31 of the low wordD shows as skips, not mismatches: without the NaN select, the interpreter refuses
FClampof a NaN, and a skip exits 1.Setup: CPU only, no GPU needed.
Docs: a subsection in
docs/shader_validation.md, placed away from the one #5029 adds so the two merge cleanly.No game data. AI-assisted (Claude Code).
🤖 Generated with Claude Code