Repository navigation
feat(shader): implement the D16 format buffer loads - #329
Merged
Merged
Conversation
Progress report (d3ec1f1 → 5c8c5d2)📈 GPU shader instructions: 74.96% (+3.95%, +46 implemented instructions) ✅ 46 implemented
|
This was referenced Oct 2, 2026
This was referenced Oct 2, 2026
Merged
Merged
buffer/flat/global/scratch_load_{ubyte,sbyte,short}_d16(_hi),
buffer/flat/global/scratch_store_{byte,short}_d16_hi and
ds_read_{u8,i8}_d16(_hi), ds_write_b8_d16_hi threw in the decoder. They use
the same 16-bit destination/source select as the existing ds_read_u16_d16
and ds_write_b16_d16_hi: a load writes one half and keeps the other, a
_d16_hi store takes its data from the high half.
Co-Authored-By: Claude <noreply@anthropic.com>
buffer_load_format_d16_{x,xy,xyz,xyzw}, buffer_load_format_d16_hi_x and
tbuffer_load_format_d16_{x,xy,xyz,xyzw} convert each component to 16
bits and pack two per VGPR. The conversions follow the hardware:
unorm/snorm round the exact value to nearest even, scaled integers
round to nearest even and saturate at 65504, 32-bit floats truncate
toward zero (saturating at 65504), and 32-bit integers saturate to 16
bits. All of it is done with integer ops so it does not depend on the
driver's f16 rounding. _x and _hi_x keep the other half, xyz keeps the
upper half of its second register, and a descriptor constant one is
f16 1.0 for non-integer formats.
Co-Authored-By: Claude <noreply@anthropic.com>
adriadam10
force-pushed
the
feat/format-d16
branch
from
October 3, 2026 09:44
01cf2ef to
5c8c5d2
Compare
SP4C3B4R-8
pushed a commit
to SP4C3B4R-8/AnyPS5
that referenced
this pull request
Oct 6, 2026
Takes the 13 gate-batch PRs that merged upstream (boykopovar#319 boykopovar#329 boykopovar#330 boykopovar#331 boykopovar#325 boykopovar#435 boykopovar#471 boykopovar#294 boykopovar#376 boykopovar#404 boykopovar#394 boykopovar#401 boykopovar#446) in place of astrobot's local versions, as integ/gate-batch cab0eab had them: boykopovar#294 and boykopovar#376 in astrobot's depth model (DepthTarget, state.depth), boykopovar#394 with the thick mip tails, boykopovar#401 over astrobot's slab pool, boykopovar#471 keeping the settled single-lane path. Also takes the rest of main since a818bee (boykopovar#532 boykopovar#340 boykopovar#486 boykopovar#484 boykopovar#316 boykopovar#243 boykopovar#334 boykopovar#434 boykopovar#437 boykopovar#470 boykopovar#373 boykopovar#452 boykopovar#455 and our upstreamed PRs, where astrobot keeps its later revisions and env switches). Resolution notes: relinker converter/matcher/tests are upstream's (boykopovar#432 decoder covers VEX RIP-relative followers); RecompileResult gains boykopovar#316's hostSubgroupSize (set from request.target.subgroupSize); shader disk cache format 9; boykopovar#452's scissor message; upstream's later live-stack and memory-copy decode tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Mgp3oZvembQziVNE2xARQK
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.
What
Nine D16 format loads were rejected by the decoder:
buffer_load_format_d16_{x,xy,xyz,xyzw}(0x80-0x83) andbuffer_load_format_d16_hi_x(0x26).tbuffer_load_format_d16_{x,xy,xyz,xyzw}(0x08-0x0b).The ISA sweep only covered MUBUF opcodes below 0x80, which is why it missed the first four. They load a formatted element like the 32-bit forms, convert each component to 16 bits, and pack two per VGPR.
Semantics measured on an RDNA2 GPU (ROCm HSA, raw kernels; 3344 vectors per format, all matched by a Python model):
Packing:
_xwrites the low half and keeps the high half._hi_xwrites the high half and keeps the low half._xyand_xyzwoverwrite their registers._xyzkeeps the upper half of its second register.0x3c00) for non-integer formats and 1 for UINT/SINT.Implementation:
MemoryInfo::d16marks the load.EmitD16FormatComponentinstead ofNormalizeFormatComponent. It uses integer ops only (q = (v << s) / Mwith the remainder for UNORM/SNORM, mantissa truncation for RTZ), so results don't depend on the driver's f32→f16 rounding.0xffaf). The test includes them._x/_hi_xreuse thed16Halfdestination selector from feat(shader): implement the D16 byte/short loads and high-half stores #319.D16 format stores are not part of this PR. The existing formatted stores don't convert to the format yet, and that will be a separate change.
Test
agc_driver_format_d16: 16 results × 32 lanes captured on the RDNA2 GPU. It covers every component type above, the double-rounding cases, f32 specials (±inf, NaN payloads, 65520, overflow and subnormal edges), every packing form including the preserved halves, and a descriptor built in the shader with swizzlex,0,1,1.Tested
Linux, full ctest (100) passes.
8unorm is 0xdead0000, expected 0xdead3c00. Without the f16 one constant:xyzw_hi is 0x3f800000, expected 0x3c003c00.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)d16Half); review only the last commit