Skip to content

Recompiler: split native wave32 compute groups beyond [32, 1, 1] - #2349

Open
saintwolf wants to merge 1 commit into
xcl-dev:mainfrom
saintwolf:dxil/split-wave32-groups
Open

saintwolf wants to merge 1 commit into
xcl-dev:mainfrom
saintwolf:dxil/split-wave32-groups

Conversation

@saintwolf

Copy link
Copy Markdown

Extends direct DXIL compute dispatch splitting beyond [32, 1, 1] to all full-wave native wave32 threadgroup shapes without guest LDS ([8, 4, 1], [4, 8, 1], [4, 4, 2], [8, 8, 1], [128, 1, 1], etc.), and removes redundant @xcl_wt / atomic / barrier setup on single-wave 2D/3D compute groups. Part of #1269, #2088.

What is in it

  • crates/xcl/src/gpu/dxil/lanes.rs: skip allocating @xcl_wt and emitting the wave-index atomic and barriers for single-wave 2D/3D native wave32 compute groups (y * z > 1 && total <= lanes, where tid == WaveGetLaneIndex()); skip the trailing barrier on multi-wave 2D/3D groups unless sharing xcl_lds[8191].
  • crates/xcl/src/gpu/dxil/kernel.rs: enable split_compute for all full-wave native wave32 groups without guest LDS (total >= 32 && total % 32 == 0), passing split_tid for multi-wave 2D/3D wave-ID prefixes.
  • crates/xcl/src/gpu/dxil/module/split.rs: size per-group scratch by total = threads[0] * threads[1] * threads[2], permit @xcl_wt only as the wave-ID prefix while gating the wave64 xcl_xs exchange state machine on has_xs (so guest barriers / shared-memory ops in native wave32 cleanly decline splitting), select FlattenedThreadIdInGroup() for multi-wave 1D groups, recompute Feature::WaveOps per piece so pieces without wave ops validate, and add unit + dxil.dll validation + GPU bit-exact parity tests (including slabbed dispatch_split_by) across [8, 4, 1], [4, 4, 2], [8, 8, 1], and [128, 1, 1].

Tested

  • Windows 11 (build 26300), NVIDIA GeForce RTX 4070 SUPER (driver 32.0.16.2140), AMD Ryzen 7 7800X3D, rustc 1.100.0 (0ef1bc386 2026-11-09), DXC/DXIL 1.8.2502.11.
  • .\scripts\test.ps1 (cargo test --workspace -- --test-threads=4, debug): 1274 passed, 0 failed, 46 ignored across 23 test binaries, including all 10 gpu::dxil::module::split tests (bit-exact whole vs split and slabbed GPU parity across [8, 4, 1], [4, 4, 2], [8, 8, 1], [128, 1, 1]).
  • SKIPPED GPU tests on this adapter (27 total): 21 no wave64, 3 per-lane form #1426 refusals (V_CVT_F16_F32, V_MUL_F16, V_PK_MUL_F16), 1 cannot disable the driver cache (Windows Developer Mode is required) (0x887A002D), 1 no xgameruntime.dll, 1 no heap windows.
  • Retail shader corpus validation (2,689 CS shaders, dxil.dll): 96 newly split native wave32 shaders ([8, 4, 1]: 86, [4, 8, 1]: 6, [4, 4, 2]: 2, [8, 8, 1]: 1, [128, 1, 1]: 1) produced 287 validated pieces with 0 validation errors (existing 806 [32, 1, 1] shaders / 7,906 pieces also validated with 0 errors).
  • Head-to-head cold NVIDIA CreateComputePipelineState A/B benchmark (main 06c9f55 vs this branch, release builds, 4 UMA windows, warm 2nd calls 1.33–8.52 ms) across the top 8 newly split native wave32 shaders:
    • Total cold wall time: 115.30 s → 37.73 s (3.06× faster, -67.3%); total CPU compile time: 115.30 s → 62.82 s (1.84× less, -45.5%).
    • Largest shaders: [4, 4, 2] (56ddc92162fbb20f, 8 pieces) 25.80 s → 1.86 s (13.9×); [8, 4, 1] (de83041b451429d1 / 0526ab24d5e0993b / d53818c323d15ea1, 6 pieces each) 13.18–14.27 s → 1.16–1.32 s (9.8×–11.4×); [128, 1, 1] (14009b6da78ed223, 5 pieces) 11.52 s → 1.57 s (7.4×).

