Skip to content

Recompiler: keep multi-wave 1-D wave32 compute shaders with wave/quad ops whole - #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

@saintwolf saintwolf commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

An earlier version of this PR's native wave32 compute-splitting changes reached main via #3655 (e7f68192), without the SM 6.6 multi-wave 1-D wave/quad guard from 04f0bb6f. This PR is now rebased onto main (5eaadb54) and narrowed to that guard and its tests (+81/-5 in split.rs only). Part of #1269, #2088.

What is in it

  • crates/xcl/src/gpu/dxil/module/split.rs:
    • Keep multi-wave 1-D native wave32 compute shaders (prefix.is_empty() && total > 32) whole whenever any live dx.op.wave* or dx.op.quad* call is present (ignoring setup_lanes_compute's unused dx.op.waveGetLaneIndex), because SM 6.6 only specifies thread order within 1-D quads and does not guarantee identical quad-to-wave assignment across dispatches without a wave-ID prefix.
    • Add multi_wave_1d_wave_ops_decline_split verifying that wave-free [128, 1, 1] shaders still split and validate, while [128, 1, 1] shaders with live WaveReadLaneFirst or WaveGetLaneIndex stay whole.
    • Update dispatch_chain_native_wave32_group_shapes_match_whole so the [128, 1, 1] multi-wave 1-D case tests a wave-free shader (while single-wave [8, 4, 1] / [4, 4, 2] and prefix-bearing [8, 8, 1] continue exercising WaveReadLaneFirst across cuts).

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.
  • cargo test -p xcl --lib gpu::dxil:: -- --test-threads=4 on 790f252f: 353 passed, 0 failed, 4 ignored (including multi_wave_1d_wave_ops_decline_split and dispatch_chain_native_wave32_group_shapes_match_whole).
  • cargo build --release -p xcl: clean build.

Regression run

xcl-smoke v1
commit: f07e426dade72aa7112cf6bfe08ca6f6ff5a9d5c
gpu: NVIDIA GeForce RTX 4070 SUPER
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1668 (PresentX 1668)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 16731 MB
xcl-smoke v1
commit: 790f252f225525578f3c2a5c274ca774491fd26c
gpu: NVIDIA GeForce RTX 4070 SUPER
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1631 (PresentX 1631)
presents per 2 s (last 3): 60 60 61
device removals: 0
crashes: 0
peak commit: 15644 MB

Not tested

  • AMD RDNA / native wave64 GPUs, Intel GPUs, and full workspace test suite locally on 790f252f (covered by CI).

AI use

  • Antigravity (Gemini 4 Neon) rebased the 1-D wave/quad guard and tests onto main (5eaadb54), ran gpu::dxil:: tests and the 60 s head smoke, and updated this description.

@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
Contributor 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.

@CalvyPZ CalvyPZ added the duplicate This issue or pull request already exists label Nov 25, 2026
@CalvyPZ CalvyPZ closed this Nov 25, 2026
@CalvyPZ CalvyPZ reopened this Nov 25, 2026
@CalvyPZ CalvyPZ removed the duplicate This issue or pull request already exists label Nov 25, 2026
@Prime1997 Prime1997 mentioned this pull request Nov 26, 2026
@Prime1997

Copy link
Copy Markdown
Collaborator

@saintwolf I published the tested main integration branch in xcl-dev/xcl, retaining your authorship. It applies 63131c64 to main 8b957bec and resolves this PR's conflict.

This preserves main's #2371 scratch-slot reuse hook while using the full threadgroup size for scratch. The tests include four wave32 group shapes and the existing divergent-edge regression, with the reuse hook checked both enabled and disabled.

Local result: 6 passed, 0 failed, 0 ignored, 0 explicit skips on the RTX 3060 Ti. Each exact filter ran separately with --test-threads=1 --nocapture after a fresh cargo test --locked -p xcl --lib --no-run build, with 1,346 tests filtered out per invocation. The branch is available for the PR rebase. The focused checks leave full-suite, exact-head title smoke, and the maintainer RDNA4 batch validation pending.

AI use: Codex (GPT-6) resolved the conflict and verified the focused checks. Optional temporary Discord for coordinating contributor work, testing, and comparing results.

saintwolf added a commit to saintwolf/xcl that referenced this pull request Nov 26, 2026
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)

