feat(shader): implement S_CALL_B64 #895
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/895"
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 Kikoarl on 2026-10-06T13:47:24Z.
What
Implement the remaining RDNA 2 SOPK subroutine call instruction:
S_CALL_B64(opcode0x16), completing the SOPK instruction category (27/27).sdst(dataDwordCount = 2) and relative target address (PC + 4 + simm16 * 4).GraphBuilder.Tested
Linux x86_64, unit test
scalar_callverifying decoding, 64-bit destination pair, positive/negative relative branch targets, and translation throw path.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-06T13:48:02Z.
Progress report (
e79c971→f5619c4)📈 GPU shader instructions: 97.77% (+0.09%, +1 implemented instructions)
✅ 1 implemented
S_CALL_B64Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-07T08:16:52Z.
Review: CHANGES_REQUESTED
Measured on gfx1035: sdst gets the address of the
s_call_b64+ 4 (high dword = PC high), and forward/backward targets are PC + 4 + simm16 * 4. The decoder matches that.GraphBuilder.cpp:590andRdnaOpcode.cpp:907links_call_b64as a plains_branch: no return edge to PC + 4, and sdst is never written. With a real call/return (s_call_b64 s[4:5], callee...callee: s_setpc_b64 s[4:5]), decode +GraphBuilder::Buildnow fails withunsupported dynamic s_setpc_b64 at program counter 0x0000000c. The new throw inScalarInstructions.cpp:33is never reached, and the error names the wrong instruction. It still throws, so nothing silently goes wrong, but the CFG model is wrong for a call and anyone implementing calls later would build on it.s_call_b64out ofIsDirectBranchOpcodeandlinkBlocksfor now, so it stays an ordinary instruction and throws at its own translation. Model it in the CFG (call + return edge) only once calls are actually implemented.ScalarCall.cpponly exercisesDecodeRdnaSopkandTranslateInstruction. None of the tests reachGraphBuilder. Please add a case that decodes and builds a small call/return program and checks that it fails on thes_call_b64throw.Imported from boykopovar/AnyPS5. Originally posted by Kikoarl on 2026-10-07T13:02:50Z.
@adriadam10 Thanks for the guidance! Rebased on latest main, left
s_call_b64out ofIsDirectBranchOpcodeandlinkBlocksso it remains an ordinary instruction and throws at its own translation, and added a test case inScalarCall.cppthat decodes and builds a small call program withGraphBuilderand verifies that translation fails on thes_call_b64throw. Ready for review.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-08T17:24:41Z.
Rechecked on the merge with current
main: build and full ctest green (467/467,scalar_callincluded).s_call_b64now stays out of the CFG branch model and throws at its own translation, which is what the last review asked for. Merging, thanks.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-08T17:24:56Z.
Review: APPROVED
Requested changes addressed; build and full ctest green on the merge with main.