Repository navigation
rdna2spirv: Unsupported, not KeyError, for an image instruction without a VGPR data operand - #3239
Conversation
…ut a VGPR data operand
llvm-mc accepts `off`, an SGPR or a constant where an image_* instruction names
the VGPR range of its result (image_sample off, v[1:2], ...); the translator
raised KeyError('r') when it wrote the result. image_op, image_get_lod and
image_misc now raise Unsupported. A probe of about 60,000 DS, MUBUF, MTBUF,
MIMG, SMEM and FLAT/GLOBAL/SCRATCH operand and modifier variations finds no
other crash.
AI-assisted.
docs/design.md tools/rdna2spirv.py AI-assisted.
|
Tested 4c6b641 on Steam Deck LCD (Jupiter), AMD Custom GPU 0405 "Van Gogh", RADV Mesa 26.2.0-devel (git-5c65d4fc31), Vulkan 1.4.350, SteamOS 3.9.5 (holo), kernel 7.2.7-valve2-2-neptune-72-g31504582a073: pass
No runtime C++ changes; GPU suite run from the PR worktree against the existing main runtime build. AI-assisted (OpenCode). |
|
Tested
AI-assisted (Claude Code). Synthetic test shaders only, no game files. |
|
Tested 4c6b641 on NVIDIA GeForce GTX 1660 (Turing, TU116, subgroup 32..32), driver 620.73.04 (proprietary, Vulkan 1.4.357), Arch Linux (kernel 6.18): pass, no regression. Native build of runtime/ from this head (Ninja, RelWithDebInfo, clang 23.1.5), llvm-mc 23.1.5, SPIRV-Tools v2026.4.
AI-assisted run (Claude). Synthetic programs only, no game files involved. |
Requested by Lucas · project thread
Claimed in the coordination issue as: EGEN-MEM-CRASH, #2891 (comment)
What and why
The same crash probe as for the ALU forms (#2978), over memory ops: every DS, MUBUF, MTBUF, MIMG, SMEM and FLAT/GLOBAL/SCRATCH mnemonic family with operand-width grids and single or double mutations of valid seeds (glc, slc, dlc, lds, tfe, d16, a16, unorm, lwe, r128, gds, dmask, dim, offset, offset0/1, idxen, offen, addr64, format, SGPR/VGPR/pair/
off/null/m0/vcc/exec/ttmp/out-of-range operands). Only formsllvm-mc -mcpu=gfx1013accepts were kept (about 60,000 distinct), each translated as a pixel and as a compute shader, in the source spelling and asllvm-mc -show-encodingprints it. Every exception that is notUnsupportedwas counted.One class crashed: an
image_*instruction whose first operand is not a VGPR range.llvm-mcacceptsoff, an SGPR or a constant there (image_sample off, v[1:2], s[16:23], s[24:27] dmask:0xf dim:SQ_RSRC_IMG_2D), and the translator raisedKeyError: 'r'when it wrote the result: 10 of the 11 image forms in the new test did (image_sample*,image_sample_c_lz,image_sample_o,image_gather4*,image_load,image_load_mip,image_get_lod; the 11th,image_sample_lwithlwe, did not crash on main). No compiler emits this form (the texels would have nowhere to go), so it now raisesUnsupported(" destination" inimage_opandimage_get_lod, " data" inimage_misc, which also coversimage_store,image_get_resinfoand the atomics). Nothing else crashed: no otherIndexError,KeyErrororTypeErrorin any other op or modifier combination, printed or hand-written.tests/semantic/test_mem_crash_forms.pytranslates the 11 forms and accepts onlyUnsupported; 10 raiseKeyErroron main, none after. A design.md row names the form and the probe. No new op family is touched (the MIMG_cl/compare and scratch work in flight is not affected).Tested
test_mem_crash_forms.py, 10KeyErrorfailures on main, OK with the change.python -m unittest discover -s tests/semantic,regen_fixtures.py --check,tests/test_shader_checks.py: OK.Checklist
docs/design.md, with how it was confirmed.AI-assisted.