shader: lower s_abs_i32 in gfx2hlsl (Part of #1723) #2632
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2640"
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-26T00:07:18Z.
Change
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
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T00:11:30Z.
Review: COMMENTED
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.
Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-26T00:21:51Z.
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.
Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-26T00:47:43Z.
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).