feat(shader): implement the D16 byte/short loads and high-half stores #319
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/319"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-02T05:02:09Z.
What
These threw "MUBUF/FLAT/DS opcode is not supported":
buffer_load_{ubyte,sbyte,short}_d16,buffer_load_{ubyte,sbyte,short}_d16_hi,buffer_store_{byte,short}_d16_hiprogress.pyalso counts for theirglobal_*andscratch_*formsds_read_{u8,i8}_d16,ds_read_{u8,i8}_d16_hi,ds_write_b8_d16_hiThey reuse what
ds_read_u16_d16(_hi)/ds_write_b16_d16_hialready do. A D16 load writes the low (_d16) or high (_d16_hi) half of the VGPR through the 16-bit destination select, keeping the other half; byte forms are zero- or sign-extended to 16 bits first. A_d16_histore reads its byte/short from the high half. The ad-hoc select assignments in the DS decoder are folded into oned16Halfhelper, which the MUBUF and FLAT decoders use too. No new IR.Not included: the
*_format_d16_hi_xandtbuffer_*_format_d16_*forms, which need format conversion to f16 (separate PR).Test
agc_driver_d16_memory: one wave32 shader (words fromllvm-mc -mcpu=gfx1013). On VGPRs preset to0xabcdabcdit runs every load pair (lo then hi) for buffer, global (address from the buffer descriptor) and LDS. It also runsds_write_b8_d16_hiand the two buffer_d16_histores, at odd/unaligned byte offsets with sign-carrying bytes. Each lane is checked against a C++ model. Global stores are not covered: the driver refuses writable FLAT/GLOBAL addresses without GPU ownership tracking, which the test harness has no way to set up.Tested
Linux, full ctest (99) passes.
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)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-02T05:02:30Z.
Progress report (
d3ec1f1→504a2fd)📈 GPU shader instructions: 74.19% (+3.18%, +37 implemented instructions)
✅ 37 implemented
DS_READ_I8_D16DS_READ_I8_D16_HIDS_READ_U8_D16DS_READ_U8_D16_HIDS_WRITE_B8_D16_HIFLAT_LOAD_SBYTE_D16FLAT_LOAD_SBYTE_D16_HIFLAT_LOAD_SHORT_D16FLAT_LOAD_SHORT_D16_HIFLAT_LOAD_UBYTE_D16FLAT_LOAD_UBYTE_D16_HIFLAT_STORE_BYTE_D16_HIFLAT_STORE_SHORT_D16_HIGLOBAL_LOAD_SBYTE_D16GLOBAL_LOAD_SBYTE_D16_HIGLOBAL_LOAD_SHORT_D16GLOBAL_LOAD_SHORT_D16_HIGLOBAL_LOAD_UBYTE_D16GLOBAL_LOAD_UBYTE_D16_HIGLOBAL_STORE_BYTE_D16_HIGLOBAL_STORE_SHORT_D16_HIBUFFER_LOAD_SBYTE_D16BUFFER_LOAD_SBYTE_D16_HIBUFFER_LOAD_SHORT_D16BUFFER_LOAD_SHORT_D16_HIBUFFER_LOAD_UBYTE_D16BUFFER_LOAD_UBYTE_D16_HIBUFFER_STORE_BYTE_D16_HIBUFFER_STORE_SHORT_D16_HISCRATCH_LOAD_SBYTE_D16SCRATCH_LOAD_SBYTE_D16_HISCRATCH_LOAD_SHORT_D16SCRATCH_LOAD_SHORT_D16_HISCRATCH_LOAD_UBYTE_D16SCRATCH_LOAD_UBYTE_D16_HISCRATCH_STORE_BYTE_D16_HISCRATCH_STORE_SHORT_D16_HI