Repository navigation
Conversation
Decodes the four remaining scalar control instructions with encodings from the AMD machine-readable RDNA2 ISA spec: S_RFE_B64 (SOP1 0x22), S_SETHALT (SOPP 0x0D), S_SENDMSGHALT (SOPP 0x11) and S_CODE_END (SOPP 0x1F). s_rfe_b64 is modelled as an indirect jump like s_setpc_b64: measured on RDNA2 hardware (gfx1031) with the hardware oracle, a jump to the address in its scalar source reaches code past s_endpgm, identical to s_setpc_b64 with the same target. The CFG target resolvers and the embedded vertex fetch analysis treat it as s_setpc_b64; the decoder gives it no destination, as LLVM encodes none. s_sethalt is implemented for the immediates measured on gfx1031: 0, 2 and 4 run through to the end of the kernel with the store after them visible; 1, 3 and 5 never retire the wave (debugger halt without a debugger), so they throw in IR translation; immediates above 5 are unverified and throw. s_sendmsghalt and s_code_end throw in IR translation: the message goes to graphics control hardware the port does not model, and code_end measured on gfx1031 inactivates the HSA queue with HSA_STATUS_ERROR_ILLEGAL_INSTRUCTION, so a throw is the faithful host behaviour. SOPP reaches 37/37 in tools/progress.py; shaders 1139 -> 1143 / 1166.
This was referenced Oct 8, 2026
9 tasks done
Collaborator
|
Thanks for the PR. Closing it as a duplicate of #1253, merged today: What's left as a difference isn't something we'd take on its own:
If you find a title that actually reaches one of these throws, feel free to open a new PR on top of current |
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
Decodes the four remaining scalar control instructions that were rejected as unsupported:
S_RFE_B64(SOP1 0x22),S_SETHALT(SOPP 0x0D),S_SENDMSGHALT(SOPP 0x11) andS_CODE_END(SOPP 0x1F). Following the pattern of #895 (s_call_b64): the decoder recognises them from the encoding, IR translation throws a named "not implemented" error until the backend models wave halt/return semantics.s_rfe_b64 is modelled as an indirect jump like s_setpc_b64: measured on RDNA2 hardware (gfx1031) with the hardware oracle, a jump to the address in its scalar source reaches code past s_endpgm, identical to s_setpc_b64 with the same target. The CFG target resolvers and the embedded vertex fetch analysis treat it as s_setpc_b64; the decoder gives it no destination, as LLVM encodes none.
s_sethalt is implemented for the immediates measured on gfx1031: 0, 2 and 4 run through to the end of the kernel with the store after them visible; 1, 3 and 5 never retire the wave (debugger halt without a debugger), so they throw in IR translation; immediates above 5 are unverified and throw.
s_sendmsghalt and s_code_end throw in IR translation: the message goes to graphics control hardware the port does not model, and code_end measured on gfx1031 inactivates the HSA queue with
HSA_STATUS_ERROR_ILLEGAL_INSTRUCTION, so a throw is the faithful host behaviour.
Provenance: AMD machine-readable GPU ISA spec (
amdgpu_isa_rdna2.xml, https://gpuopen.com/machine-readable-isa/ — the same sourcetools/rdna_isa.txt's header cites). Encodings cross-checked against three values already in the decoder and merged PR text:s_getpc_b64= 0x1F,s_call_b64= 0x16 (#895),s_swappc_b64= 0x21 (#1124). Operands per spec:s_rfe_b64has SSRC0 only and no destination (the NULL-dst form ofs_swappc_b64keeps mapping to setpc as before); the three SOPP ops carry SIMM16.SOPP reaches 37/37 in
tools/progress.py; shaders 1139 -> 1143 / 1166 (98.03%).Tested
Windows 11, NVIDIA Blackwell desktop GPU (driver 616.92), MinGW-w64 GCC 15.2.0 (winlibs x86_64-ucrt-posix-seh r7). Full ctest:
396/396, including the new
scalar_halt_opstest — it decodes each instruction from raw words, checks family/operands/source counts, and asserts the named translation throw both directly throughTranslateInstructionand through a full program translate.python3 tools/check_conventions.py --base origin/mainpasses.Checklist
main; no other open PR implements the same functions (checked against all 202 open PRs, descriptions and comment threads)NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)