Repository navigation
feat(shader): decode halt, trap return, code end, GWS and ordered count instructions - #1253
Conversation
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
|
…nt instructions s_sethalt with SIMM16[0] clear is a no-op; s_sethalt 1, s_sendmsghalt, a reached s_code_end, s_rfe_b64, the ds_gws_* instructions and ds_ordered_count throw with the reason at translation. Linear decoding stops at s_code_end like at s_endpgm, so code padded with s_code_end after a final backward branch decodes. Encodings from LLVM SOPInstructions.td and DSInstructions.td, checked against the gfx10 MC tests; semantics from the RDNA 2 ISA guide.
Progress report (3069680 → 2e0b7bb)📈 GPU shader instructions: 98.03% (+0.95%, +11 implemented instructions) ✅ 11 implemented
|
The test is added to ctest in its own BUILD_TESTING block, as agc_vop1_sdwa_move_decode is, instead of in the shared test list that boykopovar#1187 also extends.
… shared lines boykopovar#1372 adds its test after the vop1 decode tests and boykopovar#1314 its debt entry after s_setkill, the places where this branch added its own. The wave control decode test now precedes the vop1 decode tests and the s_sethalt entry follows sceRtcParseDateTime, so either pull request can merge first without a conflict. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
boykopovar#1398 and boykopovar#1399 both rewrite the sceRtcParseDateTime entry that the s_sethalt entry followed. It now follows the libSceAudio3d entries, which no open pull request edits, so either can merge first without a conflict. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
|
Checked the decoder tables, the translation throws and both new tests against Added on top of your branch (rebased onto current
Merging once CI is green on the rebased head (the first runs were waiting for approval). |
3814fdf to
2e0b7bb
Compare
What
Decodes the 11 instructions from
tools/rdna_isa.txtthat the decoder did not recognize and that no open pull request covers. Shader instructions: 1139/1166 -> 1150/1166. The other 16 are in #697, #895, #1198, #1217, #1049 and #1053.s_sethalt(SOPP 0x0d): with SIMM16[0] clear it is a no-op; with it set it throws at translation, as the wave would halt until a debugger resumes it.s_sendmsghalt(SOPP 0x11) ands_rfe_b64(SOP1 0x22) throw at translation: the first halts the wave, the second returns from a trap handler, which recompiled shaders do not run in.s_code_end(SOPP 0x1f) throws if it is reached. Linear decoding stops at it like ats_endpgmwhen no branch targets past it, so a program whose last instruction is a backward branch followed bys_code_endpadding decodes; it failed withunsupported SOPP opcode 31before.ds_gws_init,ds_gws_sema_v,ds_gws_sema_br,ds_gws_sema_p,ds_gws_sema_release_all,ds_gws_barrier(DS 0x19, 0x1a, 0x1b, 0x1c, 0x18, 0x1d) andds_ordered_count(DS 0x3f) decode with their operands (the GWS data VGPR is in the ADDR field, no VGPR destination) and throw at translation: GWS barriers and semaphores shared by waves of different workgroups, and GDS counters updated in wave launch order, are not modeled.Sources:
llvm/lib/Target/AMDGPU/SOPInstructions.tdandllvm/lib/Target/AMDGPU/DSInstructions.td(has_gws_data0: "data0 is encoded as addr"), checked againstllvm/test/MC/AMDGPU/gfx10_asm_sop.sandllvm/test/MC/AMDGPU/gfx10_asm_ds.s.s_code_endas end-of-code padding:AMDGPUTargetAsmStreamer::EmitCodeEndinllvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp.int_amdgcn_ds_gws_initandint_amdgcn_ds_gws_barrierinllvm/include/llvm/IR/IntrinsicsAMDGPU.td.s_sethalt: RDNA 2 ISA guide, SOPP opcode table (SIMM16[0] = 1 halts the wave, 0 resumes it). The no-op for 0 is not measured on hardware and is recorded in TechnicalDebt.Tested
Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, NVIDIA GeForce RTX 3060 Laptop GPU.
agc_wave_control_decode: decodes every new opcode and checks its operands, checks the message each refused case throws, and recompiles a program padded withs_code_endafter its last branch.agc_driver_scalar_sethalt: runss_sethalt 0and ans_code_end-padded program on the GPU and checks the stored results.guest_system_font, which fails the same way onmainon Windows (test(font): move the console font aside instead of deleting it while its face is mapped #1172).No title or homebrew tested; not run on AMD hardware.
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)