upleb.uk

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

summaryrefslogtreecommitdiff
path: root/tools/mem_diff.py
AgeCommit message (Collapse)Author
11 daysmem_diff.py: the reference model addresses memory as the translator now doesJan Trencansky
#984 changed how a buffer's device address is formed: the low 48 bits of the effective VA are sign-extended before the heap base is added (Gen.host_addr, the 'Heap-relative buffer device addresses' row in docs/design.md), because a V# base is device_address - heap_base in 48 bits and is negative for an import below the heap. The memory differential fuzzer's reference machine still put a base with bit 47 set at the zero-extended address, so every case with such a base read zeros on the translated side: tests/test_mem_diff.py failed in nine families (on #984's head too). The fuzzer has one function for where a VA is in memory, host_address, used by the reference machine's reads and writes and by the generator's seeding. The cases, the seeds and the interpreter are unchanged. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
13 daysMerge pull request #4623 from YaBulochkaItsNotRexed
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> # Conflicts: # docs/design.md
13 daysMerge pull request #4448 from tedin7ItsNotRexed
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
13 daysTyped buffer loads keep a half NaN's payload, measured on gfx1036YaBulochka
mem_diff found one class of mismatch: a 16_FLOAT/16_16_FLOAT/16_16_16_16_FLOAT typed buffer load of a half NaN. Measured natively on RDNA2 (gfx1036) with the new tools/f16_widen_probe.py, wave32 and wave64, MUBUF and MTBUF, formats 13, 29 and 71: the hardware widens a half NaN to f32 as sign | 0x7F800000 | (payload << 13), keeping the sign and the quiet bit exactly as the half has them (0x7ddb -> 0x7fbb6000, 0x7fe6 -> 0x7ffcc000, 0xffb2 -> 0xfff64000). Gen.decode_format decoded every half with UnpackHalf2x16, whose NaN result is undefined and which the interpreter canonicalises to 0x7fc00000, so the payload was lost. It now uses UnpackHalf2x16 for the non-NaN halves (an exact widening) and builds the NaN word from the bits with integer ops. v_cvt_f32_f16 was measured too: it quiets an sNaN with the payload kept (0x7ffb6000), which the typed load does not. mem_diff's reference used struct's '<e', which keeps the payload only from Python 3.14; f16_to_f32 pins the measured rule so the fuzzer is version independent. tests/semantic/test_buffer_f16_widen_hw.py pins the ten measured words for MUBUF and MTBUF and formats 13/29/71; tests/test_f16_widen_probe.py covers the probe (models, fake oracle, CLI); mem_diff --self-test now pins the rule too.
13 dayscf_diff, mem_diff, shader_diff, fmisc_diff: exit 2 when every program was ↵tedin7
skipped
13 daysMerge #2701 (376417b1) to resolve tools/mem_diff.py conflicteyyun
13 daystools: add global_atomic_* and sub-dword buffer_load to mem_diffeyyun
13 daysfix(tests): cover the implicit MTBUF format in memory comparisonsVonsek
LLVM omits the format modifier for 8_UNORM. Decode that spelling in the reference model and generate it so typed-buffer fuzz runs cover the same input.
13 daystools: text reports are written with LF line ends on every platform (BUILD-468)Ewann
open(path, "w") without newline= turns each \n into \r\n on Windows, so the same JSON report, manifest or assembly listing was CRLF there and LF elsewhere. 91 text-mode writes (open, os.fdopen, Path.write_text) under tools/, scripts/, make_game.py and runtime/test/shaders/ now pass newline="\n". tests/test_text_write_line_endings.py reads the source with ast and fails for a writer that forgets it; CONTRIBUTING.md names the convention. AI-assisted (Claude), on behalf of dev-ewann.
13 daysMerge pull request #1428 from DominikItsNotRexed
13 daystools: a path outside the console's code page no longer crashes a tool's outputDominik
On Windows a redirected stdout uses the console's ANSI code page, and python -I ignores PYTHONUTF8 and PYTHONIOENCODING, so a caller path with a character outside that code page ended a run with UnicodeEncodeError as soon as a tool printed it. #1406 fixed make_game.py; every CLI tool in tools/ now starts its __main__ block the same way (stdout errors="replace"). tests/test_tool_stdout_encoding.py checks every tool's __main__ block and reruns two measured crashes (analyze_4240_full.py, meshlet_page.py) with a private-use-named input. Found by @abilliontokens. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
13 daysfix(fuzz): exercise bound MTBUF formats in differential casesVonsek
Use a bound descriptor to exercise the generated instruction format. Keep INVALID as an explicit reference control and model MTBUF's identity lanes independently of MUBUF selectors.
13 daysTranslator: honour V# OOB_SELECT in MUBUF/MTBUF bounds checksAlxcBTW
buffer_address() picked the bounds check from the stride alone and never read word3. It now reads OOB_SELECT (bits 29:28) and applies the rule measured natively on RDNA2 (gfx1036, docs/buffer_bounds.md; Mesa's GFX11 column): a dword is out of range in mode 0 at idx >= NR or off + 4 > stride, mode 1 at idx >= NR, mode 2 at NR == 0, mode 3 (RAW) at offs + 4 > NR, where off is inst_offset + vaddr and offs adds soffset. A literal word3 folds the mode, a run-time one selects with OpSelect. Builds on the raw tail rule of #443 (per-dword loads): x2..x4 loads AND stores are per dword in modes 0 and 3 (a store that straddled the edge used to write past it), modes 1 and 2 take the whole access, a typed element (buffer_load/store_format) is all or nothing at its format's size, an atomic checks its dword's end. Measured on a Radeon 880M (gfx1150), a valid proxy for RDNA2: 504 buffer_load_dword cases over idxen/offen/inst_offset/soffset at the stride and record edges agree with the rules, plus the x2/x4, typed and atomic edges. Swizzle (V# word1 bit 31 SWIZZLE_ENABLE, word3 bit 23 ADD_TID_ENABLE; Mesa gfx10-rsrc.json lines 326 and 337): a literal V# with either is Unsupported in every mode; a run-time one is translated unswizzled (documented known gap). A V# with word3 = 0 is mode 0 / stride 0 and so always out of range, as on hardware: the harness output V# (vk_compute_test, interpreter push constants), cs_bounds, cs_fmt_1010102, cs_store, mem_diff and the format tests now say OOB_SELECT 3 (or 1 with a stride) explicitly. Tests: tests/semantic/test_buffer_oob_select.py (33 hand-tabulated cases plus multi-dword stores, typed elements and the swizzle gate, literal and run-time V#), GPU tests cs_oob_select.asm and cs_oob_tail.asm (the second tells the end check from Mesa's GFX10 start check). docs/design.md, Buffer bounds checking, has the per-mode rule; docs/buffer_bounds.md notes the translator reads it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
14 daysSHADER-86: align mem_diff reference with RX 6700 typed-buffer decodeLuanFreitas
Repeat missing channels, drop the old norm-ulp1/missing-w32 splits, and allow DST_SEL 1 in the fuzzer.
14 daysFUZZ-5: typed buffer loads in tools/mem_diff.py (buffer_load_format, ↵Spaghetih
tbuffer_load_format) A buffer_format family: buffer_load_format_* on every format the translator decodes (random DST_SEL 0/X/Y/Z/W) and tbuffer_load_format_* on the five formats the 1.0.2.1 corpus uses. The reference decodes each element from the GFX10 format name (tools/gfx10_formats.json), not from the translator's table. Two outcomes await a gfx10 hardware measurement (posted in #374) and are counted apart: UNORM/SNORM results 1 ULP from the correctly rounded value (the translator multiplies by a rounded reciprocal), and the missing W of a 32-bit format (0 in the translator, 1 / 1.0 for every other format). 5,000 programs: no other difference. Mutations of the 16_16_SNORM kind, the 8_8_8_8_UINT widths and the DST_SEL order make 33, 37 and 191 of 300 programs fail. AI-assisted.
14 daysFUZZ-5: memory differential fuzzer (tools/mem_diff.py)Spaghetih
tools/mem_diff.py runs seeded s_load, s_buffer_load, buffer load/store/atomic and global load/store programs through a small reference model written from the RDNA2 addressing rules and through the translation in spirv_mini_interp, and compares the exported words and the whole final memory. Accesses are generated in bounds; OOB, OOB_SELECT, swizzle and the s_buffer_load truncation are left for GPU-confirmed rules. spirv_mini_interp gains OpSConvert and 32-bit PhysicalStorageBuffer atomics (spec semantics, one invocation), with tests. The fuzzer found the global_* negative-offset bug that #421 fixes; its global family and tests/test_mem_diff.py's regression test pass once #421 is in. AI-assisted.