Repository navigation
Conversation
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>
Gen.FORMATS now holds 65 of the 77 codes a V# or MTBUF can carry. Added: 8/16-bit UINT and SINT, every USCALED and SSCALED, SINT of the wider families, 10_11_11_FLOAT and 11_11_10_FLOAT (unsigned 5-bit-exponent floats), and the SNORM / SCALED / UINT / SINT members of the 10_10_10_2 and 2_10_10_10 families. The twelve non-FLOAT 10_11_11 / 11_11_10 codes stay unsupported: GFX11 has none, so nothing measures them. Stores follow what the Radeon 880M did (RDNA3.5, not RDNA2): SINT and UINT saturate, NORM stores round the exact product (Gen.norm_encode_exact), a SCALED store converts as its NORM format, the small floats round toward zero and saturate to the largest finite value (Gen.ufloat_encode_bits), and a half rounds away from zero in a 2-bit SNORM field. Existing formats keep their emission: with the table cut back to its old 32 codes the output for all 182 runtime/test/shaders is byte-identical to before. tests/semantic/test_buffer_formats_all.py holds the translation to the hardware model for every added format (loads through the V# and tbuffer, stores, hand-worked values) and pins two older stores that differ from the hardware as expected failures. cs_fmt_all.asm is the GPU fixture (28 loads, 15 stores; AMD Radeon 880M and NVIDIA RTX 5070). docs/design.md gets the contract row. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Every buffer_store_format_* site inlined the encode arm of every format, so the larger format table tripled the dynamic-store sites (cs_store 169 KB -> 503 KB), the kind of growth that hit the SPIR-V id bound for loads (ItsNotRexed#884, dcd8ecf). The encode is now one function and the element size another, each store site a call plus the dword stores, like the shared decode. Semantics are unchanged (GPU fixtures cs_store, cs_fmt_*, cs_oob_tail, cs_oob_select and cs_fmt_all pass on a Radeon 880M and an RTX 5070; the semantic suite and the hardware model checks pass). Sizes: cs_store 169 KB -> 90 KB, cs_fmt_sint32 256 -> 269 KB, cs_fmt_1010102 113 -> 163 KB, cs_fmt_xy_xyz 468 -> 406 KB, cs_oob_tail 71 -> 96 KB (load decode arms). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…at still is not Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…, w) 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>
# Conflicts: # docs/design.md # tests/test_shader_checks.py
…ture Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…RM rounding, two-component routing), all 77 codes @AwkGrep256 ran tools/buffer_format_fuzz.py on a real RDNA2 (gfx1036, ItsNotRexed#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 (ItsNotRexed#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>
…-stores-rdna2 # Conflicts: # docs/design.md
|
Tested de8b775 on NVIDIA GeForce RTX 3090 (Ampere, subgroup 32..32), driver 610.88 (Vulkan 1.4.341), Windows 11 Pro 26300: pass. The PR's diff applied cleanly to
|
|
Tested
AI-assisted run. |
|
Tested Test programs built from The typed-store words match the PR's derivation on a second vendor and driver (4 shaders translated, 4 pass |
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>
ItsNotRexed#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, ItsNotRexed#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>
Conflicts in docs/design.md (main's Buffer format stores row kept, the "and the formats of the Typed buffer formats row" suffix and the Typed buffer formats row added once) and tests/test_shader_checks.py: TOTAL counts main's 12 fixtures (three mesh, ps_tex, ps_imgatomic, five compute, ps_ssharp, vs_base_ids) plus cs_fmt_all, so + 13. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Conflict in docs/design.md only: main's Buffer format stores row kept (with the Typed buffer formats suffix), this branch's Typed buffer formats row (all 77 codes) kept once. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Conflicts: tools/rdna2spirv.py (main's x_round state next to this branch's fmt_enc_fn, and the function types of both: both kept), docs/design.md (main's rows, our Typed buffer loads sentence re-applied), tests/test_shader_checks.py (TOTAL: main's 13 plus cs_fmt_all = 14, and both mock branches kept; 75 tests pass). Main's typed-buffer work that overlaps (aa2988c: byte size of the format from one table, SHADER-429: DST_SEL=1 on out-of-bounds typed loads) merged without conflict and takes this branch's formats from Gen.FORMATS. Ten tests in test_mutations, test_cmp_class_f64, test_loop_ballot_barrier and test_vcmp16_opsel fail on origin/main itself, with and without this branch. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ores-rdna2 Conflict in docs/design.md only: v2's rows (main's with the Typed buffer loads sentence) kept, with this branch's "Others (code 0 and 78 up) give 0". Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Scope changed. The store semantics this PR was written for landed on
mainfrom other PRs:DST_SEL-dependent two-component swizzle: SHADER-364, @Faterek, 0ead0a6.I merged
mainand kept their implementation. My duplicate encoders and they_routeflag are gone.What's left in this PR, on top of #2022:
10_11_11/11_11_10codes, soGen.FORMATScovers all 77 buffer format codes a GFX10 V# can carry.tools/buffer_format_fuzz.pynow checks the store paths, including the two-component routing, against real RDNA hardware. On the Radeon 880M it validated 1,385,360 elements with 0 mismatches.cs_fmt_allnow covers every code, with semantic tests to match.Tested:
test_translate543 passed, 4 skipped. The semantic shards,test_shader_checksandtest_tool_stdout_encodingare clean.cs_fmt_*,cs_store,cs_oob_*andcs_tbuffer_storepass on the AMD Radeon 880M and the NVIDIA RTX 5070.Depends on: #2022. Until #2022 lands, this diff also shows it. Claimed in #1548.
AI-assisted (Claude Code). No game files.
🤖 Generated with Claude Code