diff options
| author | Eremia Brinzoi Razvan Andrei <razvaneremia04@gmail.com> | 2026-11-22 13:25:04 +0200 |
|---|---|---|
| committer | Eremia Brinzoi Razvan Andrei <razvaneremia04@gmail.com> | 2026-11-22 13:25:04 +0200 |
| commit | 013cfb3966885cb6b7b81d5708d4e2e1dfd16fe6 (patch) | |
| tree | 48f09ee2b0f53a2416c16e66a3a95a994a884a77 /scripts/run_gpu_tests.py | |
| parent | c2967a5e60060e4068fb992196d8f4b494a5046c (diff) | |
tools: fma_mix_probe tells single from double f16 rounding of v_fma_mix
docs/design.md leaves one f16 question open: in round-to-nearest mode, does
v_fma_mixlo/hi_f16 round the exact x * y + z once to f16, or to f32 first
and then narrow? The translator does the second (f32 Fma, then f16_res).
The RX 6800 word behind the toward-zero rule can't settle it, because
1 * 2 - 2^-30 gives 0x4000 under both readings in nearest mode.
tools/fma_mix_probe.py has seven inputs where the two rules differ by one
f16 ulp, plus a control:
- ties just above and below, for both signs;
- the subnormal tie at 2^-25;
- the overflow tie at 65520;
- a tie made by the product;
- the same with f16 operands.
It reports which rule each side follows:
- the translator, on the CPU interpreter;
- --oracle hw: the native instruction on an AMD GPU, through
tools/hw_oracle, under the game's inferred MODE;
- --oracle vulkan: the translated compute shader through vk_compute_test,
with operands in user SGPRs so the driver can't fold them.
tests/test_fma_mix_probe.py checks:
- the expected words against a derivation written out by hand;
- that the translator follows the double rule today;
- that the compute listing gives the pixel shader's words;
- the verdict and exit codes.
On an RTX 5060 (621.24) the translated shader follows the translator's rule
on all eight inputs. A translator copy that uses fma_mix_odd in nearest mode
gives the single-rounded words on the CPU and on the GPU. That is the fix
if AMD hardware turns out to round once. The translator itself is unchanged.
AI-assisted (Claude Code).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'scripts/run_gpu_tests.py')
0 files changed, 0 insertions, 0 deletions