Shaders: 16-bit image derivatives pack two to a dword; cd_g16 and gather4h names #69
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/uiliannn--VItoriaBr!69
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-69"
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?
@lcg007xd-c on GitHub · 2026-11-25 21:34 UTC · original
lcg007xd-c:fix/mimg-g16-decode→main· +100 −1 · 4 files · 2 commits · openWhat
image_addr_dwordscounted the derivatives of a_g16form (16-bit gradients) as whole dwords. For example,image_sample_d_g16on a 2D image was decoded as reading six address VGPRs, but the instruction has four (llvm-mcprintsv[0:3]). The same error hit everyd_g16variant in 2D, 3D, cube and the arrays._g16now packs the derivatives in pairs, the waya16already did. Nothing else changes.The MIMG table also gets the names LLVM uses for 0xE8–0xEF (
image_sample_cd_g16…image_sample_c_cd_cl_o_g16) and 0x61 (image_gather4h). None of them lowers yet. The lowering matches exact names, so they are refused as unsupported, and a test pins that.Today the lowering refuses
d_g16too, so the wrong count showed up only in the decodedFieldsand the SP3 text, plus the extra VGPRs the IR thought those instructions read. It matters as soon as someone lowers_g16.How it was checked
image_sample*/image_gather4*opcode in the table, in each of the dims that can be sampled (1D, 2D, 3D, cube, 1D array, 2D array), and compared the address size withllvm-mc -triple=amdgcn -mcpu=gfx1030 --disassemble. Before: 32 disagreements, all of them_g16. After: none. The MSAA dims differ for every sample form, because LLVM prints those oddly; you can't sample an MSAA image, so I left them out.g16_derivatives_pack_in_pairspins 14 of those words to LLVM's exact text, including the new names. It fails without thefields.rschange.g16_and_gather4h_forms_are_refusedchecks that the lowering returnsUnsupportedfor each of the new names and ford_g16.--target x86_64-pc-windows-msvc) pass locally.Not tested: Windows runtime, GPU, and the game. Nothing here changes generated DXIL.
Note: the Windows
checkjob fails on current main for an unrelated reason (5668b8b, missingLayout::bytes_from), which #64 fixes.🤖 Generated with Claude Code
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.