mirror of
https://github.com/ProjectLeonida/mandy.git
synced 2026-12-06 17:18:38 +00:00
tbuffer_store_format_* and its d16 forms were Unsupported, though every tbuffer_load_format_* form translates. They now go through buffer_store with the instruction's format, as the loads go through buffer_load_format: - only that format is encoded, with no branch on the V#'s FORMAT; - the bounds check uses its element size; - a V# whose FORMAT is 0 (INVALID) still disables the store, as measured. (@Vonsek covers the MTBUF loads and @opit80 the raw MUBUF accesses through such a V#.) The format parsing the loads did inline becomes mtbuf_format(), shared by both: no modifier is GFX10's default BUF_FMT_8_UNORM, and a format FORMATS has no encoder for stays Unsupported. read_before_write_vgprs now counts a tbuffer store's data VGPRs as reads, as for buffer_store. cs_tbuffer_store.asm stores into 13 sentinel-filled regions through V#s whose format differs from the instruction's or is 0, and reads them back. Every expected word was measured by running the same body natively on a Radeon 680M (gfx1035, RDNA2); wave32 and wave64 gave the same 52 words: - the instruction's format decides the encoding, the element and the bounds; - components the format has but the store doesn't give are 0, and extra ones are dropped; - the default format is one byte, and its neighbours are kept; - a FORMAT-0 V# leaves the region untouched. check.py and run_gpu_tests.py compare the dump. The semantic fixture runs through the interpreter in tests/semantic/test_tbuffer_store.py, which fails on the old translator (Unsupported). It also fails on versions that take the bounds from the V#'s element (5 words differ), take the format from the V#, fill missing components with anything but 0 (1 word), or drop the FORMAT-0 guard (2 words). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>