Repository navigation
Translator: pack d16 results for explicit-LOD 2D gathers - #928
evilclanker9000 wants to merge 4 commits into
Conversation
Updated project status to indicate early development phase.
LLVM accepts the two-VGPR form for explicit gathers, but the emulated fetch path rejected it. Share the zero-LOD gather's packed writeback and check both register pairs against independently rounded texels.
|
Tested
No game files were used. |
|
Tested on Windows 11 (Python 3.12, llvm-mc 23.1.6 with AMDGPU, spirv-tools): pass
|
quackottu
left a comment
There was a problem hiding this comment.
Tested 7b090fb on NVIDIA GeForce RTX 5070 (subgroup 32), driver 621.24, Windows 11 Pro (26300), Vulkan SDK 1.4.363.0, llvm-mc 21.1.8 (built with scripts/build_llvm_mc.ps1), scripts/run_gpu_tests.py:
- native: 74/101 passed, 27 skipped (
main8df277f here: 64/91 passed, 27 skipped, all wave64 tests needing a 64-wide subgroup) LEONIDA_W64_EMULATE=1: 101/101 passed (mainhere: 91/91)python -m unittest discover -s tests/semantic: Ran 1018 tests in 191.329s OK
Keep the sampler LOD clamp and packed result handling together through the current translator and GPU test registries.
|
Superseded by #1017 at |
Claimed in #634.
What and why
LLVM's gfx1030 assembler accepts two destination VGPRs for
image_gather4_landimage_gather4_l_owithd16. The translator rejected both. Their four existing 2D fetches now use the same packed writeback asimage_gather4_lz. Taps 0/1 and 2/3 each form one 32-bit word, rounded to binary16 with the existing integer nearest-even conversion.The regression extends the registered
ps_gather_wrapfixture. Running that fixture from an empty directory also exposed a missingvs_idsdependency in its filter.Tested
The original translator reported
Unsupported: image_gather4_l formfor each new form in its own pytest case. The zero-LOD control passed. With the new GPU fixture, 95 of 96 synthetic shaders translated and validated before the fix, and all 96 afterward.Windows, NVIDIA GeForce RTX 5080 (616.92) and AMD Radeon Graphics (26.10.1). Each fresh
scripts/run_gpu_tests.py --filter ps_gather_wraprun matched all 4096 RGBA pixels. At UV (0.5, 0.5) the expected red bytes are (96, 128, 128, 96), yielding words 0x38043606 and 0x36063804. Green with offset (0, −1) gives (96, 96, 64, 64), or 0x36063606 and 0x34043404. The shader also checks the first VGPR beyond each result.Forcing the offset to zero changed only G on all 4096 pixels per GPU. Seeding the first guard VGPR with 1 changed only R on all 4096. In a separate local two-mip draw, the same UV with LOD 0 and LOD 1 yielded (1, 1, 0, 0) at every pixel on both GPUs, as predicted from the high halves of the two red gather words at each level. These are Vulkan readbacks of translated gfx1030 assembly.
pytest tests/test_translate.py tests/test_d16_pack.pypassed all 278 cases. CTest passed all 32 enabled runtime tests (GameInput disabled in this build).The full RTX GPU runner reported 74 passed and 27 skipped. The separate shader checker reported 64 passed and 28 skipped. The semantic suite passed all 1018 tests.
Checklist
docs/design.mdrecords the packing and GPU check.AI-assisted with Codex.