Resolve the merge conflict against current main 8b957be. Keep main’s scratch-slot reuse hook and the PR’s full threadgroup sizing.

Original-PR: xcl-dev#2349
Original-commit: 63131c6
Assisted-by: OpenAI Codex (GPT-6)
@saintwolf
saintwolf force-pushed the dxil/split-wave32-groups branch from 63131c6 to 6aa4e2f Compare November 26, 2026 18:04
@saintwolf

Copy link
Copy Markdown
Contributor Author

@Prime1997 Thanks for resolving the conflict on review/2349-main-8b957bec! Applied that exact resolution onto e120925e (merges cleanly onto main 8b957bec with zero conflicts) at 6aa4e2f5, preserving #2371's scratch-slot reuse hook alongside full threadgroup sizing.

  • Full .\scripts\test.ps1 passed with 0 failures and a fresh 60 s scripts/smoke.ps1 run at 6aa4e2f5 is updated in the PR description.

@Decodere

Copy link
Copy Markdown
Contributor

Independent RTX 4060 (8 GB) / Windows 11 release verification of PR #2349 rebased head 6aa4e2f578dfdc2b296c38eb30129f45439ea8d5 (exact parent & merge-base e120925e3abc9956a8b9bae631969d32e8ccd43c). Measurements and targeted GPU/unit test results only; not a full source review.

