Skip to content

Translator: s_sext_i32_i8, s_sext_i32_i16, s_flbit_i32 - #549

Merged
ItsNotRexed merged 3 commits into
ItsNotRexed:mainfrom
LouisRiverstone:salu-sext-flbit
Nov 22, 2026
Merged

ItsNotRexed merged 3 commits into
ItsNotRexed:mainfrom
LouisRiverstone:salu-sext-flbit

Conversation

@LouisRiverstone

Copy link
Copy Markdown
Contributor

tools/rdna2spirv.py raises Unsupported on s_sext_i32_i8, s_sext_i32_i16 and s_flbit_i32. They aren't in the translated corpus, so this is future-proofing. Claimed in #374.

Change

  • tools/rdna2spirv.py:
    • s_sext_i32_i8 and s_sext_i32_i16 sign-extend the low byte or low half of S0 to 32 bits (OpBitFieldSExtract).
    • s_flbit_i32 is the scalar form of v_ffbh_i32 and goes through the same code. It counts the bits from the MSB down to the first one that differs from the sign bit, and gives −1 for 0 and −1.
    • None of the three writes SCC.
  • tests/semantic/test_salu_sext_flbit.py (new, stdlib unittest) checks against a plain-Python reference:

Tested

  • python -I -m unittest discover -s tests/semantic: all pass. Without the translator change, the new file has 132 errors (Unsupported).
  • python -m compileall -q tools tests passes. 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.

All three raised Unsupported. s_sext_i32_i8/i16 sign-extend the low byte /
half (OpBitFieldSExtract); s_flbit_i32 is the scalar form of v_ffbh_i32 and
shares its code. None writes SCC.

tests/semantic/test_salu_sext_flbit.py checks all three against a
plain-Python reference, with SCC kept from 0 and 1.
LouisRiverstone and others added 2 commits November 21, 2026 22:02
cs_wqm_w32 (SHADER-34) and cs_w32_lane_wrap (SHADER-52) check 32-lane
EXEC/VCC masks and lane selects. On Mesa llvmpipe, whose compute
subgroups are 8 wide, they can't produce their words, and the
"GPU tests on llvmpipe" step in runtime.yml has failed on main since
91b36cf. Skip them where vk_compute_test reports a widest subgroup
below 32 lanes, the rule ps_bitmask_perm already uses, in check.py and
run_gpu_tests.py (which reuses check.py's helper). Devices with 32 or
more lanes still run and judge them.

AI-assisted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D7JEiKsTUaHQbCTdc4Eghy
(cherry picked from commit be46677)
@LouisRiverstone

Copy link
Copy Markdown
Contributor Author

CI note: main is red on linux-gpu-tools (cs_w32_lane_wrap / cs_wqm_w32 need 32 lanes, llvmpipe has 8), which made this PR red for a reason that is not its own. To get a green run I merged current main and cherry-picked @NRXM's fix from #555 (be46677, authorship kept; the two conflicts with main resolved by keeping both sides: cs_movrelsd_2 stays in WAVE32_DUMPS, and both new test classes stay in tests/test_run_gpu_tests.py). It is the same change as #555, so whichever lands first, the other merges cleanly or drops it. tests/test_run_gpu_tests.py, tests/test_shader_checks.py and tests/semantic pass.

@IAmNotSiob IAmNotSiob left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked against the ISA: s_sext_i32_i8/i16 is a BitFieldSExtract of 8/16 with no SCC write, and s_flbit_i32 shares v_ffbh_i32's lowering, which is right because it's the same op (-1 when no bit differs from the sign bit, no SCC write). Merged with current main, tests/semantic passes (786 tests). LGTM. AI-assisted review (Claude Code).

@ItsNotRexed
ItsNotRexed merged commit 81f0bab into ItsNotRexed:main Nov 22, 2026
9 checks passed
ItsNotRexed pushed a commit that referenced this pull request Nov 22, 2026
…ROC-20)

#544, #549 and #577 merged without a row in the contract table, which
AGENTS.md asks for. One row per group, each with the semantics (checked
against the RDNA2 ISA pseudocode), what is not handled (clamp on the SAD and
lerp ops) and how it was confirmed (the CPU tests added by the PR); none is
GPU-checked.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants