shader: lower DPP16 quad_perm in the direct C++ compute path #2937
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2937"
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-26T22:18:06Z.
Fixes #2936 (it needs closing by hand, since the base is not the default branch). Part of #2935. Target branch
cpp-migration.Change:
src/gfx1013_compute_native.cpp: the DPP16 decoder accepted pattern values 0-255 (quad_perm) only for graphics. Compute now accepts them as well. Patterns above 255 that are not row mirrors stay refused ("unsupported DPP lane selection").src/gfx1013_direct_compute.inl:mirror()becomeslower_dpp()and handles both forms.quad_perm, the source is read withwaveReadLaneAtfrom lane(lane & ~3) | ((pattern >> 2 * (lane & 3)) & 3).bound_ctrl, keeps the old destination otherwise, and is read anyway under fetch-inactive;tests/native_dpp_quad_check.py,tests/cmake/native_dpp_quad.cmake,docs/experiments/native-dpp-quad-compute.mdand adocs/experiments.mdentry.Tests. The setup was Windows 11 with an NVIDIA GeForce RTX 5080 and DXC from the Windows SDK 10.0.26100, on
e97c5c7cplus this commit.native_dpp_quad_hardwarepassed. It covers 8 source-built compute programs, two groups of 32 lanes each, with guard words checked, against an independent CPU model of lanes, EXEC and the DPP rules:v_or_b32andv_add_f32withquad_perm:[1,0,3,2];v_subrev_f32with[0,0,0,0];[0,1,2,3];[1,2,3,0];bound_ctrl, under the default (keep the old value) and under fetch-inactive.native_dpp_quad_controlspassed.[1,0,3,2]compiles, whilerow_shl:1and a 30-thread group are refused with their messages.native_dpp_mirror_hardwarestill passes.Mutation checks, run by hand; each fails the hardware test:
or swap;bound_ctrl: the "disabled source, zero" case fails.Measured on a local capture of 2,689 compute requests, with
compile_dxil --jobs 8 gfx1013-direct-cs@36 --requests(counts and instruction shape only). The request reader was locally patched to main's28csrevision, which is tracked in #2933.row_ror:8,row_shr:1), which stays refused: 43 at the same instruction as before, and 37 after getting past an earlierquad_perm.v_readlane_b32withvcc_loas its destination ("invalid scalar lane read destination"), so the compiled total is unchanged at 243.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-26T22:40:09Z.
Review: APPROVED
Review of head
1053cd71, tested merged ontocpp-migration7beb331d(after #2939). It merges cleanly. Approving and merging.Code:
lower_dpp()computes the source lane as(lane & ~3) | ((pattern >> 2*(lane & 3)) & 3).i.dpp_controlhaving a value, soquad_perm:[0,0,0,0](pattern 0) still takes the DPP path.Run on AMD, which these tests had not seen before: Windows 11 26300.9974, AMD Radeon RX 9070 XT (driver 32.0.32029.2010), release, debug layer off.
ctest --preset release --no-tests=error -R '^native_'gives 34 tests, 33 passed and 1 skipped (77,native_comparison_pso_warp), includingnative_dpp_quad_hardware,native_dpp_quad_controlsandnative_dpp_mirror_hardware.Mutation: I made the source lane read the permutation in reversed lane order (
quad_lane ^ 3) and rebuilt.native_dpp_quad_hardwarefails with a lane mismatch, and the mirror and control tests still pass. After restoring and rebuilding, everything passes again.Nit, not blocking:
docs/experiments.mdgains a 6-line pointer section right under the line saying new notes go indocs/experiments/<topic>.md. The topic file alone would follow that convention and avoid edit conflicts at the top of the file.docs_links_checkpasses (33 files, 548 links).I will close #2936 by hand after the merge, since the base is not the default branch.
AI-assisted; the commands above were run locally.
Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-26T22:48:43Z.
Post-merge receipt on
1053cd717e(the head this was merged from): a per-case mutation map for the eightquad_permcases, and a negative control on the decoder line. Not a code change; measurements only.Environment
10.0.26200.9974, MSVCcl19.44.35230 with BuildTools 14.44.35207, DXC 1.9.2602.17 from SDK 10.0.26100.01002device7550, driver32.0.32029.2010dev, debug layer not installed, so there is no validation output1053cd717efcfb69f60d1f5902511be0c2fce732,git status --porcelain --untracked-files=noempty,src/gfx1013_direct_compute.inlsha256a77267b2e0597abbe88d494eaba3bbcd20b2bf23c88e6073bbc6c4d943a30be6(CRLF worktree copy; the LF blob of the same revision is80ee9c65…)Which adapter these entries actually use
tests/native_store_replay.cpp:45creates its device withD3D12CreateDevice(nullptr, D3D_FEATURE_LEVEL_12_0, …)and prints no adapter line, so "on hardware" is otherwise unobservable for this fixture. A throwaway probe (not part of the repo;ID3D12Device::GetAdapterLuid()matched against anIDXGIFactory6enumeration) says which adapter the null argument resolves to on this machine:The null-adapter path is the card (
flags=0000), not the software adapter (flags=0002,Microsoft Basic Render Driver). That is a statement about this run on this machine, not a guarantee aboutnullptrelsewhere.Commands
Observed
native_dpp_quad_controls: passed, 0.57 s —unsupported DPP lane selection,DPP quad_perm needs a thread count divisible by four, plus the accepted0xB1program.native_dpp_quad_hardware: passed, 1.81 s, eight replay invocations (0 32 7 4 1is the replay's binding dump: root parameter, byte offset, view kind, stride, write), eight readbacks of 2,064 words each (8 guard + 64 results + 1,992 guard):native_dpp_mirror_hardware(non-regression for the DPP16 entry that mirror andquad_permnow share): passed, 4.59 s, includingPS unsigned min/max, two 32-lane halves and final wave64 reduction matched [3,39,1,255].Mutation map
Four mutants of
lower_dpp, each rebuilt, run, then restored byte-for-byte (file sha256 back toa77267b2…,git statusempty, same run green again at 8/8). The first case that fails:quad_base = lane & ~3→laneor swapadd disabled source, zeroadd disabled source, preserveadd disabled source, fetchThe four mutants pass 0, 5, 6 and 7 cases before dying, so each fails first in a different case. The runner stops at the first failure, so a mutant that breaks more than one case only reports the earliest (the EXEC mutant fails
zerofirst; whether it would also failpreserveis not measured here), and no mutant targets the bound-zero branch on its own. The map shows each case is armed; it does not show the branches are disjoint.Negative control on the decoder line
src/gfx1013_compute_native.cpp:326reverted to the base expressionif (!i.mirror_mask() && (pattern > 255 || !graphics))makes both entries fail: controls stops on the first case withnative compute +0x2c: unsupported DPP lane selection, and the hardware fixture returns 1 on its first replay. After restoring the line, controls return 0 and hardware returns 8/8.Both entries depend on the added gate: with the base line the direct-compute path refuses every non-mirror pattern, and
unsupported DPP lane selectionis printed only by that refuse (:327). The four mutants above are what show the comparison is not vacuous.What runs where (receipt, not a complaint)
GET /commits/1053cd717e/check-runsreturnstotal_count: 0and/statusreturns no statuses: no CI ran on this head. The workflow triggers arepush,pull_requestandworkflow_dispatch, withbranches: [main]on the first two, while this PR's base iscpp-migration; theprtest preset's include regex names nonative_dpp*entry; and theprbuild preset's target list builds neithercompile_dxilnornative_store_replay. After a future merge intomain, the push sweep runsnative_dpp_quad_controlsand excludesnative_dpp_quad_hardwarethrough-E '_hardware$'(windows.yml:494,:614). Both entries stay hand-run on pull requests until the filter, and the two targets, are added there.Limits
devpreset only; no debug layer, so nothing here validates API use.Dispatch(2,1,1), and the same seven-word user block in all eight cases (0, 0, 0, threads | 1 << 16, 1, 0, 0x8A); what varies is the DPP control word and EXEC.AI-assisted.