upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/docs/buffer_formats.md
AgeCommit message (Collapse)Author
13 daysMerge buffer-formats-all-v2 (with main) into buffer-stores-rdna2AlxcBTW
#2022 now carries main's SHADER-358 / SHADER-364, which did what the stores commit did for the three older stores: f16 format stores toward zero (Gen.mem_f16), exact NORM rounding (Gen.encode_norm_bits) and the DST_SEL-dependent routing of a two-component V# store (identity selectors: x, w; the runtime's X,Y,0,1: x, y; tbuffer: x, y). This merge keeps their translator code, drops the duplicate encoders (norm_encode_exact, the y-route flag) and what is left of this branch is: the 12 non-FLOAT 10_11_11 / 11_11_10 codes (Gen.FORMATS now holds all 77, gfx1036 validated them: @AwkGrep256, #2022), the oracle (one store model per path, XY01 store runs, all 77 codes by default on a GFX10 device), the larger cs_fmt_all fixture, and the docs. Co-Authored-By: AwkGrep256 <AwkGrep256@users.noreply.github.com> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
13 daysMerge origin/main into buffer-formats-all-v2AlxcBTW
Conflicts in tools/rdna2spirv.py and docs/design.md. Main had meanwhile fixed three of the older stores this branch found (SHADER-358: f16 toward zero; SHADER-364: exact NORM rounding and the DST_SEL-dependent routing of a two-component format), so the merge keeps main's mem_f16, encode_norm_bits and 2-component swizzle, applies them to the new SCALED kinds as well, and passes the swizzled channels into the shared typed-store encode function (Gen.format_encode_call, now 29 parameters). Gen.norm_encode_exact and EXACT_NORM_CODES go: encode_norm_bits does the same job. The three expectedFailure tests pass now and pin the older stores to the oracle's words; cs_fmt_all's 16_16_SINT store is (x, 0) through its identity-selector V#. design.md keeps one Typed buffer formats row; test_buffer_store_format's unsupported-format example is BUF_FMT_INVALID (8_USCALED is supported now). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
13 daysrdna2spirv: typed stores follow the hardware (f16 toward zero, one NORM ↵AlxcBTW
rounding, two-component routing), all 77 codes @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>
13 daysbuffer_format_fuzz: distinct y and w in the store probe; count the (x, w) ↵AlxcBTW
routing apart 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>
13 daysdocs: note the narrow UINT/SINT codes that main added in parallelAlxcBTW
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
13 daysbuffer_format_fuzz: a hardware oracle for every GFX10 buffer data formatAlxcBTW
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>