Repository navigation
Translator: v_mqsad_u32_u8 - #796
Merged
Merged
Conversation
v_mqsad_u32_u8 raised Unsupported. Four masked byte-SADs with full 32-bit accumulators (RDNA ISA pseudocode): D[k] = S2[k] + v_msad_u8 of S0's 32-bit window at byte k against S1. S0 is a 64-bit pair, S2 and D four VGPRs. clamp is rejected. tests/semantic/test_alu_mqsad_u32.py checks it against a plain-Python reference. test_translate.py and test_f16_op_sel.py used it as their example of an unsupported instruction; they now use v_sat_pk_u8_i16.
IAmNotSiob
approved these changes
Nov 22, 2026
IAmNotSiob
left a comment
Contributor
There was a problem hiding this comment.
matches the pseudocode: masked byte-SAD per window, 32-bit wrapping accumulators, every source read before the first write (good for overlapping regs), and clamp is refused. tests pass merged with main o7 AI-assisted review (Claude Code).
ItsNotRexed
added a commit
that referenced
this pull request
Nov 22, 2026
quackottu
reviewed
Nov 22, 2026
quackottu
left a comment
Contributor
There was a problem hiding this comment.
Tested 4a8d410 on NVIDIA GeForce RTX 5070 (subgroup 32), driver 621.24, Windows 11 Pro (26300), Vulkan SDK 1.4.363.0, llvm-mc 21.1.8 (built with scripts/build_llvm_mc.ps1), scripts/run_gpu_tests.py:
- native: 70/97 passed, 27 skipped (
main8df277f here: 64/91 passed, 27 skipped, all wave64 tests needing a 64-wide subgroup) LEONIDA_W64_EMULATE=1: 97/97 passed (mainhere: 91/91)python -m unittest discover -s tests/semantic: Ran 977 tests in 201.525s OK
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.
tools/rdna2spirv.pyraisesUnsupportedonv_mqsad_u32_u8. It's the last of the GFX10 SAD family, afterv_sad*/v_msad_u8(#544) andv_qsad_pk_u16_u8/v_mqsad_pk_u16_u8(#623). It isn't in the translated corpus, so this is future-proofing. Claimed in #374.Change
tools/rdna2spirv.pyfollows the RDNA ISA pseudocode. S0 is 64 bits, S1 is 32 bits, and S2 and D are 128 bits (four VGPRs):D[k] = S2[k] + v_msad_u8(S0[8k+31 : 8k], S1), wrapping at 32 bits.v_qsad_pk_u16_u8, but each result is a whole dword with its own 32-bit accumulator. A byte where S1's byte is 0 adds nothing.clampraisesUnsupportedinstead of being guessed.v_sad*block, so it doesn't overlap Translator: v_qsad_pk_u16_u8 and v_mqsad_pk_u16_u8 #623, which goes before it.tests/test_translate.pyandtests/test_f16_op_sel.pyusedv_mqsad_u32_u8as their example of an unsupported instruction. They now usev_sat_pk_u8_i16, which exists on GFX10 and stays unsupported.tests/semantic/test_alu_mqsad_u32.py(new, stdlibunittest) checks D against a plain-Python reference:clamprejectedexpas eight 16-bit halves ORed into0x40000000, so no export channel can be a NaN patternTested
python -I -m unittest discover -s tests/semantic: all pass. Without the translator change, the new file has 51 errors (Unsupported).tests/test_f16_op_sel.py: 34/34 through a local stand-in forpytest, because I can't install pytest here.tests/test_translate.pyneedsllvm-mc, so CI runs it.python -m compileall -q tools testspasses. Not run on a GPU, and no game files used.AI-assisted (Claude Code): it wrote the change and the tests, and ran the checks listed above.