Regression run

xcl-smoke v1
commit: 082944135cd2b96288470a595861fa608eee08dc
gpu: NVIDIA GeForce RTX 4070 SUPER
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 931 (PresentX 931)
presents per 2 s (last 3): 58 56 59
device removals: 0
crashes: 0
peak commit: 15348 MB
xcl-smoke v1
commit: 63131c64802ae0d70b1d08020d1081f72e7c8483
gpu: NVIDIA GeForce RTX 4070 SUPER
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 992 (PresentX 992)
presents per 2 s (last 3): 58 55 58
device removals: 0
crashes: 0
peak commit: 15236 MB

Not tested

  • AMD RDNA / native wave64 GPUs and Intel GPUs (tested on NVIDIA RTX 4070 SUPER only).
  • Full world-load execution past the title menu during the 60 s unattended smoke run (the newly split [8, 4, 1] / [4, 4, 2] / [8, 8, 1] / [128, 1, 1] shaders are registered at startup and dispatched lazily on world load, so their runtime execution was verified via the synthetic GPU parity tests and corpus dxil.dll + NVIDIA PSO compile benchmarks rather than in-world dispatches).

AI use

  • Antigravity (Gemini 4 Neon) for corpus profiling, implementation, tests, benchmarking, and PR drafting; all builds, tests, benchmarks, and smoke runs were executed locally on the hardware above.

Single-wave 2D/3D native wave32 compute groups (y * z > 1, total <= 32) no longer allocate @xcl_wt or emit the wave-index atomic and barriers, since tid equals WaveGetLaneIndex(). Multi-wave 2D/3D groups also skip the trailing barrier unless sharing xcl_lds[8191].

Extend direct DXIL compute dispatch splitting to all full-wave native wave32 threadgroup shapes without guest LDS (total >= 32, total % 32 == 0): size per-group scratch by total threads, preserve @xcl_wt only as the wave-ID prefix for multi-wave 2D/3D groups while gating the wave64 exchange state machine on xcl_xs, select FlattenedThreadIdInGroup() for multi-wave 1D groups, and recompute Feature::WaveOps per piece so pieces without wave ops validate.

Part of xcl-dev#1269, xcl-dev#2088.

Assisted-by: Antigravity (Gemini 4 Neon)
@DarkPanda69

Copy link
Copy Markdown

AMD native wave64 run (listed as untested), plus an RTX 3060, paired against main with the direct translator on for the whole GPU suite.

Head 63131c6 applied on main 3f4495a, debug, Windows 11 Pro 26200, XCL_DIRECT_DXIL=1 cargo test -p xcl --lib -- gpu:: --test-threads=4, on main and on this PR for each card:

main this PR
RX 9070 XT (RDNA4, 32.0.32029.2010, waves 32..64) 643 passed, 2 failed, 22 ignored, 6 SKIPPED 645 passed, 2 failed, 22 ignored, 6 SKIPPED
RTX 3060 (32.0.16.1088, wave32 only) 645 passed, 0 failed, 22 ignored, 24 SKIPPED 647 passed, 0 failed, 22 ignored, 24 SKIPPED

Per-test comparison: on both cards the only differences are the 2 new tests (dispatch_chain_native_wave32_group_shapes_match_whole, single_wave_2d_3d_omits_xcl_wt_and_guest_barrier_declines_split, both ok). No existing test changes result or skip state. The 2 RX 9070 XT failures are the AMD fuzz seeds tracked in #2115, the same on main.

Not tested: the newly split [8, 4, 1] programs of a title, Intel.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.

@Aniseto

Aniseto commented Nov 25, 2026

