shader: lower s_absdiff_i32 in the direct compute path #3055
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!3055
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3055"
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?
@pigalot on GitHub · 2026-11-27 12:28 UTC · original
pigalot:shader/direct-absdiff→main· +251 −1 · 4 files · 1 commits · merged 2026-11-27 13:06 UTCFixes #3054 (part of #2935, instruction coverage).
Change
The direct compute frontend (
src/gfx1013_direct_compute.inl) used to refuses_absdiff_i32withdirect DXIL lowering for s_absdiff_i32. It now lowers it as the RDNA 2 ISA states:gfx2hlsl.py(asuint(abs(asint({0} - {1}))), SCC$ != 0),tools/pixel_aot.pyand the HLSL path insrc/gfx1013_compute_native.cpp.The lowering is a
sub, then a select between the difference and its negation, on a signed compare with 0.Verification
main232ae71eplus this change (127d40bb). The checks were run at1ec2c938; the only commit in between (#3029) changesgfx2hlsl.py. Windows 11 Pro 10.0.26200, NVIDIA GeForce RTX 5090 (driver 32.0.16.1088), dev preset with the debug layer on.native_absdiff_controlscompiled; the unwrapped, unsigned, saturated, signed-difference and SCC-unchanged references each differnative_absdiff_hardwares_absdiff_i32: 1024 words of two groups and the guards matchedmainsource)native compute +0x34: direct DXIL lowering for s_absdiff_i32(10, '0xfffffffe', '0x2'), the (3, 5) case(13, '0x0', '0x1'),(19, '0x1', '0x0'), …ctest -R '^native_|compute_dispatch_native' -E '_hardware$' -j 8_warptests that skippedctest -R '^native_.*_hardware$' -j 1native_cvt_pk_u8_hardwarefails as reported in #3052, without this change tootests/docs_links_check.py,tests/bidi_controls_check.pyEvidence
tests/native_absdiff_check.py(tests/cmake/native_absdiff.cmake), with notes indocs/experiments/native-direct-absdiff.md. It is original and uses no external inputs.scalar,sop1,vop2,vmove). Every word was checked withtools/disasm_rdna2.py --hex.s24 = group * 0x01000193. Six register pairs are XORed withs24at run time:s_cselect_b32).compile_dxil --refusals(counts only) on 2,689 compute requests.1ec2c938, 7 stop first ats_absdiff_i32and 399 compile.direct descriptor address outside bound table, 2 atdirect image opcode or descriptor modifiersand 1 atunbound numeric SGPR sN.Checklist
This change was AI-assisted.
@R0Y00 on GitHub · 2026-11-27 13:06 UTC · original
Independent review of
127d40bb0a4753437705aec1b6559b6d96bc6593integrated withmainfca7c35b(tree5d44259c96bcf314822e4d1fcb6ed0249785e798). The signed comparison follows the wrapped i32 subtraction, and the shared SOP2 tail still writes SCC from the nonzero result. The fixture reads SCC as well as the result and includes equal inputs after a prior SCC of 1, edge wrapping, inline and literal forms.Built
compile_dxil native_store_replayand ranctest --test-dir <build> --no-tests=error -V -R '^native_(absdiff|perm_lerp|align_bfm)_'. Debug and Release/O2each passed 6/6 with zero skips. The new RTX replay matched all 1,024 output words and guards; the mutant references differed as intended. Windows 11 26200.9974, RTX 4060 Laptop driver 32.0.16.1656, SDK DXC 10.0.26100; replay debug layer off. No WARP test is registered for this wave32 fixture. Hosted Windows Debug and both Linux jobs passed, and the pull-request workflow skips its hosted/O2job.