Commit Graph

99 Commits

Author SHA1 Message Date
7aa255ab8e Merge pull request #2237 from syfyra/perf/translator-piecewise-parse
tests: parse the translator in pieces: 7 s -> 1 s per uncached import, 60 s -> 17 s in five standalone tests (TEST-TRANSLATOR-PIECEWISE-PARSE)
2026-12-01 16:18:04 +01:00
b10fce131c Merge pull request #953 from hugo0024/shader-wavemask-eager
rdna2spirv: the wave mask gather is stored before it is read, so every lane runs it (SHADER-WAVEMASK-EAGER)
2026-11-28 15:53:52 +01:00
c8f95e1d0e Merge pull request #762 from whoalin1/test-545-real-oracle
OLD-3011: tests/semantic: run v_div_fixup_f32 through the translator, not a mock oracle (TEST-545)
2026-11-28 12:54:17 +01:00
a3606a99dd Merge pull request #1683 from hugo0024/shader-permute-eager
rdna2spirv: ds_permute_b32 stores its shuffles, so every lane runs them (SHADER-PERMUTE-EAGER)
2026-11-28 12:53:08 +01:00
2d62a50a0d tests/semantic: run v_div_fixup_f32 through the translator, not a mock oracle (TEST-545)
tests/semantic/test_valu_div_fixup.py compared a hand-written Python model of the
fixup against itself and never imported tools/rdna2spirv.py, so it passed whatever
the translator did, and its rules had drifted from native RDNA2 (gfx1036) on six
points (NaN priority, the sign of 0/0 and inf/inf, inf(S2), the copysign of the
pass-through, NaN(S0), and the exponent-difference cutoff).

