fix(tools): stop counting IMAGE_*_PCK2/PCK4 as decoded instructions #1214
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1214"
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 polysius on 2026-10-07T18:00:25Z.
What
#942 credited
IMAGE_LOAD_PCK2/PCK4,IMAGE_LOAD_MIP_PCK2/PCK4,IMAGE_STORE_PCK2/PCK4andIMAGE_STORE_MIP_PCK2/PCK4to the*_PCKopcodes, treating them as the 2- and 4-dword forms selected bydmask. AMD's generated ISA tables list them as separate MIMG opcodes:IMAGE_LOAD_PCKImageLoadPckIMAGE_LOAD_PCK2/PCK4IMAGE_LOAD_MIP_PCKImageLoadMipPckIMAGE_LOAD_MIP_PCK2/PCK4IMAGE_STORE_PCKImageStorePckIMAGE_STORE_PCK2/PCK4IMAGE_STORE_MIP_PCKImageStoreMipPckIMAGE_STORE_MIP_PCK2/PCK4Sources, both generated from AMD's machine-readable ISA:
source/isa_decoder/isa_decoder.cpp, RDNA1 load/store tables:table[112] = lsa_table; // IMAGE_LOAD_PCK2,table[113] ... // IMAGE_LOAD_PCK4,table[115]/[116](MIP),table[118]/[119](store) andtable[121]/[122](MIP store).generated/rdna2/opcodes.h:kImageLoadPck2Mimg = 112throughkImageStoreMipPck4Mimg = 122.RdnaImageOpDecoder.cpphas no entries for 112–122, so a shader that uses them throwsunsupported MIMG opcode. Thedmaskforms of opcodes 2/4/10/11 that #557 and #561 test areIMAGE_*_PCKitself.This removes the four
OPCODE_VARIANTSentries. Shader progress goes from 1139 to 1131 of 1166 (97.68% to 97.0%).#1049 (
IMAGE_*_BY2/BY4credited toImageLoad/ImageStoreand their MIP forms) and #1053 (IMAGE_GATHER4H_PCK/IMAGE_GATHER8H_PCKcredited toImageGather4h) follow the same approach. The same tables list those as separate opcodes too:LOAD_BY2/BY466/67,LOAD_MIP_BY2/BY474/75,STORE_BY2/BY482/83,STORE_MIP_BY2/BY490/91,GATHER4H_PCK98,GATHER8H_PCK99.Tested
python tools/progress.py outbefore and after: shaders 1139/1166 → 1131/1166, libraries unchanged. No C++ change.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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-07T21:22:06Z.
Confirmed — and the pr-overlap warning here is worth acting on, because three open PRs edit the same five lines on opposite premises.
The change itself checks out.
rdna_isa.txtlists the names separately, which is the author's stated basis:and the decoder binds only the first, so nothing decodes the other two:
No entry corresponds to
PCK2/PCK4, and no source in the tree contains those mnemonics at all. Measured effect of the change, drivingprogress.py --root <repo>with both versions and diffing the output directory:1139/1166(97.68%)1131/1166(97.0%)120/130(92%)112/130(86%)Exactly eight — the four families × two sizes — which is what the alias map claimed. Note this corrects the published badge (
badge-shaders.svg), not just an internal number.What I did not verify: the opcode numbers. The body cites them as 112/113 from AMD's generated tables; in-tree I have the mnemonics but not their numbers, so I confirmed "these are separate mnemonics the decoder lacks a binding for", not "112/113" itself.
The collision.
tools/progress.py:55-59is also edited by #1049 and #1053, and the three rest on different premises about when an alias is legitimate:ImageLoad → IMAGE_LOAD_BY2/BY4, describing them as the same instruction transferring 2 or 4 components viadmask. That is the same mechanism, used the other way. It looks right: the decoder has noBY2/BY4opcode either, but if they aredmask-selected they shareimage_load's encoding and the alias is honest.ImageGather4h → IMAGE_GATHER4H_PCK/GATHER8H_PCK. Same question.These cannot all be right unless the rule is stated. The rule that makes them consistent, and the one this PR is implicitly applying: an alias is honest when the variant shares the base instruction's opcode and differs only in
dmaskor suffix; it is not honest when the ISA gives the variant its own opcode, because then nothing in the decoder executes it.PCK2/PCK4are the second case — which is why this PR removes them.Suggested order, since they conflict textually: land #1214 first (it is the one that removes a wrong count), then rebase #1049 and #1053 onto it and state the opcode for each added pairing. If
IMAGE_GATHER4H_PCKhas its own opcode, #1053 has the same defect this PR corrects.