shader: lower s_bitset0/1_b32 in gfx2hlsl (#2023 Item J) #2630
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2638"
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:00:44Z.
Change
Part of #2023 Item J (
s_bitset1_b32, with the natural pairs_bitset0_b32) intools/startup/gfx2hlsl.py.Ordinary vertex/pixel pipelines that only need an in-place scalar bit set or clear were refusing at these SOP1 forms. The lowering matches
pixel_aot/ #1579:s_bitset0_b32:D = D & ~(1u << (S0 & 31))s_bitset1_b32:D = D | (1u << (S0 & 31))Claim before coding. Base is
mainate3dda42b.AI-assisted.
Verification
Commit under test: this PR head.
All passed on Linux (CPU evaluation of the translated text). Windows WARP/hardware draws were not run here; the fixture is device-free.
CTest filter once configured:
ctest --preset dev --no-tests=error -R '^startup_gfx2hlsl_s_bitset$' -V.Evidence and follow-up
disasm_rdna2/gfx2hlsl.decode; no retail bytes.s_bitset*_b64stays refused (out of Item J scope).Checklist
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T00:11:10Z.
Review: COMMENTED
Review of head
8b477af4(comment only, no approval and no merge).Duplicate slice (blocking the merge decision). #2420 (open, opened 2026-11-25 16:08Z) already lowers
s_bitset0_b32ands_bitset1_b32intools/startup/gfx2hlsl.pyfor #2023 Item J, with its own testtests/startup_gfx2hlsl_bitset_check.pyand the same CMake andwindows.ymlwiring. This PR covers the same two opcodes. Only one of them can land, and the two add different test file names, so both would also add duplicate test registrations. I leave the choice to @R0Y00. #2420 is currently CONFLICTING with main and this PR is MERGEABLE, which may matter for the decision.Code (tools/startup/gfx2hlsl.py,
scalar_bitset)D &= ~(1u << (S0 & 31))andD |= (1u << (S0 & 31)), SCC unchanged, D read before write.Test gap.
tests/startup_gfx2hlsl_s_bitset_check.pyevaluates the translated text on the CPU only. For a shader/math lowering we need a real D3D12 WARP GPU readback compared with a CPU reference. The PR states WARP was not run. Please add a WARP readback case (extend the existing WARP shader test suite) before this is merge-ready.Checks run locally (worktree on the PR head):
git diff --stat origin/main...HEAD, diff read fortools/,CMakeLists.txt,.github/,AGENTS.md, and a search for other PRs on the same opcodes (gh pr list --search s_bitset).AI-assisted; commands listed were executed locally.