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>
…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>
… the f16/f64 div_fixup output multipliers
…xed#6314) ItsNotRexed#6314 measured on gfx1036 that an f16 or binary64 result ignores mul:2, mul:4 and div:2 under denorm_mode_16_64 = 3 (the game's MODE) while an f16 clamp still saturates, and main now translates them that way. The fuzzer left them out (f16: SHADER-297 open; f64: the translation needed Float64). - v_div_fixup_f16: mul:2/mul:4/div:2, with and without clamp, either half. - v_div_fixup_f64: mul:2/mul:4/div:2 (clamp still needs Float64: not generated). - The reference leaves the result unscaled; two multipliers on one line are a harness error. - Edge grid: every rule's result under the f16 multipliers (both halves, with and without clamp) and the f64 multipliers. - --self-test pins f16 "clamp div:2" of 1.5 = 1.0 and f64 "mul:4" of 1.5. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Tested
For a negative control, I ran the new fixed-program test against the harness from the immediate parent, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on: #5086. This branch is #5086's head (
4f5e641f) merged withmain4beffda8plus one commit, so only the last commit is new. Claimed in #6414 (#6414 (comment)).#6314 measured on gfx1036 that
mul:2/mul:4/div:2are dropped on the f16 and binary64 results ofv_div_fixup_f16andv_div_fixup_f64underdenorm_mode_16_64 = 3, the game'sMODE, while an f16clampstill saturates.mainnow translates them that way (has_clampin the lowering). #5086'stools/div_fixup_diff.pyleaves both out: f16 multipliers because SHADER-297 was open, and every f64 output modifier because the translation needed Float64. This PR generates them.Changes (
tools/div_fixup_diff.py)v_div_fixup_f16:mul:2,mul:4,div:2, with and withoutclamp, in either destination half.v_div_fixup_f64:mul:2,mul:4,div:2.clampon f64 is still not generated: it needs Float64, whichspirv_mini_interpdoes not run.clampstill applies.docs/design.mdrow ("the scaling is dropped") to every result, so a ±0, inf, NaN or denormal result under a multiplier follows the row, not a measurement.clamp): +294 cases;--self-test:clamp div:2of 1.5 is 1.0, not 0.75;mul:4of 1.5 stays 1.5.Tested
Linux, CPU only: the translator plus
tests/semantic/spirv_mini_interp.py. Rig: an i5-12400F with Python 3.13.5.--programs 3000 --seed 11 --max-ops 8--programs 3000 --seed 12 --max-ops 8--programs 3000 --seed 13--ops v_div_fixup_f16 --programs 3000 --seed 14--ops v_div_fixup_f64 --programs 3000 --seed 15--programs 400LEONIDA_TOOLS_DIR), seed 11 as aboveJudged programs are the sweep, the edge grid and the random programs together. The not-judged counts are the kinds #5086 already lists (clamp of an f16 NaN, f32 multipliers on -0 or denormals, and the like); this PR adds none.
The last row is the check that the new cases bite: with
tools/rdna2spirv.pyfrom before #6314, which scaled the f16/f64 result, 866 of the same 4,100 programs mismatch (59 sweep, 44 edge grid, 763 random). Locally, seeds 1 and 2 against that translator give 206 of 2,100 and 197 of 2,093 mismatching programs.tests/test_div_fixup_diff.py: 25 passed (22 before).mul:2, f16op_sel+clamp div:2and f64mul:4matches through the translator.mul:2or the f64mul:4and checks that both are caught.tests/test_docs_*.py,compileall,git diff --check: pass.python -I tools/div_fixup_diff.py --self-test: ok.Docs
docs/shader_validation.md: the div_fixup section now states the f16/f64 multiplier rule and lists them as generated.No game data. AI-assisted (Claude Code).
🤖 Generated with Claude Code