shader: lower DPP16 row_shl, row_shr and row_ror in direct compute #3010
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3010"
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-27T04:55:37Z.
Fixes #3008. Part of #2935. Target branch
main.Change (
src/gfx1013_compute_native.cpp,src/gfx1013_direct_compute.inl): direct compute lowered DPP16quad_permand the two mirrors only. It now also lowersrow_shl:N,row_shr:Nandrow_ror:Nfor N = 1..15 (0x101..0x10f,0x111..0x11f,0x121..0x12f), with full row and bank masks.row_shl:Nreadsr + N,row_shr:Nreadsr - N,row_ror:Nreads(r - N) mod 16. A row never crosses a physical wave32, so a split guest wave64 needs no exchange.lower_dppused to apply that rule only when FI was clear. It now also covers an out-of-row source with FI set, which the measuredrow_shr:1form uses.quad_permand the mirrors keep their behavior, since their source is always in range.row_share,row_xmask, the pre-GFX10 controls (0x130..0x13c,0x142,0x143) and partial masks.native_dpp_quad_check.pyusedrow_shl:1as its unsupported-control case. It now usesrow_share:0.Tests. The setup was Windows 11 with an NVIDIA GeForce RTX 5080 and DXC from the Windows SDK 10.0.26100, on
cpp-migration999e17cdplus this commit.native_dpp_row_hardwarepassed. 16 programs ran in two 64-thread groups, with guest lanes 1 and 8 of each wave32 inactive, and all 2,064 output words matched a CPU reference, sentinels included. The programs are:v_mov_b32_dppwithrow_shl,row_shrandrow_rorby 1 and 15, each with and without BOUND_CTRL;v_mov_b32_dpp row_shr:1with FI and BOUND_CTRL;v_add_nc_u32_dpp row_shr:1with FI, andv_add_f32_dpp/v_min_f32_dpp row_ror:8with BOUND_CTRL.native_dpp_row_controlspassed. One valid shift compiles, and four controls are refused:row_share:0, control0x142, row mask0x7and a 24-thread group.native_dpp*,native_lane*,native_wave*andnative_readlane*tests pass.Mutation checks, run by hand; each fails the hardware check:
row_ror:8is its own inverse);Measured on a local capture (counts and instruction shape only) with
compile_dxil --jobs 8 gfx1013-direct-cs@36 --requests.row_ror:8, 18 withrow_shr:1.v_permlane16_b32/v_permlanex16_b32and 25 at "SDWA or DPP vector operands". So this mostly removes the first blocker in front of those requests; it completes one by itself.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by KelboLive on 2026-11-27T05:16:49Z.
Review: COMMENTED
PR #3010 by @Leyukaka — shader: lower DPP16 row_shl, row_shr and row_ror in direct compute
What works
Issues
Recommendations
Overall
Solid extension to the direct compute DPP support. The DppRow struct is clean, the source-usability tracking follows the existing lower_dpp pattern, and the mutation checks give confidence. The key item to verify before merge is the ror wrapping behavior in the IR generation.
Imported from R0Y00/Xbox2Windows. Originally posted by KelboLive on 2026-11-27T05:32:45Z.
Review: COMMENTED
PR #3010 by @Leyukaka -- shader: lower DPP16 row_shl, row_shr and row_ror in direct compute
What works
Issues
shl ? "sub" : "add"in the row op case, which seems inverted -- for row_shl we want source = lane + amount (add), and for row_shr we want source = lane - amount (sub). The current code usesshl ? "add" : "sub"but the comment saysshltoggles between them. Verify this is correct: row_shl reads from r+N (add), row_shr reads from r-N (sub), row_ror reads from (r-N)%16 (sub with wrap)row_rorcase uses the samepeerformula with sub, but doesn't handle the modulo explicitly -- the%is implicit in the unsigned ring buffer layout, but a comment clarifying this would help future maintainersRecommendations
Overall
A well-scoped, well-tested addition. The row shift/rotate lowering follows the same patterns as the existing quad_perm path. No blocking issues.
Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-27T11:47:36Z.
Second-site hardware result for this PR at
7325dd17(base999e17cdoncpp-migration). No game files involved.Environment (the Windows test PC): RTX 4070 Ti, driver 621.35, Windows 11 25H2 (build 26200), MSVC 19.44,
cmake --preset dev. Configure and build exit 0.ctest --preset dev --no-tests=error -j 1 -R dpp -E "startup_audio_output|startup_audio_pacing|startup_audio_provider", run twice: 29 of 29 passed both times, exit 0, no skips. This includes the PR's ownnative_dpp_row_controlsandnative_dpp_row_hardware(about 5 s on hardware), plusnative_dpp_quad_*,native_dpp_mirror_hardwareand thecompute_store_aot_dpp_row_shr_*pair.-R "^native_"regression check: 74 tests, 70 passed, 3 WARP-only skips (exit 77), 1 failure:native_cvt_pk_u8_hardware, which is not touched by this PR. It also fails oncpp-migrationatf6cdee10and the current tip, so it is not caused by the DPP16 change.AI-Assisted
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-27T12:11:29Z.
Review: APPROVED
Reviewed
7325dd17after retargeting tomain, with #3053 applied (tested tree91cc13b3).ctest --preset <dev|release> --no-tests=error -V -R '^(native_dpp_.*|native_sdwa_f16_.*|native_bitscan_(controls|hardware))$'gave 9/9 passes in each preset. The 16 native programs matched 128 output words each and their guards on RTX, including sparse EXEC, FI, out-of-row BOUND_CTRL and wrapping rotates. The prior quad and mirror fixtures still pass. Bothcompute_store_aot_dpp_row_shr_(warp|hardware)entries also passed in both presets and rejected their deliberate cross-row and zero controls. Windows 11 26200.9974, SDK 10.0.26100, RTX 4060 Laptop driver 32.0.16.1656 and WARP 10.0.26100.9818. Native compute replay runs without the debug layer. The offscreen and AOT results had zero debug errors/warnings. Hosted Windows, Linux Python and gfx1013 passed.