Squash-merged after diff review of PR #6310 - buffer_format_fuzz: an unknown --formats is a usage error before the GPU oracle (EGEN-BUFFMT-EXPLICIT-FIRST)
@AwkGrep256 ran tools/buffer_format_fuzz.py on a real RDNA2 (gfx1036, #2022): the same totals as the
Radeon 880M, 0 mismatches, and 199,144 elements of the 14 GFX10-only codes, also 0. This follows both.
- 16_FLOAT, 16_16_FLOAT and 16_16_16_16_FLOAT format stores round toward zero, saturate at +-65504 and
keep a NaN a NaN (Gen.ufloat_encode_bits, now with an optional sign). d16 data rounding (#1759) is
not touched.
- Every UNORM, SNORM and SCALED store rounds the exact product once (Gen.norm_encode_exact): 0.3 *
65535 stores 19661, not 19660.
- A two-component format stored through a V# takes channel y as its second component when DST_SEL_Y is
Y and DST_SEL_Z a constant (the runtime's X,Y,0,1: gfx1036 narrow-integer fixtures, gfx1150), and
channel w otherwise (identity XYZW, @AwkGrep256 and gfx1150); _xy then writes (x, 0). tbuffer keeps
(x, y). A probe with XYZW alone would have shown (x, w) for every V# and broken the runtime's
selectors, which the oracle now also covers (XY01 runs for the two-component formats).
- Gen.FORMATS has all 77 codes: 30-35 and 37-42 (10_11_11 and 11_11_10 with UNORM..SINT) join.
- buffer_format_fuzz: the model has one store route per path, select_formats runs all 77 codes by
default on a GFX10 device, the known-difference count is gone (0 on the 880M).
The three expectedFailure tests pass; the fixtures that baked the old behaviour (cs_fmt_sint32, test_translate
f16 and int32 store tests, test_value_semantics) take the measured words. Sizes: cs_store 206 KB on
main, 125 KB here.
Co-Authored-By: AwkGrep256 <AwkGrep256@users.noreply.github.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
store_inputs() gave y and w the same value for two-component formats, so run_stores could not
tell the translator's (x, y) from the Radeon 880M's (x, w) for buffer_store_format_*; the zero
mismatches did not validate the second component. The probe now uses a different value in every
register and also runs _xy stores. The hardware model routes a two-component
buffer_store_format_* to (x, w) (_xy: (x, 0)); tbuffer_store_format_* takes (x, y) like the
translator. Those stores are counted as known-difference elements, outside the validated count:
1,330,469 validated elements, 0 mismatches, plus 26,523 known-difference elements.
The translator is unchanged (RDNA2 unmeasured); the difference is pinned as an expectedFailure
in test_buffer_formats_all.py. docs/buffer_formats.md and the design.md row say so.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Raw buffer_load_format_xyzw, tbuffer_load_format_xyzw and buffer_store_format_xyzw /
tbuffer_store_format_xyzw kernels per format on the AMD GPU (tools/hw_oracle), compared word for
word with a CPU model. Formats are mapped by name because GFX11 numbers them differently; the
twelve 10_11_11 / 11_11_10 non-FLOAT codes and the two SCALED 10_10_10_2 codes have no GFX11
spelling. On a Radeon 880M (gfx1150, RDNA3.5, not RDNA2): 1,264,744 elements over 63 formats,
V# and tbuffer, loads and stores, 0 mismatches; --negative-control shows a wrong V# format is
caught.
docs/buffer_formats.md records the measured rules (SCALED stores convert as NORM, float stores
round toward zero and saturate, a 2-bit SNORM half rounds away, NaN payloads, channel fill) and
where the translator's older stores differ.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>