feat(shader): implement MIMG BY2/BY4 loads as measured on hardware #1793
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1793"
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?
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-08T19:18:52Z.
What
Replaces #1526 by @kali113, which I closed by mistake (see the comment there). The first commit is theirs, adapted to
mainafter #639. The second commit is ours: it makes the four loads follow what the hardware does. The four stores decode, so they count in the progress table, but throw at translation.Measured on RDNA2 (gfx1035) with the hardware oracle. Each check compares the BY result against plain
image_loads of the same texels on random memory, over x/y/mip edge rows, 9 widths and several formats:x & ~(N-1).. +N-1 on row y (N = 2 for BY2, 4 for BY4)x+N-1 >= width, ory >= heightThese agree with pandather's gfx1031 measurements posted on #1526 (aligned window, all-or-nothing bound, data only from narrow formats). Loads: 0 mismatches over 2,160 rows per format (12,960 for mip variants) across 24 opcode/format/mask combinations. Stores were measured too: they write from the unaligned x up to the end of its dword. That's a different rule, so they stay unimplemented for a follow-up.
EmitByReadOp): oneImageReadper instruction. It fetches the N aligned texels withOpImageFetchat the clamped LOD and zeroes every register when the window is out of range, converting each texel likeimage_load. The level's width and height aremax(size(LOD 0) >> lod, 1), the extent Vulkan defines for a view's levels, notOpImageQuerySizeLodat a per-lane LOD. CI's lavapipe returns one lane's level size for all 8 lanes of a group there, which zeroed a lane whose neighbour read another mip.ShaderDiskCacheformat version 20:ImageResourcehasbyElements/byComponents.tfe/lweentry.Tested
Linux (CachyOS), on the merge with
main.agc_driver_image_bypasses on RADV (gfx1035) and CI's lavapipe (Mesa 25.2.8). It covers R8/R16 (0x3) and RG8 (0xf) for BY2 and R8 for BY4, with and without mip, 32 lanes per run with x near both edges, x ≥ width, x = -1 and 2^31, y = height and -1, and mip = level count. It checks that the store opcodes and every unsupported format/swizzle throw, and that registers past the mask keep their value.image_bychecks decode and translation. Full ctest: 488/488, and the BY/gather tests three times on each driver. Negative checks: dropping the x alignment fails atx 5, and dropping thewidth - x >= Nbound fails atx 60(width 61).Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-08T19:20:28Z.
Progress report (
b858fdc→d5a3a43)📈 GPU shader instructions: 99.06% (+0.69%, +8 implemented instructions)
✅ 8 implemented
IMAGE_LOAD_BY2IMAGE_LOAD_BY4IMAGE_LOAD_MIP_BY2IMAGE_LOAD_MIP_BY4IMAGE_STORE_BY2IMAGE_STORE_BY4IMAGE_STORE_MIP_BY2IMAGE_STORE_MIP_BY4Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-08T19:29:04Z.
Windows failed
image_bywith0xc0000135(DLL not found). The test was registered without thePATHprepend forlibcthat its sibling tests (scalar_call,image_sample_gather) have. Added it.