From cb009ce6dad1dc57612f8c71210925416ab03811 Mon Sep 17 00:00:00 2001 From: Moriz82 <72836413+Moriz82@users.noreply.github.com> Date: Tue, 24 Nov 2026 15:11:48 -0600 Subject: [PATCH] rdna2spirv: skip the load of a typed buffer format with no decoder (SHADER-TYPED-RESERVED-FORMATS) A buffer_load_format_* whose format comes from the V# read one dword at the V# address when the FORMAT was INVALID or a reserved code, and discarded it: such a format has no data channels. An INVALID format marks a V# that is not a view of any buffer, so that address need not be mapped. The explicit-format MTBUF path already refuses the load of an INVALID V#. Treat a run-time format without a decoder like an out-of-bounds load: no memory access, data channels 0, DST_SEL 0/1 as before. The loaded values do not change for any of the 128 codes. The new read-log test fails on main for codes 0, 78 and 127 (five reads of the span) and passes here. A sweep of all 128 codes, three DST_SEL sets and OOB_SELECT 0..3 over four load forms gives the same words in all 1,536 runs. The typed-format and out-of-bounds GPU fixtures pass on an RTX 4070 with both translators; none of them reaches the new skip, which is CPU-checked only. The translator suite ran 470 files and 6,169 tests with 0 failing files, and of the other Python test files only tests/test_imhex_patterns.py fails, as on main. AI-assisted (Claude Code). Co-authored-by: Plaaasma <47513553+Plaaasma@users.noreply.github.com> Co-Authored-By: Claude Fable 5.2 --- tests/semantic/fixtures/buffer_format_unreadable.asm | 1 + tests/semantic/test_buffer_oob_dst_sel.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/semantic/fixtures/buffer_format_unreadable.asm b/tests/semantic/fixtures/buffer_format_unreadable.asm index 37e3c72e1e..eae9bbba42 100644 --- a/tests/semantic/fixtures/buffer_format_unreadable.asm +++ b/tests/semantic/fixtures/buffer_format_unreadable.asm @@ -1,4 +1,5 @@ ; s[4:7] is the tested V#. The harness gives s[0:3] a separate output range. +; s[4:7] is the tested V#: its FORMAT picks the decode at run time. s[0:3] is a raw V# over a separate output range. v_cmpx_eq_u32_e32 0, v0 buffer_load_format_xyzw v[4:7], off, s[4:7], 0 s_waitcnt vmcnt(0) diff --git a/tests/semantic/test_buffer_oob_dst_sel.py b/tests/semantic/test_buffer_oob_dst_sel.py index d693c7cdbb..cc6ddd8cdc 100644 --- a/tests/semantic/test_buffer_oob_dst_sel.py +++ b/tests/semantic/test_buffer_oob_dst_sel.py @@ -105,7 +105,10 @@ def test_invalid_format_with_nonempty_range_skips_backing_load(self): with self.subTest(code=code): pcs = [0, 0, 16, OUT_V, BASE, 0, 16, word3(code, DST_X_0_1_1)] + [0] * 24 mem, _ = self._run_cs(lines, push_constants=pcs) - self.assertEqual(bool(mem.reads), code == 20) + if code == 20: + self.assertIn(BASE, mem.reads) + else: + self.assertEqual(mem.reads, []) self.assertEqual([dict.get(mem, i, 0) for i in (0, 4, 8, 12)], [0x3F000000 if code == 20 else 0, 0, 1, 1])