Repository navigation
compute: expand packed D16 into FLOAT4 heap views - #2230
Merged
Merged
Conversation
tedin7
reviewed
Nov 25, 2026
tedin7
left a comment
Collaborator
There was a problem hiding this comment.
Review of head 5971d0110b982506d1fa18d8d0fa8be55608f475 (files: tools/compute_store_aot.py, tests/compute_heap_store_check.py, docs/experiments.md).
Result: 0 P1, 0 P2.
Semantics:
buffer_store_format_d16_xyzwwith two source VGPRs expands X/Y from the low/high half of the first VGPR and Z/W from the second. Each half goes throughf16tof32into a binary32 word of a live format 77 (BUF_FMT_32_32_32_32_FLOAT) view. This matches the RDNA2 D16 format-store model.- The record's format word must match the opcode: a D16 opcode on a UINT4 record, or a UINT opcode on a FLOAT4 record, stores nothing. The bounds check keeps the full 16-byte texel, and
spanreserves four bytes per component for the heap route. - Overlap check: #2165 (d16 buffer loads), #2192 (10-bit-x format decode) and #2205 (LLVM path in tests) touch other code paths. This PR only changes the heap-view store helper and its lowering, so there is no duplicated opcode or slice. The two
compute_store_aot.pyedits may need a trivial rebase if #2165 merges first. - Caveat, not a blocker: the D16 cases are checked against a CPU reference and D3D12 WARP/hardware adapters. They were not checked against console hardware.
Linux checks executed locally:
python3 tests/docs_links_check.py: pass (18 files, 414 links)python3 tests/bidi_controls_check.py: passgit diff --check origin/main...HEAD: passpython3 -B tests/compute_heap_store_check.py controls: pass
Mutation (restored with git checkout -- . afterwards):
- Removing
d16_xyzwfrom the accepted heap-store channels makescontrolsfail withValueError: Heap store view requires buffer_store_format_xyzw or buffer_store_format_d16_xyzw. Killed. - Changing the conversion's second lane to
value.x: the Linuxcontrolstest does not catch it, since it only checks the HLSL text. The PR's WARP/hardware readback fixture is the guard for it, and it covers this mutation by design. Its runtime results come from the author and from CI.
CI: Build and test on Windows = SUCCESS (run 45560989329), Linux checks and gfx1013 fixtures = SUCCESS.
AI-assisted; commands listed were executed locally.
This was referenced Nov 25, 2026
This was referenced Nov 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #2022, follow-up to the UINT4 store in #2224. The heap-view route now accepts gfx1013
buffer_store_format_d16_xyzwwith two source VGPRs and a live identityBUF_FMT_32_32_32_32_FLOATview (77). Each packed half expands to a binary32 component in X/Y/Z/W order. The bounds check uses the full 16-byte destination texel. Selecting a UINT4 view with the packed opcode leaves the destination untouched, as does selecting a FLOAT4 view with the ordinary UINT opcode. AMD RDNA 2 instruction set · Microsoft HLSL conversionVerification on Windows at
5971d011buffer_store_format_d16_xyzw v[10:11], v8, s[20:23], 0 idxen offset:4; the heap-view lowering refused it. On this branch the source assembly, LLVM-C disassembly lowering and container CLI emit identical HLSL for both the packed and original program.python -B tests/compute_heap_store_check.py draw <dxc> <offscreen_check> warpand repeated it withhardware. Each device passed all 12 D16 cases and detected 11 wrong shaders. The original UINT4 path passed all 12 cases and detected its 8 wrong shaders on both devices. Each case compares all 320 words. The packed inputs include successive binary16 values at 1.0, −2.0, the smallest positive binary16 subnormal and negative zero. Dropping the conversion, duplicating the low half or sourcing W from the wrong VGPR each caused a readback mismatch. Used DXC 1.9.2609 and the source-built renderer.python -B tests/compute_heap_store_check.py controls, the adjacent heap-load, format-load, entry-layout, population-count and integer-comparison controls passed. Documentation link and bidi checks andgit diff --checkpassed.python -B tests/compute_heap_store_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1.AI-assisted with Codex (GPT-6.2 Astra xhigh).