Repository navigation
Shader: saturate unsigned D16 formatted buffer loads - #1442
Conversation
Native RDNA2 clamps 32-bit unsigned contents to the 16-bit range before packing both halves. Reuse the integer narrowing helper for MUBUF and MTBUF while preserving full-width fetches and the unused high half.
IAmNotSiob
left a comment
There was a problem hiding this comment.
lgtm, saturating instead of masking matches the hw (your 96/96 gfx1036 cases are convincing), and reusing saturate_int16 keeps one path. semantic tests pass merged with main ^^ AI-assisted review (Claude Code).
|
Tested on Windows 11 with two GPUs on one machine (MSVC 14.51, Windows SDK 10.0.26100) with llvm-mc 23.1.6: no regression. |
|
Independent CPU verification, at head
Not checked: no GPU here, so the translated result was not compared against hardware — this is the semantic suite only. |
|
Tested 85cb97e on RTX 5070 (Blackwell, subgroup 32..32), NVIDIA 616.56, Windows 11 Pro 26200: pass.
Tools: llvm-mc 21.1.8 (WSL), MSVC 19.50, Vulkan SDK 1.4.363.0, Python 3.13. |
Claimed as SHADER-237, now coordinated in #1380. Builds on the integer conversion merged in #1340.
What and why
A D16 unsigned formatted buffer load must saturate each channel to 65535 when packing into a destination half. The low half previously kept only the low 16 bits, and shifting the high channel discarded its overflow. Reuse the existing unsigned saturating conversion for both halves in the shared MUBUF/MTBUF load path. An odd final channel preserves its VGPR's existing high half.
Tested
Checklist
AI-assisted.