shader: lower compute v_readlane_b32 #1851
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1858"
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 JustinDCosta on 2026-11-24T19:41:51Z.
Adds a bounded gfx1013 lowering for
v_readlane_b32 sD, vS, lane. It accepts statically known lanes from 0 through 31 in unguarded 1D groups, stages source words in group-shared memory, and selects within each logical wave32. Dynamic selectors,v_writelane_b32, incomplete larger waves, and unsupported layouts remain refused.The source-built fixture covers 32- and 64-thread groups, checks results against a CPU reference, and rejects identity-lane and wrong-lane mutants. It also adds parser controls, LLVM 15 round-trip coverage in the Ubuntu CI binary job, and reproduction documentation. The README wording for the earlier DPP fixture is corrected to match its logical-thread reference.
Validation on Windows, MSVC 19.51, DXC 10.0.26100:
offscreen_checkbuilds succeeded.compute_store_aot_readlane_(warp|hardware)CTests passed (2/2 each).git diff --checkpassed.Refs #1543
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T19:49:04Z.
Review: COMMENTED
Reviewed head
7c8963300b2d9fbeed476e8f66d7c4109a609746. No P1/P2 findings.Semantics (
tools/compute_store_aot.py):v_readlane_b32is accepted only when the lane selector resolves to a constant 0..31, the group is one-dimensional and unguarded, the source VGPR is a known word, and the destination SGPR is not pending or above 105. A group larger than 32 must be a multiple of 32 and statewave_size=32. A group of 32 or fewer must contain the selected lane. The lowering stages each logical thread's word in group-shared memory, callsGroupMemoryBarrierWithGroupSync(), and readsslot[(gindex & ~31u) + lane]. That resets the selected lane per logical wave and does not depend on the adapter's wave mapping. Slots are numbered per step, so several readlanes do not collide. Refusing lanes of 32 and above is stricter than the hardware's masking, which is safe.CMakeLists.txtonly adds a test, and the README and docs entries match the code. I saw no clean-room problem.Linux commands run in a clean worktree:
git diff --check origin/main...HEAD-> rc 0tests/docs_links_check.py-> rc 0 (18 files, 371 links)tests/bidi_controls_check.py-> rc 0tests/rdna2_tools_check.py-> rc 0tests/form_coverage_check.py-> rc 0tests/compute_store_check.py binary llvm-mc-19 llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM-19.so-> rc 0. This runsreadlane_controlsandreadlane_binary: assemble, disassemble, then identical lowering.tests/compute_store_check.pywith no mode argument exits rc 1 with a mode-unpacking ValueError. That is the unchangedmode, *args = sys.argv[1:]line, so it needs a mode.Mutations in
tools/compute_store_aot.py(each reverted withgit checkout -- .; the binary check was run each time):< 32changed to< 64-> FAILS (rc 1, expected rejection missing).slot[lane]instead ofslot[(gindex & ~31u) + lane]) -> FAILS (rc 1).wave_size != 32requirement dropped -> FAILS (rc 1).guard_span is not Nonedropped -> FAILS (rc 1), but through an unrelated "Unverified ALU operand" assertion. Treat this as weaker evidence for the guard refusal.Notes, not blocking:
draw-readlaneD3D12 cases (32 and 64 threads, plus the identity and wrong-lane mutants) need dxc and a D3D12 adapter, so they were not run on Linux. They need Win2025 before any merge.This is a review comment only, not an approval.
AI-assisted; commands listed were executed locally.