shader: a16 does not make image gradients 16-bit; only the _g16 opcodes do #320
Labels
No labels
accessibility
bug
claimed
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
tester report
urgent
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LakshanSivakumar--Native-Victory-macOS#320
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?
@gagarinyury on GitHub · 2026-11-27 11:21 UTC · original
What is wrong
image_addr_dwords(gfx10/fields.rs) and the gradient lowering inlower.rs("With a16 each direction's gradients start a VGPR") read gradients as f16 pairs whenever an image instruction hasa16. On GFX10 the A16 bit packs the coordinates, LOD and clamp, not the gradients: 16-bit gradients come from the separate_g16opcodes.LLVM agrees on gfx1010, gfx1013 and gfx1030:
image_sample_d v[0:3], v[0:4], s[0:7], s[8:11] dmask:0xf dim:SQ_RSRC_IMG_2D a16takes 5 address VGPRs (four 32-bit gradients, then x and y as one f16 pair), and with 3 VGPRs, our count, the assembler rejects it ("image address size does not match dim and a16").image_sample_d_g16witha16takes 3. In LLVM's lowering, gradients follow A16 only on targets without G16 (SIISelLowering.cpp:!ST->hasG16() && (IsA16 != IsG16)), and every GFX10 target hasFeatureG16.So
image_sample_d,_cdand their_c,_o,_clforms witha16translate today but read their gradients and coordinates from the wrong VGPRs.image_sample_cd_g16andimage_sample_c_cd_g16(with_cl) are not in the opcode table.How it was found
Decoding LLVM's GFX10 MC tests (
llvm/test/MC/AMDGPU/gfx10_asm_*.s, about 30,000 instructions assembled with-mcpu=gfx1030) withgfx10::decodeand comparing each register operand's size with LLVM's. Apart from this the differences are small:ds_gws_*without their data VGPR,ds_wrap_rtn_b32without its second data VGPR, and the VOP3 forms ofv_interp_*missing from the table.Plan
Size and read the gradients by the opcode (32-bit unless
_g16), add the missing_cd_g16opcodes, and test the address sizes against LLVM's encodings plus the lowering of a 2Dimage_sample_dwitha16.@gagarinyury on GitHub · 2026-11-27 11:21 UTC · original
/claim
@github-actions[bot] on GitHub · 2026-11-27 11:22 UTC · original
Claimed by @gagarinyury. Open a draft pull request with
Refs #320in its description within 24 hours, or the claim expires.@LakshanSivakumar on GitHub · 2026-11-28 00:36 UTC · original
Thank you for this. It is fixed on main by #322. I have not checked every case from this report in the game myself, so please retest on main
a6a58361and reopen this if you still see it. Closing as fixed.