It now translates hand-written listings and asserts what the translator emits: the
pure-integer lowering's op order and classification constants, NaN(S2) above
NaN(S1) read off the dataflow, one word per measured rule through
spirv_mini_interp, and the EXEC-masked and null-destination cases. The f16 model
is gone rather than ported: the translator has no v_div_fixup_f16 lowering yet
(#2477 adds it with its own translator tests).

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
2026-11-28 12:03:00 +02:00
772c7bc3f3 rdna2spirv: ds_permute_b32 stores its shuffles, so every lane runs them (SHADER-PERMUTE-EAGER)
Gen.ds_permute lets each destination lane scan the 32 source lanes of its half: per source
lane a shuffle of the published target, a shuffle of the data and an OpSelect that keeps the
data when the target is this lane. Each shuffle was used once and so was every link of that
chain, so SPIRV-Cross (MoltenVK) wrote the 32 steps as one nested ternary under the EXEC
ternary of the register write. A lane that takes an outer arm, or is off in EXEC, then runs
none of the shuffles inside it (the SHADER-529 mechanism).

On an Apple M5 (MoltenVK 1.4.2) tools/lds_fuzz.py --wave 32 --permute had 17 of the 100
programs of seed 31002 differ from the model, every one in a ds_permute_b32 result, mostly 0
where a source lane's data belongs. Both shuffles are now stored to Function variables
(Gen.eager), as the DPP rule stores its ballot bit and its shuffle.

tests/semantic/test_ds_permute_eager.py checks the three native forms with
test_dpp_eager_subgroup.py's model of SPIRV-Cross's single-use forwarding, and the values
against test_ds_permute.py's ISA model.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-28 12:44:48 +08:00
420116dbbc tests: cs_fma_fused takes its f16 operands at run time, like its f32 ones (TEST-FMA-FUSED-F16-RUNTIME)
The fixture reads the operands of its f32 multiply-adds from s4..s7 so that a driver has to
compute them at run time. The three operands of its v_fma_f16 were literals, which made the
whole f16 multiply-add a compile-time constant. MoltenVK 1.4.2 gives the wrong constant: word
7 read 0x0000 on an Apple M5 (0x3c00 in the docs' row) where 0x7351 is expected, the
cs_fma_fused failure listed in docs/testing.md and in the macOS job's EXPECTED_FAILURES. The
same translation with any one of the three operands taken at run time gives 0x7351.

The triple is now the s4 word XOR a literal each, so the test checks the translator's
round-to-odd sequence as the GPU runs it. The translator is not changed.

tests/semantic/test_fma_fused_fixture.py runs the fixture in the interpreter against the eight
words of its header and checks that no multiply-add in it reads a register only literals fed.
The Known problems row says what is left: an f16 multiply-add with only constant operands.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-28 12:44:48 +08:00
bed544a1d3 rdna2spirv: the wave mask gather is stored before it is read, so every lane runs it (SHADER-WAVEMASK-EAGER)
A register holds this lane's bit of a lane mask; v_mbcnt, s_bcnt1 and
s_ff1 gather the other lanes' bits with a subgroup operation
(Gen.wave_mask). v_mbcnt writes a VGPR, so its result is selected on the
lane's EXEC, and MoltenVK's SPIRV-Cross inlined the single-use gather
into the taken arm of that ternary:

    v6 = active ? popcount(simd_or(mine ? bit : 0) & below) + acc : v6;

A lane that is off never ran the gather, so its bit was missing from
every other lane's count. Gen.wave_mask now stores the gather to a
variable of its own with Gen.eager, as SHADER-529 did for DPP's ballot
and shuffle.

On an Apple M5 (MoltenVK 1.4.2), tools/crosslane_fuzz.py with wave 32,
native and no maskdata goes from 92 of 100 programs matching to 100 of
100, and from 193 to 200 of 200 with DPP at seed 7.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-28 12:44:47 +08:00
53604abbfc tests: the five tests that parse the translator source do it in pieces, 60 s -> 17 s (TEST-TRANSLATOR-PIECEWISE-PARSE)
A .pyc does not help ast.parse. test_runtime_paths.py, test_isa_coverage.py,
test_shader_stage_resume.py, test_cmake_translator_deps.py and
test_resource_hygiene.py read the syntax tree of tools/rdna2spirv.py, seven
whole-file parses of 7 s each on CPython 3.12, 3.13.0 to 3.13.15 and 3.14.0
to 3.14.7. They now call tests/semantic/piecewise_parse.parse, which gives
the same tree (tests/test_piecewise_parse.py) in about 1 s.

tools/isa_coverage.py parses inside scan_translator and accepted_names;
its test patches ast.parse around those two calls on the real translator
instead of changing the tool.

Python 3.14.7, valid .pyc of the translator, two runs each:
test_runtime_paths 16.0 -> 3.7 s, test_isa_coverage 15.0 -> 2.5 s,
test_shader_stage_resume 14.2 -> 8.2 s, test_cmake_translator_deps
7.6 -> 1.4 s, test_resource_hygiene 7.6 -> 1.3 s.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-26 12:27:30 +01:00
e654d10fdf piecewise_parse: CPython 3.13.16 has the tokenizer fix too (TEST-TRANSLATOR-PIECEWISE-PARSE)
v3.13.16 and v3.13.17 no longer copy the source at an f-string field
(Parser/lexer/lexer.c keeps last_expr_start); v3.12.16 still does. needed()
is now true on 3.12, 3.13.0 to 3.13.15 and 3.14.0 to 3.14.7.

The README paragraph moves below the one about calling the translator, so
it no longer touches the lines #2114 adds.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-26 10:52:13 +01:00
21d1f0ceb8 tests: support.py compiles the translator from pieces, 7 s -> 1 s per uncached import (TEST-TRANSLATOR-PIECEWISE-PARSE)
On CPython 3.12.0 to 3.14.7 the tokenizer copies the rest of its input at
every f-string field (update_fstring_expr: strlen, PyMem_Malloc, strncpy),
and import hands a module over as one string, so compiling the 1.2 MB
tools/rdna2spirv.py takes 7 s, 0.1 s of it code generation. CPython fixed it
in 3.14.8 and 3.15.0 (gh-155525); 3.12, which CI pins, keeps it.

tests/semantic/piecewise_parse.py finds statement starts with tokenize,
parses top-level statements in pieces of 300 lines (a longer class is cut
between the statements of its body) with one newline in front for every line
before the piece, and joins them into the tree a whole-file parse gives.
Whatever does not fit returns None and the source is compiled the usual way.

tests/semantic/support.py loads the modules of TOOLS_DIR through a
SourceFileLoader subclass that compiles that tree, by a sys.meta_path finder
placed just before PathFinder, only on the interpreters above. A valid .pyc
is still used first.

tests/test_piecewise_parse.py compares the trees for every Python file of
the repository, hand-written boundary cases, the exceptions and warnings
against compile(), and code objects against compile(bytes).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-26 10:44:47 +01:00
7687486700 Merge pull request #916 from TuroYT/docs/semantic-readme-format-count
tests/semantic/README: test_buffer_formats_all covers 45 formats (README-BUFFER-FORMAT-COUNT)
2026-11-25 18:25:01 -03:00
d517d8af9d docs: give the translator suite times measured on today's suite
AGENTS.md said 433 files and 5 821 tests in 224 s on 16 cores.
tests/semantic/README.md said 26 s, or 253 s one file at a time, on 16
cores. The two disagree, and both count an older suite.

Measured on main 3d3770c (the suite is unchanged at a289278), Windows 11,
Ryzen 7 7435HS with 16 threads: 465 files and 6 108 tests, 0 failed, in
297 s with the default 16 jobs and 2 401 s with -j 1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 23:46:00 +08:00
48f1c95f13 tests/semantic/README: test_buffer_formats_all covers 45 formats (README-BUFFER-FORMAT-COUNT)
The README said the test runs 33 formats. The ADDED table in
test_buffer_formats_all.py has 45 entries (counted with ast), and the
load and store loops iterate all of it. Only the number changes.
2026-11-24 16:10:07 +01:00
a8b7ddbd50 Make main's tests green, part 2: docs drift, bvh_slot_check, find_hash_lookup (#10002)
Seven more test files that fail on main at d083a2c, after #9896:

- test_docs_repeated_lines: tests/semantic/README.md's command block is a fenced block, which the check skips;
  its indented form put two lines with the same 40-character opening three lines apart
- test_docs_repo_paths: docs/retail_boot_intel_host.md names #8554's frame-loop notes instead of a path that
  is not in the tree
- test_docs_env_vars: runtime/README.md documents LEONIDA_RNG_SEED (runtime/shims/bcrypt_rng.cpp)
- test_docs_design_rows: docs/README.md gets one row each for strand_grooms.md and ped_catalogues.md (two
  rows each were merged in), and design.md escapes the pipe in `prim_cnt << 12 \| vtx_cnt`
- test_docs_cli_flags: docs/testing.md passes llvm-mc through LLVM_MC, so `brew --prefix` is no longer read as
  a bench_wave64.py flag; pt-PT's quickstart points to the web checker that replaced tools/pc_checker.py
  (5125a01), as README.md does; the spirv-opt passes docs/embedded_shaders.md quotes join FOREIGN
- test_bvh_slot_check: bvh_match.model_geometries() yields six fields since the render bucket was added;
  unpack the two it needs
- test_joaat_agreement (find_hash_lookup's half): hash over the Latin-1 bytes like hashdict.joaat, as #6254 and
  #7820 proposed

Still red, for a separate change: test_joaat_agreement's leonida_mods half (it hashes UTF-8 bytes like
runtime/src/mods.h, so both sides change together), test_f64_conversion and test_f64_output_modifiers (they
expect the output scaling #6314 gated by MODE) and test_bvh_shaders_stage.
2026-11-24 00:28:18 +01:00
8b63b583ae Merge remote-tracking branch 'origin/pr/8995'
# Conflicts:
#	runtime/test/shaders/check.py
#	scripts/run_gpu_tests.py
2026-11-23 17:41:48 -05:00
04f6d5245e Merge remote-tracking branch 'origin/pr/9750' 2026-11-23 17:24:49 -05:00
b8956e4f3b tests: execute a mesh shader's exp prim and GS_ALLOC_REQ translation in the interpreter
fixtures/ms_prim_export.asm (72 threads, two wave64 waves) runs as a mesh shader and with --mesh-compute: m0 = prims << 12 | verts gives the counts, the three 9-bit index fields exclude the edge flags, bit 31 sets CullPrimitiveEXT, and threads at or past a count write nothing. spirv_mini_interp learns OpSetMeshOutputsEXT, struct zero values, aggregate outputs and OpAtomicStore.
2026-11-24 01:06:22 +03:00
3746a6ff0b feat: select semantic test files by glob pattern 2026-11-24 00:23:58 +03:00
b643ebd37f tests/semantic/README.md: describe test_exec_computed.py 2026-11-23 20:55:23 +01:00
c7b44489b9 tools/semantic_mutants.py: op-scoped mutation testing for tests/seman… (#6548)
Squash-merged after diff review of PR #6548
2026-11-23 12:47:51 -06:00
4ce16cd58e rdna2spirv: a wave32 pixel shader reads its descriptor index from a running lane of its half, not lane 0 (SHADER-1016, the #4225 RDNA1 regression) (#6898)
Squash-merged after diff review of PR #6898 - rdna2spirv: a wave32 pixel shader reads its descriptor index from a running lane of its half, not lane 0 (SHADER-1016, the #4225 RDNA1 regression)
2026-11-23 09:44:13 -06:00
c2cc4bfe7f scripts/run_semantic_tests.py: run tests/semantic one process per file, in parallel (253 s -> 26 s) (#4961)
Squash-merged after review of PR #4961 - scripts/run_semantic_tests.py: run tests/semantic one process per file, in parallel (253 s -> 26 s)
2026-11-23 08:10:57 -06:00
ab1c07eb65 Revert #4247: its tail-scheduler tests need a mini scheduler that main's planner no longer makes
Since 70e739fd7 (coalesce hoisted spine guards) the tail program is one tail scheduler, so
test_tail_scheduler_after_a_mini_scheduler and the interpreter check of the mini scheduler's clears fail after the
merge, though they pass on the branch (based on aa2988cc).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 03:54:49 -05:00
ee067ef34f Merge pull request #4247 from Emma
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	docs/design.md
2026-11-22 23:12:45 -05:00
68ac20877b Merge pull request #4225 from 73N1X
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	docs/design.md
2026-11-22 23:12:31 -05:00
b485351b8f Merge pull request #4202 from shelbykb2
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	docs/design.md
2026-11-22 23:12:18 -05:00
f28c871f42 Merge pull request #3859 from Maxime Mansiet
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:08:59 -05:00
3732d3976c Merge pull request #2646 from Dandasma
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:05:49 -05:00
8f12d8c2f5 Merge pull request #2022 from AlxcBTW
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:05:12 -05:00
88102f8f11 tests: the measured RDNA2 triangle rows of image_bvh as a regression test
tests/semantic/test_image_bvh_tri_hw.py holds every single-lane row of the triangle measurement on an RX 6800
(308 rows of 12 kernels: slots, both windings, misses, the remap byte, t max and t sign, zero area, NaN and inf in
the node and the ray, shared edges and vertices) and lanes 0, 15, 16, 31, 32 and 63 of the two 64-thread kernels
(84 results). Each runs through the translator in both forms, with contiguous or NSA address operands as measured,
and must give the hardware's four words bit for bit. All are asserted; main's translator gets 129 of the 308 rows
(14 more raise on undefined SPIR-V). The data block is written from the raw outputs by a script, not by hand.

Co-Authored-By: Claude Opus <noreply@anthropic.com>
2026-11-22 20:39:49 -07:00
1674b1be52 Merge origin/main into buffer-formats-all-v2
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 (aa2988cc: 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>
2026-11-23 02:39:02 +01:00
4f760c1aed Shader: isolate wave32 pixel operations in wider subgroups (SHADER-731) 2026-11-22 20:07:05 -04:00
5f16276d12 tests, docs: every clear of the wave64 exchange buffer has a test that fails without it (SHADER-708)
test_w64x_clear_single_writer.py gains a mesh shader and whole-workgroup runs of
programs that take the inline helpers (one wave and several), two local round
loops, and a round loop after a local one. The lockstep interpreter of
test_wave64_emulate_opt.py also fails when one invocation plain-stores a %x_buf
word that another loads or updates between two barriers. With any one of the
four places put back, both files fail. The design.md row has the numbers
measured on main aa2988cc.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-23 01:43:24 +02:00
c06d841f49 Merge main aa2988cc into shader-708-wave64-clear-race; port the single-writer clears
main split x_scheduler into x_prologue and x_round_loop_head and added structured
emulation (x_mini_scheduler, the x_pre_* helper functions). The one-writer clears
are ported to all four places that stored to the sink word. The helper functions
now have a selection, so the inliner of tests/semantic/test_wave64_emulate_opt.py
keeps their labels, and its lockstep interpreter fails when two invocations store
to one %x_buf word between two barriers.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-23 01:06:33 +02:00
8f119bfb35 rdna2spirv: clear the wave64 exchange buffer with one writer per word (SHADER-708)
Under --wave64-emulate the scheduler cleared parts of %x_buf (Workgroup memory)
with plain stores that several invocations aimed at one word: the zeroing before
the first barrier clamped its index with UMin, so every invocation past the end
of a range stored to its last word, and at the top of each round every
invocation with nothing to free stored 0 to a shared sink word. All stores wrote
0, so results did not depend on it, but it is a data race, and GPU-assisted
validation reports SharedMemoryDataRace-RaceOnStore on every emulated compute
shader.

Invocation i now clears word i of each row, a short last row is stored only by
the invocations that have a word in it, and in a round only lane 0 of a wave
(mask words) and invocation 0 (counts) store, each behind a selection that ends
before the barrier. The last word of %x_buf is no longer written; it stays
allocated so the buffer size does not change. No module changes without
--wave64-emulate.

tests/semantic/test_w64x_clear_single_writer.py runs the scheduler's head for
every invocation at nine workgroup sizes.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-23 00:37:03 +02:00
ed91cd250a Tests: GPU checks for v_med3_f32/f16 with a NaN in S2 or in two operands
ps_fnan_med3 puts its NaN in S0 only, so no GPU test reached the cases
ps_fnan_med3_s2 (f32) and ps_f16_fnan_med3 (f16), with inputs read from
memory at run time and words derived from the measured rule in
docs/design.md (with any NaN operand, med3 is min3 with the NaNs
ignored). The all-NaN case is left out: its payload is not modelled.

Registered in check.py and run_gpu_tests.py; the semantic fixtures and
GpuFixtures tests run them through the interpreter, where the
translator before #2029 fails them (undefined FClamp on a NaN).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:18:01 +01:00
c776464332 tests/semantic: the README no longer says pixel shaders plus one compute shader
Signed-off-by: Maxime Mansiet <AirKyzzZ@users.noreply.github.com>
2026-11-22 23:07:51 +01:00
d497c01b9a Merge pull request #3444 from shdann 2026-11-22 17:02:04 -05:00
5bbaf0f265 Merge pull request #3227 from Claude
# Conflicts:
#	docs/design.md
2026-11-22 17:01:02 -05:00
4d65bae6b2 rdna2spirv: run DPP's ballot and shuffle in every lane under SPIRV-Cross (SHADER-529)
SPIRV-Cross (MoltenVK) inlines a single-use result into the expression that
uses it. The DPP lowering put the source-EXEC ballot on the right of an
OpLogicalAnd (a short-circuiting && in MSL) and the shuffle in the arm of a
scalar OpSelect (a ternary), so lanes out of their row skipped the ballot and
the shuffle read from lanes that never ran it: row_shr:1's lane 1 found lane 0
inactive and kept its old value (cs_dpp_ops on MoltenVK).

Both results are now stored to a Function variable of their own (Gen.eager)
and loaded back; a store is a statement every lane runs. Only the DPP path
changes: of the 217 GPU test shaders that assemble here, exactly the nine
cs_dpp* ones translate differently, all still pass spirv-val, and SPIRV-Cross
1.3.239's MSL now computes the ballot and the shuffle as their own statements.

tests/semantic/test_dpp_eager_subgroup.py models SPIRV-Cross's single-use
forwarding and fails on the old lowering for all 11 DPP16/DPP8 forms tested;
it also checks the values in spirv_wave_interp.py against a DPP reference.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GN11jbD4AeqgwR5C5Z5Xs9
2026-11-22 21:09:28 +00:00
0312e4df3e tests/semantic: the mini interpreter gives the OpPhi of a block their values together
spirv_mini_interp.py evaluated the OpPhi of a block one after another and
wrote each result at once, so a later OpPhi that names an earlier one of the
same block read its new value. A loop header that swaps two values
(%a = OpPhi ... %b %cont, %b = OpPhi ... %a %cont) gave (2, 2) after three
iterations from (1, 2); SPIR-V and spirv_wave_interp.py give (2, 1). The
first OpPhi of a block now evaluates the whole run against the values from
before the block, and each one then takes its own.

The module docstring and the README's Limits said backward branches, loops
and calls are rejected; the interpreter runs them (10000 backward branches
at most), and only rejects switches.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 23:32:44 +03:00
5ce98eac24 Merge pull request #2992 from tupacfan04 2026-11-22 15:13:52 -05:00
94a6cba5e7 Merge pull request #1299 from Vonsek 2026-11-22 15:09:39 -05:00
a922e9edd4 tests: CPU value tests for 8/16-bit and 64/96/128-bit LDS accesses
Two wave32 GPU tests, cs_w32_lds_subdword (ds_write_b8/_b16 and their
_d16_hi forms, ds_read_u8/_i8/_u16/_i16) and cs_w32_lds_wide
(ds_write/ds_read _b64/_b96/_b128, ds_read2st64_b32), and a semantic
test that runs them in the SPIR-V interpreter against a byte-level LDS
model of the ISA rules, with three SPIR-V sabotages as negative
controls. These ops were checked only by lds_fuzz.py, which needs a GPU.

No translator change. RTX 4070 SUPER, driver 610.88: both dumps match.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 13:17:14 -06:00
6058e42ee9 tests: state what the translator-use guard does not check 2026-11-22 13:15:20 -06:00
1b50968843 tests: a semantic test must reach tools/rdna2spirv.py
tests/semantic is the translator regression suite, but a file there can reimplement the instruction in Python and pass whatever the translator does. Add an ast-based guard: direct import, a helper that reaches the translator, or a subprocess naming rdna2spirv.py. The interpreter self-tests, the hand-written-SPIR-V files and the three pre-existing offenders are listed with a reason, and a second test rejects stale entries.
2026-11-22 13:03:13 -06:00
3d1dbf1cef Merge main into test/coverage-gaps (#1299)
Conflicts: runtime/test/shaders/check.py, scripts/run_gpu_tests.py

AI-assisted.
2026-11-22 17:22:43 +01:00
a93da2c185 buffer_format_fuzz: distinct y and w in the store probe; count the (x, 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>
2026-11-22 16:58:26 +01:00
b5b650186b rdna2spirv: decode and encode every GFX10 buffer data format
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>
2026-11-22 16:30:00 +01:00