Repository navigation
Saturate integer D16 image loads and gathers before packing - #1340
Conversation
Native gfx1036 clamps out-of-range channels from signed and unsigned RGBA32 views before packing D16 results. Exercise both limits in the existing GPU readback fixture so wrapping at either boundary is observable.
The gather test used to follow the original 32-bit taps directly into a shift or mask. Check the saturation result on each of the four integer taps before its corresponding packed half.
|
Independent CPU-side verification of
Static review matches the contract update: UINT taps use |
|
Tested The committed For a negative control, I changed only the integer image-read narrowing in a temporary translator copy to mask off the high 16 bits. With the same fixture and harness, that module produced four mismatches in the 64-texel sum output. All three modules passed SPIR-V validation and the nine typed-image unit tests passed. Tools were llvm-mc 21.1.8 and SPIRV-Tools 2026.1. The GPU run covered the committed 2D load regression. AI-assisted verification. |
|
Tested on Windows 11 with two GPUs on one machine (runtime built from this PR's head, MSVC 14.51, llvm-mc 23.1.6): pass. On both the RTX 4080 SUPER and the Intel UHD 770: |
|
Tested
No game files. AI-assisted (Claude Code). |
|
Tested 78521ce on NVIDIA GeForce RTX 3090 (Ampere, subgroup 32..32), driver 610.88 (Vulkan 1.4.341), Windows 11 Pro 26300: pass. The PR's diff applied cleanly to
|
|
Tested 78521ce on AMD Radeon RX 7900 XTX (RDNA3, Navi 31), AMD driver 26.11.2, Vulkan 1.4.359, Windows 11: pass.
Tools: llvm-mc 21.1.8 (WSL), Vulkan SDK 1.4.363.0, MSVC 14.44. Base |
Current main now preserves an odd load's leftover VGPR half. Apply the signed or unsigned range conversion before that shared half-word write so both behaviors survive the integration.
|
Updated to 05922b7 on current main, incorporating the odd-component high-half preservation from #1336. On RTX 5080 and gfx1036 the boundary-value case remained exact for the full-width and packed loads. Independent 2D image_load and image_load_mip readbacks matched all 4096 RGBA outputs in each of 36 combinations (two adapters, UINT/SINT/UNORM, dmask 0x8/0xd/0x3, base or explicit mip). In all 24 odd-mask cases, substituting zero for the preserved high half changed all 4096 outputs. |
|
Tested 05922b7 merged onto
So the new UINT/SINT boundary words catch the old truncation on real hardware, and the saturation fixes them. AI-assisted (Claude Code). |
Claimed in the coordination issue as D16 integer image saturation. Based on f85582e after #1291 and #1308.
What and why
D16 image reads were dropping the high bits of 32-bit integer channels: UINT 65536 became 0 instead of 65535 and SINT -32769 became 32767 instead of -32768. Clamp on the selected integer read path before packing. This shares the 16-bit conversion already used by v_cvt_pk_u16_u32 and v_cvt_pk_i16_i32. Both GPU runners now exercise the boundary cases in the existing cs_imgload_d16 fixture. The unrelated high-half preservation change is in #1336.
Tested
Checklist
AI-assisted implementation and verification.