Repository navigation
startup: lower s_cselect_b32 into vcc_lo and exec_lo in gfx2hlsl - #2121
Merged
Merged
Conversation
In wave32, vcc_lo and exec_lo hold the whole lane mask, and the generic scalar path already writes them as vcc and exec. The select path assumed an SGPR destination, so s_cselect_b32 vcc_lo, -1, 0 stopped the translation with a TypeError. It now writes the lane's bit of the selected word to vcc or exec (an exec_lo write clears exec_known), keeps the SGPR and m0 destinations as before, and refuses any other destination with an Unsupported message. tests/startup_gfx2hlsl_cselect_mask_check.py decodes synthetic SOP2 words and evaluates the emitted select for both SCC values, with an unreduced select as the negative control. On the translator before this change it fails with the TypeError. Test: ctest --preset dev --no-tests=error -R '^startup_gfx2hlsl_cselect_mask_controls$' -V
Owner
This was referenced Nov 26, 2026
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.
Part of #1723
In wave32,
vcc_loandexec_lohold the whole lane mask, and the generic scalar path intools/startup/gfx2hlsl.pyalready writes them asvccandexec.s_cselect_b32goes through a separate select path that assumed an SGPR destination, sos_cselect_b32 vcc_lo, -1, 0stopped the translation with aTypeErrorinstead of a lowering or anUnsupportedrefusal.Now:
vcc_loandexec_loget the lane's bit of the selected word; anexec_lowrite clearsexec_known.m0destinations are lowered as before.Unsupportedmessage.New test
tests/startup_gfx2hlsl_cselect_mask_check.py, registered asstartup_gfx2hlsl_cselect_mask_controlsinCMakeLists.txt,AGENTS.mdand the Python job, and described indocs/experiments.md. It decodes synthetic SOP2 words and evaluates the emitted select for both SCC values with the restricted evaluator ofstartup_gfx2hlsl_bit_alu_check.py. Negative control: the select with its& 1removed gives a differentvcc.Verification (branch head
3dc861e2onmain246a875d, Windows 11 Pro 10.0.26300, Python 3.13):python -B tests/startup_gfx2hlsl_cselect_mask_check.py-> exit 0 (cselect mask: vcc_lo and exec_lo are the lane mask; SGPR and m0 unchanged; null refused). Onmainthe same test fails withTypeError: 'NoneType' object is not subscriptable.tests/startup_gfx2hlsl_*_check.py,tests/startup_translator_check.py,tests/docs_links_check.pyandtests/startup_tools_lint_check.py tools/startup-> 33 scripts, all exit 0.git diff --check main..HEAD-> clean.AI-assisted.