Repository navigation
feat(shader): implement the D16 format buffer stores - #331
Merged
oneandonlydean merged 4 commits intoOct 4, 2026
Merged
Conversation
Progress report (d3ec1f1 → b29fe00)📈 GPU shader instructions: 75.73% (+4.72%, +55 implemented instructions) ✅ 55 implemented
|
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>
buffer_store_format_* and tbuffer_store_format_* wrote the register bits as they were: an 8_UNORM store of 1.0f wrote 0x00 (the low byte of 0x3f800000), packed formats such as 2_10_10_10 overwrote the whole word with each component, and the components the instruction does not provide were left untouched. Each component is now encoded as the hardware does: unorm/snorm (and uscaled/sscaled, which store the same way) round x*M exactly to nearest even after clamping, with NaN as 0; uint/sint saturate; f16 and the 11/10-bit floats truncate toward zero and saturate. The whole element is written, with the missing components as 0, and packed formats are composed into one word. Co-Authored-By: Claude <noreply@anthropic.com>
buffer_store_format_d16_{x,xy,xyz,xyzw}, buffer_store_format_d16_hi_x
and tbuffer_store_format_d16_{x,xy,xyz,xyzw} take one 16-bit half per
component (two per VGPR; hi_x takes the high half). As on hardware,
float, norm and scaled formats read the half as f16, widen it exactly
to f32 and then encode it like a 32-bit formatted store; uint formats
zero-extend it and sint formats sign-extend it before saturating, and
16-bit float components store it unchanged.
Co-Authored-By: Claude <noreply@anthropic.com>
adriadam10
force-pushed
the
feat/format-d16-stores
branch
from
October 3, 2026 09:44
6f4b044 to
b29fe00
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
11 tasks done
ps54all
pushed a commit
to ps54all/AnyPS5
that referenced
this pull request
Oct 14, 2026
image_store with D16 data to a storage image of a SINT format threw "stores 16-bit data to an image of a SINT format", both when the descriptor is decoded and in the SPIR-V image emitter, and the runtime image modes left out the SINT conversions for such images. God of War Ragnarok (PPSA08330) stops on it in compute shader 0x1052a17900 right after its MFSR setup. Each 16-bit half is now converted like the D16 format buffer stores (EmitD16StoreComponent): sign-extended, then saturated to the component width as for 32-bit data. The buffer form was measured on RDNA2 in boykopovar#331; the image form is not measured (TechnicalDebt). agc_driver_image_store_sint now stores D16 data with DMASK 0xf and 0x5 to all eight SINT formats and after an image_atomic_add on 32_SINT, instead of expecting the refusal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
adriadam10
pushed a commit
to ps54all/AnyPS5
that referenced
this pull request
Oct 16, 2026
image_store with D16 data to a storage image of a SINT format threw "stores 16-bit data to an image of a SINT format", both when the descriptor is decoded and in the SPIR-V image emitter, and the runtime image modes left out the SINT conversions for such images. God of War Ragnarok (PPSA08330) stops on it in compute shader 0x1052a17900 right after its MFSR setup. Each 16-bit half is now converted like the D16 format buffer stores (EmitD16StoreComponent): sign-extended, then saturated to the component width as for 32-bit data. The buffer form was measured on RDNA2 in boykopovar#331; the image form is not measured (TechnicalDebt). agc_driver_image_store_sint now stores D16 data with DMASK 0xf and 0x5 to all eight SINT formats and after an image_atomic_add on 32_SINT, instead of expecting the refusal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
This adds the store half of the D16 formats. The loads were #329.
buffer_store_format_d16_{x,xy,xyz,xyzw}(0x84-0x87) andbuffer_store_format_d16_hi_x(0x27).tbuffer_store_format_d16_{x,xy,xyz,xyzw}(0x0c-0x0f).Each component is a 16-bit half: two per VGPR, low half first, and
_hi_xtakes the high half.Semantics measured on an RDNA2 GPU (2048 vectors × 15 stores, all matched by a Python model):
0x3c00→0xffin8_UINT,0x00003c00in32_UINT)0xbc00→0x80in8_SINT,0xffffbc00in32_SINT)The whole element is written with missing components as 0, as in #330.
The f16 → f32 widening is done with integer ops: subnormals are normalized with
FindUMsband NaN payloads are kept.unpackHalf2x16may flush f16 denormals or quiet NaNs, depending on the driver, and both are visible in the 11/10-bit float formats.Test
agc_driver_format_d16_store: 16 results × 32 lanes captured on the RDNA2 GPU. It covers every component type above, f16 specials (±inf, NaN0x7e00/0x7c01, subnormals0x0001/0x8001, 65504) in both halves, thexy/xyz/xyzwpacking with zero fill, and_hi_xthrough the descriptor's format.Tested
Linux, full ctest (102) passes.
8unorm is 0xaaaaaa00, expected 0xaaaaaaff.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)