shader: lower s_abs_i32 in gfx2hlsl (Part of #1723) #2640
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!2640
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2640/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?
@SimSalabimse on GitHub · 2026-11-26 00:07 UTC · original
SimSalabimse:cursor/gfx2hlsl-s-abs-i32-5a9e→main· +313 −0 · 6 files · 5 commits · merged 2026-11-26 00:25 UTCChange
Part of #1723: port
s_abs_i32frompixel_aotintotools/startup/gfx2hlsl.py.D = asint(S0) < 0 ? (0u - S0) : S0(INT_MIN stays)SCC = (D != 0)Claim before coding. Base is
main.AI-assisted.
Verification
Commit under test: this PR head (includes
sopk_accummutant-needle pin so the plain-scalar allow-list line is not required to be unique).All passed on Linux (CPU evaluation of the translated text). Windows WARP/hardware draws were not run here; the fixture is device-free.
Windows verification:
Evidence and follow-up
disasm_rdna2/gfx2hlsl.decode; no retail bytes.Checklist
Wire startup_gfx2hlsl_s_abs_dispatch_{warp,hardware} to the new UAV-readback mode so Windows CI and Sander can run the fixture. Co-authored-by: SimSalabimse <[email protected]>@tedin7 on GitHub · 2026-11-26 00:11 UTC · original · reviewed
Review of head
48236d4dagainst current main (comment only).Checked:
op_s_abs_i32(tools/startup/gfx2hlsl.py:5507):D = asint(S0) < 0 ? 0u - S0 : S0,SCC = D != 0, INT_MIN stays, constant folding wraps to 32 bits, lane masks and descriptor-bearing SGPRs refused. The semantics match the RDNA 2 SOP1 definition and the existing pixel_aot lowering. I found no logic bug.s_abs_i32in other paths (#574 pixel_aot, #1956 compute); this one adds the gfx2hlsl path. The siblings_absdiff_i32table entry is untouched and is a different opcode.windows.ymlPython check list, AGENTS.md, docs/experiments.md, and thesopk_accumneedle pin.Commands run (Linux, clean worktree on the head):
python3 -B tests/startup_gfx2hlsl_s_abs_check.py-> all okpython3 -B tests/startup_gfx2hlsl_sopk_accum_check.py-> PASSpython3 tests/docs_links_check.py-> 19 files, 507 links okpython3 tests/bidi_controls_check.py-> no bidirectional controlsgit diff --check origin/main...HEAD-> cleanWhat is missing before this can merge:
asint/0u - xcompile and behave on the device.win2025=None); the PR body says WARP was not run. A Windows dev + release run is needed once item 1 exists.I am not merging this. Once the WARP readback test is added and Windows passes, it looks ready.
AI-assisted; commands listed were executed locally.
@SimSalabimse on GitHub · 2026-11-26 00:21 UTC · original · edited 2026-11-26 01:33 UTC
Addressing review @tedin7 — added the D3D12 WARP GPU readback.
What landed (
6afdbd92+ CMake follow-up oncursor/gfx2hlsl-s-abs-i32-5a9e)tests/startup_gfx2hlsl_s_abs_check.pynow has adispatchmode mirroring #2639 /pack_absdiff(offscreen_check --raw-uav-dump).0x80000000), -1, 0, positive0x12345678.D,SCCasuint, and an SCC-dependentif (scc)branch token so the nonzero test is exercised on the device, not only as a stored bool.startup_gfx2hlsl_s_abs_dispatch_{warp,hardware}.Linux CPU path re-run green. WARP dispatch was not run here.
Windows verification:
AI-assisted.
@SimSalabimse on GitHub · 2026-11-26 00:47 UTC · original
Host Windows retest on this PR head:
Passed:
startup_gfx2hlsl_s_abs,startup_gfx2hlsl_s_abs_dispatch_warp,startup_gfx2hlsl_s_abs_dispatch_hardware(3/3).