Setup

  • GPU: NVIDIA GeForce RTX 4060 (8 GB / 7956 MiB reported by D3D12), driver 32.0.16.2114 (NVIDIA 621.14, WDDM 3.2)
  • CPU / RAM / OS: Intel Core i5-11400F (6 cores / 12 threads), 32 GB RAM (31.9 GiB usable), Windows 11 Home 26200
  • Toolchain / caches: rustc 1.100.0 (0ef1bc386 2026-11-09), DXC 1.9.2609.5, release builds, quiet machine (zero concurrent builds/tests during timed runs; note gpu/dxil/* edits give 6aa4e2f5 a fresh XCL_DIRECT_DXIL_SOURCE_ID namespace)
  • Workload: Retail workload title: 29640639 via scripts/smoke.ps1 -Seconds 60 (XCL_NETWORK=0, default flags, no input)

Targeted RTX 4060 release unit & GPU tests (6aa4e2f5)

  • cargo test --release -p xcl --lib single_wave_2d_3d_omits_xcl_wt_and_guest_barrier_declines_split -- --nocapture: 1 passed, 0 failed, 0 ignored (0.00 s, 0 SKIPPED).
  • cargo test --release -p xcl --lib dispatch_chain_native_wave32_group_shapes_match_whole -- --nocapture: 1 passed, 0 failed, 0 ignored (0.49 s, executed on RTX 4060, 0 SKIPPED).
  • cargo test --release -p xcl --lib gpu::dxil::module::split:: (3 consecutive parallel passes): 10 passed, 0 failed, 0 ignored on all 3 passes (0.35 s / 0.34 s / 0.35 s, 0 SKIPPED).
  • cargo test --release -p xcl --lib gpu::dxil::: 186 passed, 0 failed, 3 ignored (4.00 s; 1 SKIPPED: gpu::dxil::kernel::dispatch_chain_native_wave64_builds_whole skipped no wave64 on NVIDIA wave32 RTX 4060).

Paired 60 s RTX 4060 smoke (exact parent e120925e vs 6aa4e2f5)

Both runs completed cleanly at steady 60/2 s pacing with 0 device removals and 0 crashes (6aa4e2f5 vs e120925e xcl.log: 6,115 vs 6,114 MB peak/end local VRAM, 4,651 MB end non-local VRAM on both, 19,663 vs 19,588 translated draws / 1,024 dispatches with 0 skipped).

Exact parent (e120925e):

xcl-smoke v1
commit: e120925e3abc9956a8b9bae631969d32e8ccd43c
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1602 (PresentX 1602)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13979 MB

PR #2349 head (6aa4e2f5):

xcl-smoke v1
commit: 6aa4e2f578dfdc2b296c38eb30129f45439ea8d5
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1625 (PresentX 1625)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13976 MB

Limits of coverage

  • Full workspace test suite was not run on 6aa4e2f5 (only the 2 new tests individually, 3 parallel passes of gpu::dxil::module::split::, all 186 passing tests in gpu::dxil::, release build, and exact-parent paired 60 s smokes); dispatch_chain_native_wave64_builds_whole skipped no wave64 on wave32 NVIDIA hardware.
  • The 60 s no-input menu/intro smoke hit 0 split-compute programs (compute split: 0 programs split, 0 pieces built, 0 chained dispatches issued in 0 slabs; scratch 0 MiB), so split 2D/3D native-wave32 execution vs whole-shader parity was exercised on-GPU by dispatch_chain_native_wave32_group_shapes_match_whole rather than live in-world split compute dispatches.
  • Single discrete NVIDIA 8 GB GPU (RTX 4060) on native Windows 11; no AMD, Intel, or Wine/Linux run on this host.

AI use

Ran the targeted release unit/GPU tests, release build, and exact-parent paired quiet 60 s smoke runs with assistance from Google Antigravity (Gemini 4 Neon); all test counts, timings, memory figures, and smoke blocks were extracted directly from cargo test, xcl.log, and scripts/smoke.ps1 outputs.

@upipibi

upipibi commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Tested head 6aa4e2f5, merge-base e120925e, RTX 3070 (Ampere) driver 616.56, Windows 11, rustc 1.100.0. Debug build, no env vars, no game files.

  • PR's tests, cargo test -p xcl --lib gpu::dxil::module::split::tests -- --test-threads=1, 3 runs on head: 10 passed, 0 failed each time.
  • Negative control: only the PR's test hunk applied to the merge-base e120925e: 8 passed, 2 failed. dispatch_chain_native_wave32_group_shapes_match_whole and single_wave_2d_3d_omits_xcl_wt_and_guest_barrier_declines_split fail there.
  • cargo test -p xcl --lib -- --test-threads=4 --skip hle::xaudio2 (9 filtered out on both trees):
    • head: 1307 passed, 1 failed (27 ignored)
    • merge-base: 1306 passed, 0 failed (27 ignored)
    • The one failure was hle::kernelx::tests::a_sleep_stops_counting_when_the_title_gets_held, a timing test the PR doesn't touch. Run alone with --exact, 5 times on each tree, it gave 1 passed, 0 failed every time on both. So I read it as load-related flakiness from the parallel run, not a regression.
  • SKIPPED lines: 25 on both trees, the same set (wave64 not available on this card, 3 per-lane f16 forms refused, 1 driver-cache test).

Not tested: retail title.

AI-assisted (Claude Code, Claude Sonnet 5.5 ran the tests; Claude Opus 5.5 ran the reruns, checked and posted).

@JJAutoCompare

Copy link
Copy Markdown

Tested: Clean 6aa4e2f578dfdc2b296c38eb30129f45439ea8d5, Windows 11 build 26200.9974, Ryzen 7 3800X, Arc A770 driver 32.0.101.9175, Rust 1.100.0 MSVC, DXC/DXIL 1.9.2602.17, debug. Four CPU/DXIL toolchain controls and six Arc fixtures passed, with zero failures, ignores or skips. Built with cargo test -p xcl --lib --no-run -j 2, then each exact test with --nocapture --test-threads=1. dispatch_chain_native_wave32_group_shapes_match_whole tested [8,4,1], [4,4,2], [8,8,1] and [128,1,1] thread groups. The four whole shaders and all 14 split pieces validated. Whole and split readbacks matched the CPU reference bit for bit, including slab limits of 1, 3, and 7 groups.

Not tested: Native wave64, [4,8,1] groups, workspace suite, retail smoke and performance.

AI use: T3 Code / Codex (gpt-6.2-sol) ran and reran the fixtures and wrote this report.

@futurepro62

Copy link
Copy Markdown

NVIDIA and AMD full-suite run, to go with the reports above by Decodere, JJAutoCompare, upipibi, since none of them covers AMD. Tested exact head 6aa4e2f5 (on its base e120925).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace --no-fail-fast -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::recomp::lower_dxil::tests::mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu --skip gpu::dxil::fuzz_tests: 1432 passed, 0 failed, 45 ignored. SKIPPED (no wave64): a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu, a_per_lane_2d_or_3d_group_runs_on_the_gpu, coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu, cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu, dispatch_chain_native_wave64_builds_whole, gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware, the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu.
  • The new tests ran and passed: single_wave_2d_3d_omits_xcl_wt_and_guest_barrier_declines_split, dispatch_chain_native_wave32_group_shapes_match_whole.
  • Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace --no-fail-fast -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 1443 passed, 0 failed, 47 ignored. SKIPPED: f16_programs_on_the_gpu (f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), f32_programs_on_the_gpu (f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), f32_programs_on_the_gpu (f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • --skip leaves out tests that fail on main c2ee10e4 too, not because of this PR. On NVIDIA: heap_window_out_of_memory_falls_back_to_the_switch_form (Tests: heap_window_out_of_memory_falls_back_to_the_switch_form fails under XCL_REQUIRE_GPU=mesh (opt-in skip counted as missing coverage) #1651), the four gpu::recomp::lower_dxil::tests::*_programs_on_the_gpu tests, const_and_null_mask_operands_agree_with_hlsl_on_the_gpu and mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu (follow-up on #1651) fail because runner::skip_test turns their skips into failures under XCL_REQUIRE_GPU=mesh, and gpu::dxil::fuzz_tests seeds 70, 545, 1019 and 1507 fail CreateComputePipelineState with E_OUTOFMEMORY on this card (drivers 616.64 and 621.40). On AMD: fuzz_validate_and_gpu_1 fails on seed 540 (res[833] 0x7 vs CPU 0x6). The AMD run does not set XCL_REQUIRE_GPU.

Not tested

  • a release build, a game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.

saintwolf added a commit to saintwolf/xcl that referenced this pull request Nov 28, 2026
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)

Resolve the merge conflict against current main 8b957be. Keep main’s scratch-slot reuse hook and the PR’s full threadgroup sizing.

Original-PR: xcl-dev#2349
Original-commit: 63131c6
Assisted-by: OpenAI Codex (GPT-6)

# Conflicts:
#	crates/xcl/src/gpu/dxil/kernel.rs
@github-actions github-actions Bot added checks-disagree Merge-checks disagree (safe vs not yet); needs maintainer/3rd look and removed needs-2nd-check Has 1 safe merge-check; needs second independent check (#3041) labels Dec 1, 2026
@Decodere

Decodere commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

merge-check
base: 1c8b551
head: 04f0bb6
merge: clean (a6311f258a6817268107363966542a7b2d4f1134; 3 files, +297/-21; git diff --check ok)
build: cargo build --workspace ok; cargo build --release -p xcl ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 --nocapture -> 42 non-lib targets passed (148 passed, 0 failed, 20 ignored); xcl --lib hit the pre-existing synthetic-pointer ASLR abort (0x7c000041) under --test-threads=4 and passed cleanly on rerun via cargo test -p xcl --lib -- --test-threads=2 --nocapture (2764 passed, 0 failed, 31 ignored) -> combined 2912 passed, 0 failed, 51 ignored across 43 targets (28 SKIPPED lines matching clean base 1c8b551: 22 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 2 no heap windows, 1 cannot disable the driver cache). All 14 gpu::dxil::module::split::tests passed on RTX 4060 with 0 skips, including all 3 new tests (single_wave_2d_3d_omits_xcl_wt_and_guest_barrier_declines_split, multi_wave_1d_wave_ops_decline_split, and the live GPU parity test dispatch_chain_native_wave32_group_shapes_match_whole).
review: Full 3-file diff (crates/xcl/src/gpu/dxil/kernel.rs, lanes.rs, module/split.rs, +297/-21) audited; no correctness issues found.

  • lanes.rs: single-wave 2D/3D native groups (y * z > 1 && total <= lanes) use wave_lane_index() directly without xcl_wt, atomics, or barriers while deriving row-major (gx, gy, gz) from tid; multi-wave 2D/3D groups drop the trailing GROUP_SYNC when using dedicated xcl_wt (keeping it when sharing xcl_lds[8191]), which is sound since all threads already synchronized after zeroing xcl_wt[0] and nothing else writes xcl_wt.
  • kernel.rs and module/split.rs: extends split_compute to full-wave native wave32 groups without guest LDS (total >= 32 && total % 32 == 0), sizes per-group scratch by total, replays the xcl_wt prefix on multi-wave 2D/3D pieces so wave membership stays intact across dispatches, gates the xcl_xs store/barrier/load exchange state machine on has_xs so guest barriers in native wave32 cleanly decline splitting, keeps multi-wave 1-D groups (prefix.is_empty() && total > 32) whole whenever any live dx.op.wave* or dx.op.quad* call is present (addressing SM 6.6 quad-to-wave portability), and recomputes Feature::WaveOps per piece so wave-free pieces pass validation.
  • Wave64 hardware paths were not executed on this wave32-only GPU (validation only via unit test).
    performance: Single 60 s release smoke on title 29640639 vs clean base 1c8b551 (1462 frames, presents per 2 s last 3: 48 53 59, peak commit 16043 MB): 1639 frames (+12.1%, steady 60 60 60), peak commit 14759 MB (-8.0%), 0 device removals, 0 crashes. However, xcl.log reported compute split: 6 programs split, 20 pieces built, 0 chained dispatches issued in 0 slabs during the 60 s startup/menu run, so this smoke did not exercise newly split chained dispatches at runtime and cannot refute the measured -18% presents/2 s and -26% draws/2 s in-world regression reported on RTX 3090 across 3 paired 300 s A/B runs (including reversed order) where 29k-44k chained dispatches ran.
xcl-smoke v1
commit: a6311f258a6817268107363966542a7b2d4f1134
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1639 (PresentX 1639)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14759 MB

verdict: not yet: code correctness, full test suite, live GPU parity tests, and 60 s startup smoke are clean, but the 60 s menu smoke issued 0 chained dispatches and cannot refute the measured -18% presents / -26% draws in-world regression reported on RTX 3090 for this default-on change; isolate the in-world cost (wider split vs single-wave 2D/3D tid) or verify with paired in-world A/B runs before enabling by default
hardware / tool and model: NVIDIA GeForce RTX 4060 8 GB (driver 621.40), Intel Core i5-11400F, 32 GB RAM, Windows 11 Build 26200, Rust 1.100.1 MSVC, DXC 1.9.2602.17 / Antigravity (Gemini 4 Neon)

@fromthemoonx

Copy link
Copy Markdown

@saintwolf an earlier version of this commit reached main today with #3655 (e7f68192), but without your 1-D wave / quad guard from 04f0bb6f. Your multi_wave_1d_wave_ops_decline_split fails on main 38ad22da, and passes once the guard is added. So this PR is still needed: could you rebase it down to the guard and its tests? Details are in my updated report: #2349 (comment)

AI use: Claude Code (Claude Opus 5.5) ran the checks and wrote this.

@github-actions github-actions Bot added needs-rebase Has merge conflicts with its base branch and removed checks-disagree Merge-checks disagree (safe vs not yet); needs maintainer/3rd look needs:amd-test Needs a test report or merge-check on an AMD GPU labels Dec 2, 2026
… ops whole

SM 6.6 only guarantees thread order within 1-D quads, not quad-to-wave assignment across dispatches. Keep multi-wave 1-D native wave32 compute shaders (prefix.is_empty() && total > 32) whole when any live dx.op.wave* or dx.op.quad* call is present (ignoring setup_lanes_compute's unused waveGetLaneIndex), and add multi_wave_1d_wave_ops_decline_split.

Assisted-by: Antigravity (Gemini 4 Neon)
@saintwolf saintwolf changed the title Recompiler: split native wave32 compute groups beyond [32, 1, 1] Recompiler: keep multi-wave 1-D wave32 compute shaders with wave/quad ops whole Dec 2, 2026
@github-actions github-actions Bot added gpu:nvidia Code is specific to NVIDIA / wave32 GPUs (scope tag; see needs:nvidia-test) and removed gpu:both Code affects both AMD and NVIDIA GPUs (scope tag; see needs:*-test for remaining checks) labels Dec 2, 2026
@saintwolf
saintwolf force-pushed the dxil/split-wave32-groups branch from 04f0bb6 to 790f252 Compare December 2, 2026 14:09
@github-actions github-actions Bot removed the needs-rebase Has merge conflicts with its base branch label Dec 2, 2026
@saintwolf

Copy link
Copy Markdown
Contributor Author

Thanks @fromthemoonx! Rebased onto main (5eaadb54) as 790f252f and narrowed down to just the multi-wave 1-D wave/quad guard and its tests (+81/-5 in crates/xcl/src/gpu/dxil/module/split.rs only):

  • cargo test -p xcl --lib gpu::dxil:: -- --test-threads=4: 353 passed, 0 failed, 4 ignored (including multi_wave_1d_wave_ops_decline_split and dispatch_chain_native_wave32_group_shapes_match_whole).
  • 60 s head smoke (790f252f): 1631 frames, 60 60 61, 0 device removals, 0 crashes, 15644 MB peak commit.

AI use: Antigravity (Gemini 4 Neon) rebased the branch, ran the tests and 60 s smoke, and drafted this reply.

@Foniass

Foniass commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator

Follow-up review (head 790f252, since 04f0bb6, diff read, not a merge-check):

New:

  • The stated reason applies to the unsplit shader too. For a multi-wave 1-D wave32 group, setup_lanes_compute already takes tid from FlattenedThreadIdInGroup() and the guest lane from WaveGetLaneIndex() (lanes.rs ~165, ~192), so the whole shader assumes threads 32k..32k+31 share one hardware wave; if that could change between dispatches, the unsplit shader would be wrong the same way. The guard (split.rs ~217) declines the split for any shader with a live wave op, including every VALU compare that reaches waveActiveBallot (lower.rs ~1071), which probably turns off most of the 1-D split e7f68192 added, and there is no count of how many shaders lose it.

Fine: the guard only declines splits, so the default falls back to the whole shader; the prefix.is_empty() && total > 32 condition matches exactly the multi-wave 1-D case; an unused waveGetLaneIndex is ignored; multi_wave_1d_wave_ops_decline_split fails without the guard.

AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.

@saintwolf

Copy link
Copy Markdown
Contributor Author

Two factual corrections to the automated review above:

  1. Why splitting differs from an unsplit dispatch: an unsplit shader only requires consistent wave membership within a single dispatch. Across a split dispatch chain indexed by FlattenedThreadIdInGroup(), SM 6.6 does not guarantee that the same 1-D quads are assigned to the same hardware wave in Piece N+1 as in Piece N — so a thread's scalar continuations survive while its wave peers can change mid-shader. That cross-dispatch hazard (raised in earlier human review) does not affect an unsplit dispatch, and is the entire reason this guard exists.
  2. Corpus impact: in the 2,689-shader corpus profiled earlier on this PR, 95 of the 96 newly split native wave32 shaders were 2D/3D ([8, 4, 1]: 86, [4, 8, 1]: 6, [4, 4, 2]: 2, [8, 8, 1]: 1) and only 1 was multi-wave 1-D ([128, 1, 1]), so this guard does not meaningfully reduce split coverage.

Ready for human maintainer / merge-check review on 790f252f.

AI use: Antigravity (Gemini 4 Neon) drafted this reply.

@Pipodi

Pipodi commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

merge-check
base: 5eaadb5
head: 790f252
merge: clean (the PR is already on 5eaadb5; merge commit 77ee7cda, split.rs only, +81/-5)
build: cargo build --workspace -> ok (also cargo test --workspace --no-run and cargo build --release -p xcl)
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2975 passed, 0 failed, 52 ignored; failing: none. 25 SKIPPED lines: 22 "no wave64", 2 "no heap windows", 1 "cannot disable the driver cache". multi_wave_1d_wave_ops_decline_split and the GPU parity test dispatch_chain_native_wave32_group_shapes_match_whole ran and passed (not skipped).
review: no blocking finding; whole diff read. The guard only declines splits, so the fallback is the whole program, and it cannot make a shader wrong. prefix.is_empty() && total > 32 matches exactly the multi-wave 1-D native wave32 groups: split-wave64 and multi-wave 2-D/3-D groups carry a tid prefix, and finish_dispatch only calls split_compute for native wave32 or a split_tid. The dx.op.wave / dx.op.quad prefixes match the names the module declares (same test as opt.rs wave_call), and an unused waveGetLaneIndex is correctly ignored. On Foniass's two points, from my own reading:

  1. The unsplit shader makes the same lane assumption. For these groups setup_lanes_compute takes tid from FlattenedThreadIdInGroup() (lanes.rs:166) and the guest lane from WaveGetLaneIndex() (lanes.rs:192), independently. So the whole shader already assumes hardware wave k holds threads 32k..32k+31 in lane order, a layout that would then be the same in every dispatch. The split adds a hazard only for a layout that is consistent within a dispatch but not linear. Under such a layout, unsplit shaders that relate thread ID to lane would already be wrong. So the guard is defensive against a legal-but-unobserved layout and fixes no observed failure. saintwolf's reply is right that it closes a hazard specific to the chain, but not that the unsplit shader is free of the assumption.
  2. It probably disables most of the 1-D part of e7f6819's split. Every VALU compare that writes a mask goes through Lw::ballot -> dx.op.waveActiveBallot (lower.rs:1071, lanes.rs:822), and that ballot is live in any shader with divergent branches. So nearly every multi-wave 1-D shader over the 12,500-instruction piece limit now stays whole. The absolute number looks small: these are guest wave32, 1-D, more than 32 threads, no guest LDS, over the limit; saintwolf's corpus has 1 such shader among 96 newly split. I did not count it here; the smoke's "compute split" counters depend on what each run translated and cannot be compared.
    performance: measured, no regression. Retail title, 60 s, XCL_PREPARE=0, the same scripted presses, one warm-up run per side, gamesave moved aside before each run: frames 1611 vs main's 1609 (100.1 %), peak commit 19399 vs 18303 MB (106.0 %), no device removal or crash on either side. Neither run issued a chained dispatch ("0 chained dispatches issued" on both), so this smoke does not reach the guard's runtime effect. Reasoned: a shader the guard keeps whole is what main ran before e7f6819. It runs as one dispatch with no continuation scratch, so it costs no frame time or memory per dispatch. The cost is at build time: the driver compiles the whole, larger program, built on the xcl-pso-whole path, instead of smaller pieces. That can delay that pipeline the first time it is used; it is the same cost as before e7f6819, and only for the few shaders in point 2.

main 5eaadb5:

xcl-smoke v1
commit: 5eaadb54c14e0fc29597b2a1689d7dbd83491303
gpu: NVIDIA GeForce RTX 4090
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1609 (PresentX 1609)
presents per 2 s (last 3): 60 60 61
device removals: 0
crashes: 0
peak commit: 18303 MB

this PR 790f252 (clean checkout):

xcl-smoke v1
commit: 790f252f225525578f3c2a5c274ca774491fd26c
gpu: NVIDIA GeForce RTX 4090
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1611 (PresentX 1611)
presents per 2 s (last 3): 60 60 61
device removals: 0
crashes: 0
peak commit: 19399 MB

verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 4090 24 GB, driver 621.40; Intel Core i9-13900K, 32 GB; Windows 11 build 26300; rustc 1.100.0; tests debug, smoke release. Claude Code, Claude Opus 5.5 read the diff, ran the build, the suite and the smoke pair, and wrote this check.

@github-actions github-actions Bot added needs-1st-check Passes gates; needs first independent merge-check (#3041) needs:nvidia-test Needs a test report or merge-check on an NVIDIA GPU needs-2nd-check Has 1 safe merge-check; needs second independent check (#3041) ready-to-merge Has 2 independent safe merge-checks on current head (#3041) and removed needs-1st-check Passes gates; needs first independent merge-check (#3041) needs:nvidia-test Needs a test report or merge-check on an NVIDIA GPU needs-2nd-check Has 1 safe merge-check; needs second independent check (#3041) labels Dec 2, 2026
@ClosetPie107

Copy link
Copy Markdown

Linux / AMD RDNA4 (RADV, Wine + vkd3d-proton): full test suite on 790f252

Merged onto main 5eaadb54 (clean merge) and compared with main run twice on the same machine.

Setup

  • AMD Radeon RX 9070 16 GB (RDNA4, RADV GFX1201, Mesa 26.3.1), Ryzen 5 9600X, 30 GiB RAM, CachyOS (kernel 7.3.7)
  • Wine 11.23 (system), stock vkd3d-proton v3.1-83-gcae8353ed and DXVK dxgi.dll from GE-Proton11-16, DXC 1.9.2609.5
  • Debug build, cross-compiled for x86_64-pc-windows-msvc with cargo-xwin; test binaries run under Wine

Tested: cargo xwin test --workspace --target x86_64-pc-windows-msvc --no-fail-fast -- --test-threads=4 --skip <31 tests>

passed failed ignored
main 5eaadb54 2769 177 52
this PR merged 2770 177 52
  • Tests that fail with this PR and pass on main: none.
  • Tests this PR adds: 1 of 1 pass (multi_wave_1d_wave_ops_decline_split).
About the failures on main and the 31 skipped tests (same for every PR in this batch)
  • Most of main's 177 failures under Wine come from Linux (Wine + vkd3d-proton): a retail game reaches what main reaches on Windows; the obstacle is replaced vtables — proposal: proxies #175: once a test has set up the real device, vkd3d-proton refuses the command allocators XCL adopts (d3d12_command_list_Reset: Invalid command allocator), and later tests get E_INVALIDARG (0x80070057). Running vkd3d-proton master with its vtable check taken out, hle::d3d12x::sparse::tests goes from 106 passed / 38 failed to 144 / 0.
  • The 31 skipped tests make vkd3d-proton's dxil-spirv call std::terminate() (Cannot reliably convert LLVM pointer type, we cannot differentiate between Function and Private), which kills the whole test binary. They are the split-wave64, dispatch-chain and bridged-mask GPU tests, gpu_compute_mode_dispatch_abi, gpu_compute_thread_limits_leave_the_lanes_past_them_out, the two gpu_mesh_mode_* tests, and console_wave64_compute_through_the_pso_hook_dispatch_and_read_back, plus serialize_root_signature_strips_console_flags_and_preserves_pc_flags, whose null descriptor vkd3d-proton dereferences. The dxil-spirv ones crash the same way with vkd3d-proton master (f8c1cae8, dxil-spirv 93ab44c5).
  • main was run twice: same counts, same failure set. SKIPPED lines (same as main): no heap windows (2), no D3D12 debug layer (2-3), driver cache control not implemented in vkd3d-proton (1).

Not tested: Windows, NVIDIA, a retail title / scripts/smoke.ps1, a review of the diff. This is a test report, not a merge-check.

AI use: omp (Claude Opus 5.5) merged, built and ran the suites on this machine, compared the results with main, and drafted this report. The user asked for it to be posted.

@throny throny added needs:title-run Runtime change: needs a merge-check with a real title run into the world (#3041) and removed ready-to-merge Has 2 independent safe merge-checks on current head (#3041) labels Dec 2, 2026
@tiagonleal

Copy link
Copy Markdown
Contributor

merge-check
base: 5ad98ad
head: 790f252
merge: clean (merge commit a933f1f8dd2cea8ef14498a2c3aa9d62d511ac02; git diff --check clean)
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 3006 passed, 0 failed, 52 ignored; SKIPPED: 24 (22 no wave64, 2 no heap windows); failing: none
title run: Newer Retail Game, release build of this merge, Series S settings (XCL_DEVICE_TYPE=lockhart, XCL_COHERENT_MB=512, XCL_UMA_WINDOWS=16, XCL_SPARSE_LAZY=1), scripted A presses, 240 s planned: into the world at 80 s, 159 s there with 89 frames presented, no crash, no device removal; ran to the 240 s limit.
review: none. The rule only keeps 1-D multi-wave wave32 shaders whole when they use live wave or quad ops; I did not measure compile time or size of the larger whole shaders.
performance: the affected shaders compile as one larger DXIL; not measured. World frame rate not compared: on this 32 GB PC the runs of main and of the PRs end 30 to 150 s into the world (RAM guard or time limit).
verdict: safe to merge
hardware / tool and model: RTX 5070 Ti 16 GB (driver 617.42), Ryzen 7 9800X3D, 32 GB, Windows 11 Pro 26300 / Claude Code with Claude Opus 5.5

Same settings on main 5ad98ad, two runs: into the world at 94 s with 145 s there and no frame presented (ran to the 240 s limit); into the world at 80 s with 59 s there and 90 frames, then stopped by our RAM guard (free RAM under 1 GB). "In the world" here means the first 2 s window of the activity log with 5,000+ draws and dispatches.

AI use: Claude Code (Claude Opus 5.5) ran the build, tests and title runs and wrote this; a Claude Sonnet subagent read the diff and I checked its points.
~Tiago

@github-actions github-actions Bot added ready-to-merge Has 2 independent safe merge-checks on current head (#3041) and removed needs:title-run Runtime change: needs a merge-check with a real title run into the world (#3041) labels Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:recompiler RDNA2 decoder, HLSL/direct-DXIL recompiler, wave64/wave32 goal:world-load Bears on the retail title getting past world loading gpu:nvidia Code is specific to NVIDIA / wave32 GPUs (scope tag; see needs:nvidia-test) ready-to-merge Has 2 independent safe merge-checks on current head (#3041)

Projects

None yet

Development

Successfully merging this pull request may close these issues.