Repository navigation
compute: lower s_or_saveexec_b32 in the direct wave32 path - #3193
Conversation
pigalot
left a comment
There was a problem hiding this comment.
I reviewed c9e32e20 over current main c45bf9ab. The trial merge conflicts in tests/native_direct_container_check.py: #3189 (995c1327) added its descriptor-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 (tree 7cf7bb3b, git diff --cached --check clean) and tested that. The branch still needs a rebase or a merge of main before it can land.
What I traced.
- Semantics: for
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). - SCC liveness after #3189: the PR adds
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. - Destination guard:
i.dst > 107refusesexec_loand the other special registers, while SGPRs andvccare accepted. - Wave64 and graphics: these keep their existing paths, because
or_saveexecrequirescompute && !wave64.
What I ran on the resolved merge:
-
dev: full build, thenctest --test-dir out/build/dev --no-tests=error -j 4 -R '^(native_direct_container|native_.*saveexec.*|native_wave_request.*|native_lane_access.*|native_permlane.*|native_dpp.*|native_scalar.*)$' -E '_hardware$' ctest --test-dir out/build/dev --no-tests=error -j 1 -R '^(native_or_saveexec|native_wave_request|native_lane_access|native_permlane.*|native_dpp.*)_hardware$'
3/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 dev and run against native_or_saveexec_hardware and native_direct_container (the unmutated baseline passes first):
| Mutant | Result |
|---|---|
| no OR lowering (negative control: main's behaviour) | killed (both tests) |
| OR → AND | killed (hardware) |
| EXEC-destination refusal removed | killed (container) |
D gets the new mask instead of the old EXEC |
killed (hardware) |
| SCC from the old EXEC | killed (hardware) |
| EXEC clamped to the 8-thread group | killed (hardware) |
transfer branch removed |
survives |
transfer keeps the old EXEC symbol (set(126, {}) dropped) |
survives |
transfer branch only for s_or_saveexec_b32 (main's s_and_saveexec_b32 handling) |
survives |
Restored and rebuilt afterwards; git diff --quiet is clean.
Findings.
- Rebase needed (above). Keeping both check blocks is the resolution I tested.
- The
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 c9e32e20 as 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 fixtures and Run platform-independent Python checks on Linux pass on c9e32e20 against its own base.
This reply was AI-assisted.
|
Review of |
D = old EXEC, EXEC = old EXEC | S0, SCC = (EXEC != 0), like s_and_saveexec_b32 with OR. As with s_mov_b32 exec_lo, EXEC keeps every bit, including bits past the group; a lane runs only if its own bit is set. An EXEC destination is refused. native_or_saveexec_hardware covers -1, an SGPR aliasing the destination, a literal, vcc_lo, an empty mask and a bit past the group, in 8- and 32-thread groups, with the saved EXEC, the new EXEC, SCC and a restore. AI-assisted.
c9e32e2 to
c8bf4dc
Compare
R0Y00
left a comment
There was a problem hiding this comment.
Reviewed c8bf4dc over main 2d6dad1 (integrated tree 974293e72afa1e48fa420ca8a37ed5610595e826). 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.
ctest --test-dir <build> --no-tests=error --output-on-failure -j 1 -R "^native_(direct_container|(or_saveexec|wave_request|lane_access|dpp8|packed_dot2_f16_compute)_hardware)$"
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.
pigalot
left a comment
There was a problem hiding this comment.
Retested c8bf4dcd merged over current main 24eb18b9. The merge is clean (tree 65eb0165) and git diff --cached --check is clean.
My comment review on c9e32e20.
- Rebase needed: addressed. The branch is rebased and the PR is mergeable. The PR's own diff,
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. - The
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:
ctest --test-dir out/build/<preset> --no-tests=error -j 1 -R '^(native_or_saveexec|native_and_saveexec|native_wave_request|native_lane_access|native_permlane.*|native_dpp.*)_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 on c9e32e20.
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 fixtures and Run platform-independent Python checks on Linux pass on c8bf4dcd.
This reply was AI-assisted.
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 shader: lower v_permlane16_b32 and v_permlanex16_b32 in direct compute #3022 handles. The compiled count does not change, and no request that compiled before stops compiling.AI-assisted.