mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:00:52 +01:00
[PR #98] [CLOSED] rdna2spirv: zero the tfe/lwe status VGPR on image_load and image_load_mip (SHADER-1266) #150
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#150
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/98
Author: @Mouad-Scriptz-0
Created: 11/24/2026
Status: ❌ Closed
Base:
main← Head:fix/shader-1266-tfe-status📝 Commits (2)
78f4e5drdna2spirv: zero the tfe/lwe status VGPR on image_load and image_load_mipf19ec51docs/design.md: the tfe status row is also GPU-checked on Intel Meteor Lake (ANV) (SHADER-1266)📊 Changes
3 files changed (+113 additions, -10 deletions)
View changed files
📝
docs/design.md(+1 -1)➕
tests/semantic/test_image_load_tfe.py(+95 -0)📝
tools/rdna2spirv.py(+17 -9)📄 Description
Fixes #31 (SHADER-1266). Claimed in #14.
Problem
With
tfe(orlwe), an MIMG read returns one more dword after its data: the fetch status, atvdata[data_vgprs](RDNA2 ISA, MIMG TFE/LWE).tools/rdna2spirv.pyalready counts that VGPR as a destination (vgpr_dest_registers(ins, extra=int("tfe" in ins["mods"]))), butimage_loadandimage_load_mipemit only theOpImageFetch/OpImageReadof the data, so nothing writes the status VGPR and the shader reads back whatever it held before. The GPU fixturescs_imgload_tfeandcs_imgload_d16_tfe(onmainsince9c4c5f92a) fail because of this, as #31 reports on an AMD 780M.Fix
This re-lands
old-pr/10022(n-romanovich, from the original repository; their commit is cherry-picked unchanged and keeps its authorship). The patch applied cleanly ontomain9ec34cdff.image_read_typedtakes astatusflag. When it is set, it writes0tovdata[r + data_vgprs]after the data, withdata_vgprs = (popcount(dmask) + 1) // 2underd16andpopcount(dmask)otherwise. The write goes throughself.dst, so inactive lanes keep their value.image_load/image_load_mippath that reachesimage_read_typed: the typed fetch, the coherent (glc) read, the 3D mip load and the 2D mip load.tfe/lwe(a16 mip, d16 3D mip, stores, sample_d on 3D) are unchanged.docs/design.md: the "Typed image loads" row gets the rule and its confirmation (second commit: the Intel GPU result below).tests/semantic/test_image_load_tfe.py: new CPU test (3 tests).Tested
Fedora Linux, Python 3.15.2, LLVM 23.1.5
llvm-mc. The GPU is Intel Meteor Lake graphics (Intel(R) Graphics (MTL), ANV, Mesa 26.2.7), selected withLEONIDA_VK_DEVICE=Intel.main9ec34cdfftests/semantic/test_image_load_tfe.pymain's translator)scripts/run_semantic_tests.py tests/semantictest_exec_computed(#15/#24),test_image_atomics_guard(#20)run_gpu_tests.py --filter imgloadcs_imgload_tfe,cs_imgload_d16_tfeFAILrun_gpu_tests.py(full)In the full GPU run, the only per-test difference between the two is
cs_imgload_tfeandcs_imgload_d16_tfegoing from FAIL to PASS. The one failure left iscs_w32_exec_computed, which is #15 (fixed in #24). Translation was 256/257 with all 256 passingspirv-val, the same on both. The one shader not translated is a computed I/J pair under--bary-fallback, because this GPU has noPerVertexKHR. It has nothing to do with this change.Also run, all OK:
pytest tests/test_image_load_typed.py tests/test_image_load_d16_typed.py(29 passed),python -m compileall -q make_game.py tools tests,tests/test_text_write_line_endings.py,tests/test_docs_links.py, andscripts/check_no_game_data.pyon every changed file.Commands:
@Mby159 offered in #15 to rerun the GPU suite on the 780M from #31. An AMD result would confirm the fix on the hardware the bug was reported on.
No game files and nothing online. AI-assisted (Claude Code).
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.