diff options
| author | TreXito <81475944+TreXito@users.noreply.github.com> | 2026-11-23 21:45:02 +0000 |
|---|---|---|
| committer | TreXito <81475944+TreXito@users.noreply.github.com> | 2026-11-23 21:45:02 +0000 |
| commit | 3fede91c3f908cf42e7bf1843f0d0a4ddc11b7fe (patch) | |
| tree | b4c1b5e8c95166bec956f885c5ac9500a922559c /docs/shader_validation.md | |
| parent | f447410b49eb4eed2c94a19f7945d219f3f74b39 (diff) | |
| parent | c542d871c196eaa5ad32bf05733464ecbe800c00 (diff) | |
Merge #5029 (fuzz/f16misc-diff)
Diffstat (limited to 'docs/shader_validation.md')
| -rw-r--r-- | docs/shader_validation.md | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/docs/shader_validation.md b/docs/shader_validation.md index a9578696b..1289a2947 100644 --- a/docs/shader_validation.md +++ b/docs/shader_validation.md | |||
| @@ -1573,6 +1573,59 @@ test `test_valu_mul_legacy_denorm.py` checks the exact bit patterns and the two | |||
| 1573 | output scaling. This is a translation for the **inferred game MODE**, not a claim of correctly handling dynamic | 1573 | output scaling. This is a translation for the **inferred game MODE**, not a claim of correctly handling dynamic |
| 1574 | denormal-preserving or IEEE modes; native gfx1013 measurements of these new fixtures were not available. | 1574 | denormal-preserving or IEEE modes; native gfx1013 measurements of these new fixtures were not available. |
| 1575 | 1575 | ||
| 1576 | ### f16 misc ops (`tools/f16misc_diff.py`) | ||
| 1577 | |||
| 1578 | None of the other fuzzers generates these eleven f16 ops: `v_min3_f16`, `v_max3_f16`, `v_frexp_mant_f16`, | ||
| 1579 | `v_frexp_exp_i16_f16`, `v_ldexp_f16`, `v_fmamk_f16`, `v_fmaak_f16`, `v_pk_fmac_f16`, `v_fma_mix_f32`, | ||
| 1580 | `v_fma_mixlo_f16` and `v_fma_mixhi_f16`. `tools/f16misc_diff.py` runs them through the translator and | ||
| 1581 | `tests/semantic/spirv_mini_interp.py`, against an exact-rational model of the `docs/design.md` rows that shares no | ||
| 1582 | code with the translator, and compares the four exported words bit for bit. The model: | ||
| 1583 | |||
| 1584 | - f16 operands and results keep denormals. An f32 operand of `v_fma_mix*` reads a denormal as a zero of its sign | ||
| 1585 | (SHADER-298). | ||
| 1586 | - Every fma rounds once, from the exact value. | ||
| 1587 | - `min3`/`max3` ignore a NaN operand and order -0 below +0. | ||
| 1588 | - `frexp_mant` sets the exponent to 14, `frexp_exp` gives the exponent that goes with it, `ldexp` takes S1 as an | ||
| 1589 | i16 clamped to [-64, 64] and rounds to nearest even into the denormal range. | ||
| 1590 | - `clamp` on `frexp_mant` and `ldexp` takes a NaN or a negative result to +0. | ||
| 1591 | - An output multiplier (`mul:2`, `mul:4`, `div:2`) changes nothing on these f16 results, and `clamp` still acts. On | ||
| 1592 | `frexp_exp`'s integer result `clamp` changes nothing either. Both were measured on gfx1036 in the game's MODE | ||
| 1593 | (f16 denormals kept); see the `design.md` rows for the f16 output modifiers and for `v_frexp`/`v_ldexp_f16`. | ||
| 1594 | |||
| 1595 | `tests/test_f16misc_diff.py` pins the model to the gfx1036 words in `tests/semantic`: all 120 `min3`/`max3` rows of | ||
| 1596 | `test_alu_min3_max3_med3_16_hw.py`, 718 of the 719 `v_fma_mix*` rows of `test_alu_vop3_mods_hw.py` (the other is a | ||
| 1597 | clamp of -0, not judged) and the 24 measured `frexp`/`ldexp` rows. It also checks the model against the semantic | ||
| 1598 | reference of `test_alu_frexp_ldexp_f16.py` on every f16 input. | ||
| 1599 | |||
| 1600 | Sources are VGPRs, SGPRs, a literal and integer and float inline constants, within the GFX10 literal and | ||
| 1601 | constant-bus limits. Modifiers are `neg`/`abs` on VOP3 register sources, `op_sel` on sources and the destination, | ||
| 1602 | `op_sel_hi` on the `v_fma_mix*` sources, `clamp`, and an output multiplier on the VOP3 forms of `min3`/`max3`, | ||
| 1603 | `frexp_mant`, `frexp_exp` and `ldexp`. `--self-test` pins the two refused forms, `neg` and `clamp` on | ||
| 1604 | `v_pk_fmac_f16`, as expected rejections. | ||
| 1605 | |||
| 1606 | A NaN the model computes matches any NaN, since payloads are not modelled. A NaN that only passes through is | ||
| 1607 | compared exactly. Some programs are counted as not judged, with the reason: | ||
| 1608 | - reading such a NaN as bits; | ||
| 1609 | - an all-NaN `min3`/`max3` (the hardware returns src0's bits); | ||
| 1610 | - the clamp of a NaN or a -0 through `FClamp`; | ||
| 1611 | - an f32 denormal result of `v_fma_mix_f32`. | ||
| 1612 | |||
| 1613 | Stages: | ||
| 1614 | 1. A sweep of every source kind with every op and form. | ||
| 1615 | 2. An edge grid of special values with fma near ties and cancellations. | ||
| 1616 | - Some near ties are off the tie by less than half an f32 ulp. There, an fma rounded to f32 and then to f16 | ||
| 1617 | gives a different word, which is the bug class SHADER-55 fixed. | ||
| 1618 | 3. Random seeded programs. | ||
| 1619 | |||
| 1620 | `--exhaustive-f16` adds every f16 input through `frexp_mant`, `frexp_exp` and `ldexp`. A translator skip exits 1, | ||
| 1621 | as a mismatch does. | ||
| 1622 | |||
| 1623 | ``` | ||
| 1624 | python -I tools/f16misc_diff.py --programs 3000 --seed 11 --max-ops 8 | ||
| 1625 | python -I tools/f16misc_diff.py --exhaustive-f16 --programs 0 --no-sweep | ||
| 1626 | python -I tests/test_f16misc_diff.py | ||
| 1627 | ``` | ||
| 1628 | |||
| 1576 | 1629 | ||
| 1577 | ### f16 transcendentals on the hardware (`tools/f16_trans_sweep.py`, FUZZ-29) | 1630 | ### f16 transcendentals on the hardware (`tools/f16_trans_sweep.py`, FUZZ-29) |
| 1578 | 1631 | ||