Repository navigation
fix(recompiler): accept SDWA source selects on v_cvt_f32_ubyte1, ubyte2 and ubyte3 - #5478
Merged
oneandonlydean merged 1 commit intoOct 13, 2026
Merged
Conversation
…e2 and ubyte3
v_cvt_f32_ubyte0 accepts every SDWA source selector, but the other three byte
conversions had no VOP1 SDWA rule, so any SDWA source select on them was refused
("VOP1 SDWA source selector 4 of opcode 0x12 at pc 0xfcc is not supported").
The selected and optionally sign-extended source goes through the same operand
path as for ubyte0 before byte N is extracted: SDWA supplies source 0 (RDNA 2 ISA
guide 6.8 and 13.3.7) and the opcode reads S0.u[8N+7:8N] (12.8).
agc_driver_sdwa_cvt_f32_ubyte: WORD_0 and WORD_1 selects on ubyte1, and
sign-extended WORD_1 and BYTE_3 selects on ubyte2 and ubyte3.
This was referenced Oct 13, 2026
|
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.
|
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
v_cvt_f32_ubyte0accepts every SDWA source selector, butv_cvt_f32_ubyte1,ubyte2andubyte3have no row invop1SdwaRules, so any SDWA source select on them is refused. PPSA34299 stops onmain075169f, before its first frame:Opcode 0x12 is
v_cvt_f32_ubyte1, selector 4 isWORD_0.This adds the three rows, the same as
ubyte0's. The selected source goes through the existing SDWA operand path (OperandAccess.cpp: bit-field extract of the selected byte or word, zero- or sign-extended bySRC0_SEXT), andvCvtF32Ubytethen takes byte N of that value. Source of the semantics: the RDNA 2 ISA guide (30 November 2020). 6.8 and 13.3.7 (Table 88): SDWA supplies source 0, withSRC0_SELselecting a byte, a word or the dword andSRC0_SEXTsign-extending it. 12.8, VOP1 opcodes 18-20:D.f = (float)(S0.u[15:8]),S0.u[23:16]andS0.u[31:24]. Sov_cvt_f32_ubyte1 src0_sel:WORD_1converts bits 31:24 of the register. A byte select onubyte1-3, and a word select onubyte2andubyte3, convert 0, or 255 when sign-extended from a negative value. Negate and absolute stay refused, as forubyte0. Not measured on hardware (no AMD GPU here), so it is recorded indocs/dev/debt/shader.md.Tested
Linux (CachyOS, kernel 7.2.3), GCC, Release with
BUILD_TESTING=ON, onmain0aa4cb1.agc_driver_sdwa_cvt_f32_ubyte(64 lanes, varied bytes):ubyte1withWORD_0andWORD_1,ubyte2with sign-extendedWORD_1,ubyte3with sign-extendedBYTE_3. Onmainit fails withVOP1 SDWA source selector 4 of opcode 0x12 at pc 0x34 is not supported; with the change it passes in 0.15 s (useCache = false). Not run on lavapipe here.ctest -R "sdwa|rdna|vop1|decoder_length": 15 of 15 pass, including the other SDWA execution and decode tests.SAMPLE_COVERAGE, bit 14, not handled yet; separate topic.)tools/check_conventions.pyandgit diff --checkpass.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)VOP1 SDWA source selector 4 of opcode 0x12 at pc 0xfcc is not supported