shader: lower s_ff0_i32_b32 in gfx2hlsl (#1723) #2666
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2674"
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?
Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-26T01:44:16Z.
Change
Part of #1723: port
s_ff0_i32_b32frompixel_aotintotools/startup/gfx2hlsl.py.D = firstbitlow(~S0)(0xffffffff when every bit of S0 is set)Claim before coding. Base is
main.AI-assisted.
Verification
Commit under test: this PR head.
All passed on Linux (CPU evaluation of the translated text). Windows WARP/hardware draws were not run here; the fixture is device-free.
Windows (when available):
Evidence and follow-up
disasm_rdna2/gfx2hlsl.decode; no retail bytes.~complement diverges from the ISA reference.Checklist
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T02:56:37Z.
Review: COMMENTED
Review of head
5595ec77(s_ff0_i32_b32in gfx2hlsl, Part of #1723).Result: no blocking findings.
What I checked
D = firstbitlow(~S0),0xffffffffwhen every bit is set, SCC untouched. Same shape as the mergeds_ff1_i32_b32handler (lane masks refused, constants folded, descriptor-bearing SGPRs refused). Inline float constants fall through to the register check and are refused.s_ff0_i32_b64/s_ff1_i32_b64are not lowered on main either, so nothing is left inconsistent. No other open or merged PR lowerss_ff0(searcheds_ff0; #2072 covers other 64-bit scan ops).CMakeLists.txt,windows.ymlandAGENTS.md; the scalar-table arity check was adjusted for the new own-arity template.~makes the new check fail; removing the- 1in the constant fold makes it fail.s_ff0_i32_b32 s10, s9, converted to float and exported) built with this PR's translator, drawn on D3D12 WARP for the inputs0xffffffff, 0xfffffffe, 0, 0x80000000, 0x7fffffff, 0x55555555, 0x12345678, 1: all 8 read back equal to the CPU reference, and a reference with one wrong word fails each time. The PR's own fixture is device-free, so this is extra evidence (the PR body says Windows draws were not run).Commands run (Linux, worktree at the PR head)
python3 -B tests/startup_gfx2hlsl_s_ff0_check.py,..._handler_arity_check.py,..._scalar_table_arity_check.py,tests/docs_links_check.py,tests/bidi_controls_check.py: all passgit diff --check origin/main...HEAD: cleanWin2025 (Build 26100, MSVC 14.44, D3D12 WARP) at
5595ec77:x2w_pipe.py win2025 2674 --wait 7200 --keep-release: PASS (debug and release builds and the Windows Python checks of the pipeline's default set). The newstartup_gfx2hlsl_s_ff0CTest itself is a Python check registered in CMake; it passes on Linux as above.Note: the PR is 23 commits behind main and touches
.github/workflows/windows.yml(one list entry); its own CI run exercises that line. I did not update the branch. Merge left to the maintainers.AI-assisted; commands listed were executed locally.