feat(shader): implement s_swappc_b64 null, long branches and dword jump tables #754
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/754"
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 Celegans12 on 2026-10-05T20:40:34Z.
What
The decoder threw
unsupported SOP1 opcode 33ons_swappc_b64 null, s[N:N+1](0xbefd21NN), andGraphBuildercould not resolve the jumps built around it.s_setpc_b64: S_SWAPPC_B64 isD.u64 = PC + 4; PC = S0.u64(RDNA2 ISA) and null drops the write, as in KytyPS5DecodeSop1. A real destination (a call) still throws.s_getpc_b64, thens_add_u32/s_addc_u32ors_sub_u32/s_subb_u32immediates on the same pair (alsovcc); the target is the exact 64-bit result, and a jump into the sequence throws.s_load_dwordentry, with the base froms_getpc_b64/s_add_u32/s_addc_u32 0and the index bounded bys_min_u32(at most 255) and scaled bys_lshl_b32 2. The resolver follows the last write of each register through straight-line code, so other code may sit between the steps; anything else is refused. Lowered like the 64-bit tables of #141; the code table load now also takes one-dword entries.all_shaders.xpps: 6 long branches and 25 tables in 11 programs, e.g.32ac8b907b12797b0x144beea1f00 806aff6a 0002ee98 826b806b befd216a,2bb3e36a02c363730x208 (15 entries,v_cmpwrites between load and jump),22cccef7ba6022870x67ec (index invcc_lo, load offset 0x50).s_swappc_b64 null, s[6:7](0xbefd2106), whereDecodeRdnaFrontProgramnow stops.resolveJumpTable(waitcnt variants); this PR does not touch that function and merges cleanly with it.s_bfe_i64to the same decoder file; the two merge cleanly.Tested
main681f83e5: configure-DBUILD_TESTING=ON, full build,--target libs,ctest:ctest --output-on-failure)agc_shader_control_flow(decode, front program, table values and targets, both long branches, structurize and recompile, 8 refusals) and newagc_driver_scalar_swappc(all four shapes on the GPU, wave32 and wave64). Both fail onmainwithunsupported SOP1 opcode 33.3ba7ffa5ac5a098apassesspirv-valwith null descriptors.cd88a1ad0e8964d4(6 tables of 98 entries) spends 25 minutes inStructurizer::Structurize, and32ac8b907b12797b(10 tables) does not finish it in 90 minutes.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)