Copy link
Copy Markdown

Ran the split-compute tests at 63131c6:

Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, wave32 only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC 14.44.35207, DXC 1.9.2609.5, debug build.

XCL_ADAPTER=nvidia cargo test -p xcl --lib gpu::dxil::module::split -- --test-threads=4 --nocapture
10 passed; 0 failed; 0 ignored; 1221 filtered out      (exit 0)

All ten tests pass, including dispatch_chain_native_wave32_group_shapes_match_whole; the --nocapture output confirms the GPU parity checks ran on NVIDIA GeForce RTX 5070 Ti for [8, 4, 1], [4, 4, 2], [8, 8, 1] and [128, 1, 1], with no device skip.

What this adds: the author tested an Ada RTX 4070 SUPER with DXC 1.8.2502.11; this is a Blackwell wave32 part with DXC/DXIL 1.9.2609.5. No test report exists in the thread yet.

Not tested: the whole workspace suite, the retail shader corpus validation, the cold PSO compile A/B, a paired 60 s smoke run, AMD/native wave64 and Intel GPUs, Wine, release profile, title data.

AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.

@SlopTart

Copy link
Copy Markdown

Tested: current PR head merged onto current origin/main (clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo target x86_64-pc-windows-gnu run under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29).

One red on this lane: the new group-shapes test crashes at the same d3d12core.dll site as the #2338 and #2344 crash reports.

Not tested: retail titles (no title data on this lane, counts only).

AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting.

@throny throny added the goal:world-load Bears on the retail title getting past world loading label Nov 25, 2026
@FIJI1299

FIJI1299 commented Nov 25, 2026 •

Copy link
Copy Markdown

Re-tested commit 63131c6 on Windows after updating to NVIDIA driver 621.40:

Environment

  • OS: Windows 11 (Build 26100)
  • CPU: AMD Ryzen 5 9600X 6-Core Processor
  • RAM: 32 GB
  • GPU: NVIDIA GeForce RTX 5070 (12 GB VRAM, driver 621.40, native wave32 / no wave64)
  • DXC: 1.8.2502.11 (Windows SDK 10.0.26100.0)

Results

@DavidM1911

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

Thanks!

@raylitebull

Copy link
Copy Markdown
Member

Diff review (wave32 group-shape checks) and CI look clean, and Windows native/split coverage is solid, but holding merge until the deterministic d3d12core.dll + 0x1AB118 (0xc0000005) access violation reported on dispatch_chain_native_wave32_group_shapes_match_whole under Wine/vkd3d-proton is diagnosed or resolved.

@saintwolf

saintwolf commented Nov 25, 2026 •

Copy link
Copy Markdown
Author

@raylitebull That d3d12core.dll + 0x1AB118 (0xc0000005) Wine/vkd3d-proton 3.1 crash is the same pre-existing upstream fault already on main since #2080 — @ivall confirmed this on #2338 (which hit the exact same d3d12core.dll + 0x1AB118 offset and was merged):

On the open item: the crash under Wine is not from this PR. The report on #2080 (before this PR) has the fault at 0x6ffffca2b118 with d3d12core.dll loaded at 0x6ffffc880000, which is d3d12core.dll+0x1AB118, the first offset of the report here. #2080 is on main already, and the native Windows runs on NVIDIA and AMD pass. What vkd3d-proton trips over is still open and deserves its own issue.

All native Windows reports here (AMD RX 9070 XT wave64, NVIDIA RTX 5070 Ti / 5070 / 4070 SUPER / 3060 Ti / 3060) are green, so this isn't a regression from #2349.

@bmjask bmjask left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No concrete source-level defect found. The admission gates exclude partial/LDS groups, continuation identity is correct across admitted group shapes, and the GPU parity coverage is substantial; current CI and AMD/NVIDIA reports are green. Residual validation gap: no retail-title exercise of the newly admitted 2-D/3-D group shapes and no Intel run. Those should remain explicit, but I found no merge blocker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

goal:world-load Bears on the retail title getting past world loading

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants