tools/pknorm_probe.py runs v_cvt_pknorm_i16_f32 / v_cvt_pknorm_u16_f32 through the translator on the CPU interpreter
and, with --oracle hw, natively through tools/hw_oracle in wave32 and wave64 under five MODEs. On an RDNA2 iGPU
(gfx1036) every NaN half (74 of 74: quiet, signalling, both signs, payloads, in S0 and S1) gives 0, as the translator
assumes, whatever IEEE, DX10_CLAMP and the f32 denormal mode are.
The rounding does not match: the hardware rounds the exact product x * 32767 (or 65535) once, while the translator
rounds the f32 OpFMul product and then RoundEven, one off on 28 of 28 near-tie inputs in both directions. Recorded in
docs/design.md and docs/shader_validation.md; the translator is not changed here. tests/test_pknorm_probe.py checks
four near-tie words against a hand derivation and the translator side's double rounding and NaN zero.
- int_hw_probe: VOP3 clamp on the carry-out add/sub ops (#1831) and v_cvt_rpi/flr's exact floor(x+0.5) and NaN
sign saturation (#1856) now translate as gfx1035 measured, so KNOWN_DIVERGENCES is empty. The known-divergence
test reports a synthetic entry. shader_validation.md says so, and design.md loses the stale duplicate
v_cvt_flr/rpi row a "both" merge left that still called them open.
- docs/README.md: one Other languages line (fr, pt-BR, zh-CN, pl-PL, tr, ru, ja); docs/i18n/README.md: one row
each for pt-BR and zh-CN (the newer).
- anim_rigs, d16_format_probe, pe_shader_containers: text writes name newline="\n" (#1615);
pe_shader_containers guards stdout (#1428).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
crosslane_fuzz.py --dpp-sweep runs one program per DPP case instead of random
ones: every DPP16 control (335) x bound_ctrl x fi x 3 EXEC patterns, all 256
row_mask/bank_mask pairs, and 19 DPP8 select sets x fi (7,206 per wave size).
Ops rotate through mov/not/add/xor, half of them in place. Failures print
the case label, and a per-family table follows the summary.
Gen.op_dpp now builds through dpp_op() with the same random draws, so
existing --dpp seeds give the same programs (pinned by a test).
On an RX 6700 XT (gfx1031, Windows HIP oracle): --dpp-sweep --oracle hw
--wave both gives 14,412/14,412 matching, and random --dpp seeds 1-8 give
8,000/8,000. Docs updated (shader_validation.md FUZZ-7, design.md DPP row).
AI-assisted (Claude Code).
docs/saves.md and the tools/saves.py docstring named
runtime/shims/xgameruntime_services.cpp as the runtime's save store; that file
is only in the open #279, and on main XGameSave* imports get the loader's
default answers. docs/shader_validation.md named spirv_mini_interp without
its .py. tests/test_docs_repo_paths.py checks that backticked tools/,
runtime/, tests/ and scripts/ paths in docs/ name tracked files.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Hardware measurement on RDNA2 (gfx1036, finding 7079901079) confirms that
v_fma_mixlo_f16 / v_fma_mixhi_f16 round the exact fma once, straight to
f16, across all rounding modes (7 of 7 discriminating cases in
tools/fma_mix_probe.py match single rounding). The translator previously
double-rounded in nearest-even mode (f32 Fma then f16 narrow).
Change v_fma_mixlo_f16 / v_fma_mixhi_f16 to use Gen.fma_mix_odd across all
modes, which rounds to odd at f32 so that narrowing to f16 gives the
exact single-rounded result in both nearest-even and toward-zero modes.
Update tests/test_fma_mix_probe.py and docs/shader_validation.md to reflect
the RDNA2 hardware measurement, and add discriminating semantic tests in
tests/semantic/test_valu_fma_mix.py.
AI-assisted.
Hardware measurement on RDNA2 (gfx1036, finding 7079901079) confirms that
v_fma_mixlo_f16 / v_fma_mixhi_f16 round the exact fma once, straight to
f16, across all rounding modes (7 of 7 discriminating cases in
tools/fma_mix_probe.py match single rounding). The translator previously
double-rounded in nearest-even mode (f32 Fma then f16 narrow).
Change v_fma_mixlo_f16 / v_fma_mixhi_f16 to use Gen.fma_mix_odd across all
modes, which rounds to odd at f32 so that narrowing to f16 gives the
exact single-rounded result in both nearest-even and toward-zero modes.
Update tests/test_fma_mix_probe.py and docs/shader_validation.md to reflect
the RDNA2 hardware measurement, and add discriminating semantic tests in
tests/semantic/test_valu_fma_mix.py.
AI-assisted.
docs/design.md narrowed the f16 of a typed d16 buffer load from the f32 decode with round to nearest even, and
called that rounding inferred, not measured. tools/d16_format_probe.py measures it through tools/hw_oracle: every
UNORM8, SNORM8, UNORM10, UNORM16 and SNORM16 value through buffer_load_format_d16_x, tbuffer_load_format_d16_x
and buffer_load_format_x, in wave32 and wave64, against several candidate rules, with a 16_FLOAT load, the kept
high half of d16_x and the staged inputs as controls.
On an RX 6700 (gfx1031) the hardware rounds the exact quotient once, straight to f16. Rounding to f32 first is
1 ulp high on exactly four values (UNORM16 0xffaf and 0xffef, SNORM16 0x7ff7 and 0x8009); over every width up to
16 bits only two f32 quotients land on an f16 halfway point (0x3f7ff000, 0x3f7fb000). Gen.d16_norm_f16 takes the
f16 below for those two, for normalized formats only. The f32 (non-d16) result was already right.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Raw kernels through the hardware oracle on a gfx1036 iGPU (AMD Windows driver
32.0.21044.64, HIP backend), 1,385 programs in wave32 and wave64, identical
words in both:
- an omod on an f16 result (v_add/mul/fma/fmac/cvt/exp/rcp_f16) acts only with
IEEE 0 and denorm_mode_16_64 = 0; omod comes before clamp; clamp gives +0
for -0 and, with DX10_CLAMP 1, for a NaN;
- v_fma_mix* operands: a float inline constant is f32 or the f16 constant
(zero high half) by op_sel_hi, an integer constant its 32-bit integer;
denormals follow the mode of their own width; NaN payloads are kept;
- v_fma_mixlo/mixhi_f16 round once (fma_mix_probe --oracle hw, 7 of 7 ties);
- v_exp_f16 / v_log_f16 repeat gfx1031's sweep counts exactly.
The translator is compared word for word and differs in five ways, listed
in docs/shader_validation.md; none is fixed here. Docs only. AI-assisted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
AMD clang rejects .amdhsa_ieee_mode and .amdhsa_dx10_clamp on gfx1170+
(GFX11.7 and GFX12, where the behaviour is fixed). A kernel asking for
either reached the assembler, and when a chunk held only such kernels the
run died with 'the assembler rejected every program in a chunk'.
asm.mode_skip_reason names the field and the architecture; Oracle.run
returns that reason for those kernels and never assembles them, so the
others still run and the MODE probes fail with a clear message. The
denormal and rounding fields are unaffected.
tests/test_hw_oracle.py covers the reason per architecture, a mixed run
and a run where every kernel is skipped. docs/shader_validation.md notes
it.
Runs the same texel fetches as raw compute kernels on the AMD GPU through tools/hw_oracle/: a linear texture the
kernel carries in its own code (256-byte aligned, found with s_getpc_b64), a T# built in s[8:15] for the GPU's family
(hw_oracle/tsharp.py: GFX11 on gfx11xx, GFX10 on gfx103x/gfx10xx), image_load with every dmask for one texel per lane,
all four result registers stored and compared word for word with the CPU model. --oracle translator,hw runs both on
the same textures; --negative-control checks seven wrong models and a wrong T# FORMAT are caught. Exit 77 without the
tools. gfx1150 is RDNA3.5, not RDNA2: the docs say so.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The valu_fuzz hardware oracle (#1365) had not run on RDNA2, and the
v_pack_b32_f16 row said "RDNA2 not measured". On a gfx1036 iGPU (AMD Windows
driver 32.0.21044.64, HIP backend, AMD clang 23):
- f16 and mem, seeds 101-105 x 2000 x wave32/wave64: 40,000 of 40,000 match,
0 assembler rejections; every negative-control perturbation caught.
- translator,hw at seed 3: mem 200/200, f16 199/200; the difference is an AMD
Vulkan driver mismatch of the #1506 kind.
- v_pack_b32_f16 quiets a signaling-NaN half under IEEE mode 1 and moves it
unchanged under IEEE mode 0; neg flips the sign first.
BUILD-422. Docs only. AI-assisted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The differential fuzzer guide still described MTBUF selector behavior as unmeasured. Record the native bound, unbound and missing-channel behavior exercised by the reference tests.
valu_fuzz.py, lds_fuzz.py and crosslane_fuzz.py ask vk_compute_test for
32-lane subgroups (VKC_SUBGROUP_SIZE=32) for wave32 programs, but they
ignored its "compute subgroup size: 32 not available" line. On a device
that can't pin that size (Mesa llvmpipe: 8 lanes) every wave32 program
was judged at the driver's size and its cross-lane results came out as
translator mismatches. On main f85582e with llvmpipe, lds_fuzz --emulate
--programs 400 --seed 5150 gave 215 mismatches, all wave32, and
crosslane_fuzz --wave 32 --no-maskdata gave 68 of 100.
Those wave32 programs are now skips, as check.py's unpinned_subgroup_skip
does for its lane-mask dumps. Programs translated with --wave64-emulate
use no subgroup operations, so they are still compared at any size
(400 of 400 match on llvmpipe). crosslane_fuzz counts the skips in its
summary and exits 2 when every program was skipped, as the other two
fuzzers already do.
The line is parsed by compute_fixture.unpinned_subgroup, shared by the
three fuzzers.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
asm.py keeps main's lds/vgprs validation, lists in metadata and the 1024 workgroup size and adds sgprs per kernel.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LLVM 23 writes code object v6, which amdhip64_6.dll refuses with error
209: retry the probe as v5 and keep that version for the run.
LLVM 23 also wants v8.l for 16-bit operands on GFX11: ask the assembler
once, and use that spelling for the f16 ops the oracle's tools run.
Tested on a Radeon 780M (gfx1103), driver 32.0.11020.1002.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mem translator path ran on the Radeon 880M: 400 of 400 match. Docs: --show line back in the options list.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merges #1265 (libdrm backend, gfx10_spelling) keeping both raw_kernel_text changes. The kernel
metadata's .max_flat_workgroup_size is now 1024 (was 256) so 256-thread groups launch.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tools/hw_oracle ran only on Windows, through the HIP runtime in the AMD
driver, and so far only on gfx1150. On Linux the same kernels now run as
raw compute dispatches through the kernel driver: no ROCm, only clang
with the amdgcn target, gcc and the libdrm headers.
- hw_oracle_drm.c is the launcher. Its command stream is libdrm's own
compute dispatch test for GFX10 (amdgpu_test_dispatch_memset), with
what belongs to the kernel put in: the entry point, the group size,
the kernarg pointer in two user SGPRs, and COMPUTE_PGM_RSRC1,
COMPUTE_PGM_RSRC2 and the wave size as the kernel's descriptor has
them. So the .amdhsa_* directives (register counts, float rounding
and denormal modes, IEEE, DX10 clamp) take effect as under the HIP
runtime. It prints the same lines as hw_oracle.c. Compute engine
version 10 only (RDNA1 and RDNA2).
- drm.py is the backend: it assembles with clang, takes .text, the
kernel offsets and the kernel descriptors out of the object, and runs
the launcher. A descriptor that asks for what the launcher does not
provide (LDS, scratch, more user SGPRs) is refused. The render node
must be named in LEONIDA_HW_DRM_NODE, and a node with a display
connected is refused unless LEONIDA_HW_DRM_ALLOW_DISPLAY=1.
- runner.open_oracle() picks the backend for the platform. The Windows
path is unchanged.
- asm.raw_kernel_text puts the GFX10 names of the global memory
instructions back for gfx10xx. crosslane_fuzz stores with
global_store_b32, which a GFX10 assembler does not have, so on RDNA2
every one of its programs was rejected.
One thing the launcher had to learn: while it rewrote one command buffer
in place, the second kernel of every process ran the first kernel's
commands (200 of 200 runs). Every submission now gets command memory of
its own; 24,500 distinct kernels in both wave sizes then each returned
their own words, and a test runs 300 of them.
Results on the integrated GPU of a Ryzen 9 7950X3D (Raphael, gfx1036),
Linux 7.3.5, libdrm 2.4.134, clang 23.1.5:
- salu_diff --oracle hw: 70,000 programs, 69,021 run, 0 mismatches
(seeds 1-8; seeds 1-4 with --bfe-any; seeds 1-2 with --inline64). The
s_bfe_i32 rule measured on gfx1150 holds on RDNA2, and s_ff0_i32_b32
and s_ff0_i32_b64, which gfx1150 lacks, match (2,000 programs).
--oracle translator,hw: 3,000 programs pass.
- crosslane_fuzz --oracle hw: 32,000 programs, 0 mismatches: seeds 1-6
(12,000 wave32, 12,000 wave64, 6,586 with the permlane hypothesis)
and seeds 1-2 with --dpp (8,000, 972 with the DPP hypothesis).
- f32_fuzz --oracle hw, seeds 1-6: 38,858 programs, 28,671 match, 0
mismatches, 56 known deviations (an output modifier turns -0 into +0,
as on gfx1150), the rest skipped or not judged. The four MODE settings
read back as the descriptors set them.
- Controls: a reference with s_min_i32's SCC changed from < to <= gives
2 mismatches in 5,000 programs, minimized to that instruction;
crosslane_fuzz --permlane-fetch-inactive mismatches in 239 of 1,000;
f32_fuzz --negative-control catches all six wrong models.
- No GPU fault, timeout or reset in the kernel log.
Tests: tests/test_hw_oracle.py gains tests of the backend that need no
GPU (reading the object and its descriptors, tokens, the display check,
the platform choice, the GFX10 mnemonics) and two on hardware: 300
distinct kernels, and an f32 rounding mode set in the descriptor that
must change a sum. The HIP-only test skips on Linux.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
tools/f16_trans_sweep.py runs all 65,536 f16 bit patterns through v_exp/log/rcp/rsq/sqrt/sin/cos_f16 natively
(8 raw kernels of 1,024 threads per op), in wave32 and wave64 and five MODEs (IEEE, f16 denormal mode, f16
round toward zero), reads MODE back first, and compares each word with the exact result correctly rounded to
f16 (decimal, 60 digits; sin/cos reduced in turns). It counts bit-exact, 1 ulp, >1 ulp, denormals read or
written as zero, signalling NaNs kept or quieted, and the inputs where SPIR-V is undefined, and lists the words
of 23 special inputs.
On an RX 6700 XT (gfx1031): the five non-trigonometric ops are correctly rounded on every non-NaN input; sin/cos
are exact in turns over the whole f16 range (14 and 4 results 1 ulp off, all at |x| <= 1), while the f32
product 6.2831855 * x is >1 ulp off on 16,366 sin and 2,036 cos inputs (#594). denorm_mode_16_64 = 0 flushes
denormal operands and results, FP_ROUND's f16 field is ignored, IEEE only quiets signalling NaNs. The results
go into docs/design.md (a new f16 transcendentals row) and docs/shader_validation.md.