compute: lower s_or_saveexec_b32 in the direct wave32 path #3193
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3193"
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 Leyukaka on 2026-11-27T21:12:51Z.
Fixes #3158. Part of #2935. Target branch
main.Change (
src/gfx1013_compute_native.cpp,src/gfx1013_direct_compute.inl): direct wave32 compute lowerss_or_saveexec_b32likes_and_saveexec_b32, with OR.s_mov_b32 exec_loands_or_saveexec_b64, EXEC is stored as computed, including bits past the group. A lane runs only if its own bit is set.transfernow marks EXEC numeric afters_and_saveexec_b32as well; before, that op went through the generic SOP1 branch, which cleared only its destination.Tests. The setup was Windows 11 build 26300.9974 with an NVIDIA GeForce RTX 5080 (driver 32.0.16.2101) and DXC from the Windows SDK 10.0.26100, on
main80668b97plus this commit.native_or_saveexec_hardware(new) runs in 8- and 32-thread groups, against a CPU reference. It covers these sources:-1;vcc_lo;It checks the saved EXEC, the new EXEC, SCC (primed to the opposite value) and a restore through
s_mov_b32 exec_lo.native_direct_containerchecks the EXEC-destination refusal and a descriptor-SCC case.native_wave_request_hardware,native_lane_access_hardware,native_permlane*andnative_dpp*pass.Mutation checks, run by hand:
native_or_saveexec_hardware;native_direct_container.Measured on a local capture (counts and instruction shape only) with
compile_dxil --jobs 8 gfx1013-direct-cs@36 --requestsonmain80668b97.v_permlanex16_b32, which #3022 handles. The compiled count does not change, and no request that compiled before stops compiling.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-27T22:00:39Z.
Review: COMMENTED
I reviewed
c9e32e20over currentmainc45bf9ab. The trial merge conflicts intests/native_direct_container_check.py: #3189 (995c1327) added itsdescriptor-sop1-*checks at the same spot as this PR's two new checks. The conflict is purely additive, so I resolved it locally by keeping both blocks (tree7cf7bb3b,git diff --cached --checkclean) and tested that. The branch still needs a rebase or a merge ofmainbefore it can land.What I traced.
s_or_saveexec_b32the lowering saves the old EXEC toDbefore writing, sets EXEC toold | S0, and sets SCC toEXEC != 0. That matches the RDNA SOP1 definition.ais read beforewrite(i.dst), so a source that aliases the destination sees the old value (thesgprcase).s_or_saveexec_b32to theoverwriteslist, next tos_and_saveexec_b32. That is right, because the op always writes SCC. #3189'spreserves_sop1list does not contain it, so the merged tree classifies it consistently.i.dst > 107refusesexec_loand the other special registers, while SGPRs andvccare accepted.or_saveexecrequirescompute && !wave64.What I ran on the resolved merge:
dev: full build, then3/3 CPU and 6/6 hardware tests pass (
native_or_saveexec,native_wave_request,native_dpp_mirror,native_dpp_quad,native_dpp_row,native_lane_access), with no skips.release/O2: builtcompile_dxilandnative_store_replay, then rannative_or_saveexec_hardwareandnative_direct_container. 2/2 pass.Mutants, each rebuilt in
devand run againstnative_or_saveexec_hardwareandnative_direct_container(the unmutated baseline passes first):Dgets the new mask instead of the old EXECtransferbranch removedtransferkeeps the old EXEC symbol (set(126, {})dropped)transferbranch only fors_or_saveexec_b32(main'ss_and_saveexec_b32handling)Restored and rebuilt afterwards;
git diff --quietis clean.Findings.
transferchange is not pinned (non-blocking). No test fails without it, for either op. That includes thes_and_saveexec_b32part, which changes behaviour beyond this PR's title: EXEC becomes numeric after it. I believe the change is correct, because the generic SOP1 branch left EXEC with its pre-op symbol. A case where the stale symbol is observable would pin it, or it could move to its own PR. One possible case, which I have not run: a constants_mov_b32 exec_lo, thens_or_saveexec_b32, then a consumer of EXEC's symbol.Verdict: comment. GitHub reports
c9e32e20as conflicting, so I'm not approving it. Apart from the rebase I found nothing blocking, and I'll retest and approve the rebased head.Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088; Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; DXC 1.9.2602.17; Python 3.12.10; wave32; debug layer off.
CI:
Build and test on Windows,Assemble and translate gfx1013 fixturesandRun platform-independent Python checks on Linuxpass onc9e32e20against its own base.This reply was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by KelboLive on 2026-11-27T23:53:28Z.
Review of
c9e32e20(integrated over main):Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-28T02:08:55Z.
Review: APPROVED
Reviewed
c8bf4dcd30over main2d6dad19(integrated tree974293e72a). The merge retains both sets of descriptor/SCC controls. The wave32 Compute path reads the source and old EXEC before writing the destination, preserves bits outside a short group, and derives SCC from the new mask. The EXEC-destination refusal remains covered, and the unchanged wave-size and lane-access cases passed.Debug 6/6 and Release /O2 6/6, zero skips. RTX 4060 Laptop GPU 32.0.16.1656, Windows 11 26200.9974, standalone replay without the debug layer. Hosted required Windows CI passed. The capture-census evidence tracks first refusals only; the fixture independently checks the result bits and side effects.
Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-28T02:39:23Z.
Review: APPROVED
Retested
c8bf4dcdmerged over currentmain24eb18b9. The merge is clean (tree65eb0165) andgit diff --cached --checkis clean.My comment review on
c9e32e20.c8bf4dcdagainst its merge base, is byte-identical toc9e32e20against its base. So the lowering, theoverwritesentry, the EXEC-destination guard and the tests are what I traced before. Thenative_direct_container_check.pychecks sit next to #3189'sdescriptor-sop1-*block, as in my local resolution.transferchange is still not pinned (non-blocking). No test fails without it, as before.What I ran.
Builds: full
devandrelease/O2.CPU, full suite:
ctest --test-dir out/build/dev --no-tests=error -j 8 -E '(startup_audio|_hardware$)'gives 1985 tests: 1934 pass, 0 fail, 51 capability skips.CPU,
release:native_direct_containerpasses.Hardware:
8/8 pass in each preset, with no skips:
native_or_saveexec,native_wave_request,native_lane_access,native_permlane,native_dpp8,native_dpp_mirror,native_dpp_quadandnative_dpp_row.The mutants from my earlier review were run on the same code and still apply.
Verdict: approve on
c8bf4dcd. This supersedes my comment review onc9e32e20.Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088; Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; DXC 1.9.2602.17; Python 3.12.10; wave32; debug layer off.
CI:
Build and test on Windows,Assemble and translate gfx1013 fixturesandRun platform-independent Python checks on Linuxpass onc8bf4dcd.This reply was AI-assisted.