gfx2hlsl: a 32-bit integer scalar result ends the lane-mask tag of its register #2784
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!2784
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2784/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@tedin7 on GitHub · 2026-11-26 08:50 UTC · original
tedin7:x2w-mask-numeric-clear→main· +33 −0 · 2 files · 1 commits · closed without mergingPart of #1723
What this unblocks: a real pixel or compute program that reuses a scalar register for a number after it held a lane mask (for example a descriptor field extracted with
s_bfe_u32and then fed tos_max_u32) no longer stops ats_max_u32 reads lane mask sN as numeric data; the translator goes on to the next, genuine, refusal.Source: AMD "RDNA 2" Instruction Set Architecture reference guide, SOP2 instructions S_BFE_U32 and S_MAX_U32 (scalar results are plain 32-bit data) and the EXEC / VCC lane-mask definitions.
What changed (
tools/startup/gfx2hlsl.py,propagate_mask_tags):s_add/sub/addc/subb,s_mul/mulk/addk,s_mul_hi,s_min/max,s_lshl/lshr/ashr,s_bfe,s_bfm,s_absdiff) ends the lane-mask tag of its destination register. Before, those handlers left the old tag on the register, so the number was later refused as a mask.s_mov/and/or/xor/andn2/orn2/nand/nor/xnor/not/wqm,s_cselect_b64, saveexec) are untouched and keep tagging.s_cmpof a real mask, the high word of a wave64 mask.Tests (
tests/startup_gfx2hlsl_mask_overwrite_check.py): in the pixel and compute stages, each of seven numeric ops over a register that av_cmpmade a mask clears the tag and the followings_max_u32of the result translates; a real mask as the source ofs_max_u32is still refused. Turning the new branch off makes the check fail.Verification (Linux only):
python3 -B tests/startup_gfx2hlsl_mask_overwrite_check.py: PASS (fails with the new branch disabled)origin/mainhas in the same environmentpython3 -B tests/startup_gfx2hlsl_compute_check.py,startup_gfx2hlsl_readfirstlane_uniform_check.py,startup_compute_readfirstlane_check.py: PASSorigin/main: all unchangedWin2025 WARP dev+release: pending Stage-2.
AI-assisted; commands listed were executed locally.
@tedin7 on GitHub · 2026-11-26 09:33 UTC · original
@MasterDomino Ready for review: head
473429b53c92ec72f717c7616003fdb84b150471(CI green on this head).Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP), dev and release /O2, same regex on both:
The run lists
startup_gfx2hlsl_mask_overwrite_checkandstartup_gfx2hlsl_mask_overwrite_controlsamong the 54, plus the compute and readfirstlane checks.Independent review on this head: a mask used as a source of a numeric scalar op is still refused (same register as source and destination,
s_movcopies,s_and/or/xor/andn2results, wave32 and wave64 pair cases); the only program that changes from refused to translated is the intended one (a number written over a register that held a lane mask). The new check fails on main (28 checks) and passes on this head. 173 existing translation shapes are unchanged against main.Not covered by this PR and the same on main: a wave64 pair whose high word alone is overwritten with a number, and the result of
s_cselect_b32of a mask, are not tagged. A test for the copy and pair cases would pin the current behaviour; it is not needed for this change.AI-assisted; commands listed were executed locally.
@chatgpt-codex-connector[bot] on GitHub · 2026-11-26 09:33 UTC · original · edited 2026-11-26 09:38 UTC
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
473429bℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
@tedin7 on GitHub · 2026-11-26 10:12 UTC · original
Withdrawn: shader translation is moving to the native C++ frontend (see #870), so we are not continuing this change to the Python translator. The branch stays available if any part is useful later. Thank you to everyone who reviewed and tested it.
Pull request closed