gfx2hlsl: lower compute image_gather4_lz_o with signed 6-bit NSA offsets #3886
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!3886
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3884"
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?
@Holastor on GitHub · 2026-12-02 19:28 UTC · original
Holastor:dxil/compute-image-ops→main· +277 −9 · 4 files · 3 commits · merged 2026-12-02 21:01 UTCSummary
Adds
op_image_gather4_lz_oto the Python compute translator (tools/startup/gfx2hlsl.py) to unblock the highest-weight compute image refusal class (image_gather4_lz_oacross 2D shadow/sampling compute shaders).tools/startup/gfx2hlsl.py): Extendsgather_2d_setupwithnsa=Trueto parse bracketed[vOFF, vU, vV]operands (verifying single distinct VGPRs per entry), unpacks the two signed 6-bit offsetssx = asint(vOFF << 26) >> 26andsy = asint(vOFF << 18) >> 26matching the native C++ lowering (src/gfx1013_direct_compute.inl), and emitstex.Gather{Red,Green,Blue,Alpha}(smp, float2(u, v), int2(sx, sy))forcs_6_0.raw_code[pc]) to refuse unprintedLWE,R128,TFE,A16/D16, and bit-14 flags alongsideunorm/d16modifiers, non-NSA addresses, non-one-hotdmask, non-2D dimensions, duplicate address registers, and unsupported gather samplers.tests/startup_compute_gather_lz_offset_check.py,CMakeLists.txt,.github/workflows/windows.yml): Covers all four one-hot channels, boundary offsets (31,-32), overlappingdst/address registers,image_gather4_lzregression, refusal controls, real DXC compilation (--compile), GPU dispatch (--dispatchwithdropped_offsetmutation control), and--cachedry-run.Verification
python -B tests/startup_compute_gather_lz_offset_check.py(controls,--llvm-mc,--compile, and--dispatchGPU verification — pass; reverting the raw MIMG bit guard fails the negative control)python -B tests/startup_compute_gather_lz_check.py— passpython -B tests/startup_gfx2hlsl_compute_check.py— passpython -B tests/docs_links_check.py,tests/bidi_controls_check.py,tests/script_state_check.py, andtests/form_coverage_check.py— pass@R0Y00 on GitHub · 2026-12-02 20:26 UTC · original · reviewed
I checked the two failing jobs on
b30c04a3. The Python job hit the sharedstandin_exports: d3d12_xs entries 84 != 83mismatch corrected by #3887. The LLVM 15 job also has an independent failure:tests/startup_compute_gather_lz_offset_check.py --llvm-mc llvm-mc-15asserts on the Red instruction byte sequence. Please refresh from main and reproduce that command with LLVM 15 so we can preserve the machine-code control while making it portable.81f677d487' into HEAD 662eb444c7@R0Y00 on GitHub · 2026-12-02 20:53 UTC · original · approved these changes
Reviewed
84e61a59. The LLVM 15 failure was an instruction order mismatch at +0x38: the pinned bytes wait for LGKM before writing v6, while the source string wrote v6 before the wait. The follow-up aligns the source with the pinned bytes; the lowering is unchanged. LLVM 15 now reassembles the fixture exactly, the existing flag refusals pass, and DXC compiles the translated cs_6_0 shaders. With the debug layer enabled on Windows 11 build 26300, WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656 each passed all 32 two-mip/channel/offset cases; dropping the offset gave four mismatches. A separate source-built four-thread fixture derived the offset from the lane and wrote each lane's four words to its own output slot. It matched all 320 words on each adapter, and forcing a zero offset caused 12 mismatches on each.