recomp: run wave64 compute programs as two wave32 halves on 32-lane GPUs #70

Closed
github-bot wants to merge 1 commit from gh-pr/70/head into gh-pr/70/base
Owner

@⁠gefydev on GitHub · 2026-11-23 00:11 UTC · original
gefydev:recomp-compute-wave32 → main · +113 −13 · 5 files · 1 commits · closed without merging

On NVIDIA (32-lane waves only) every translated console compute shader fails. The compute path always emits [WaveSize(64)], since console compute programs are wave64, and the driver refuses that pipeline:

CreateComputePipelineState: E_INVALIDARG (0x80070057)

translated_compute_pso then records a translation error and the title's dispatches with that pipeline are skipped. The README mentions this ("console wave64 compute … programs are mostly refused there").

Mesh programs already have the fix for the same problem (#39): a logical wave64 runs as two native wave32 halves (xcl_half, xcl_logical_wave64), and geometry_wave32_hazards refuses programs that need both halves at once. This PR uses that for compute:

  • Options::compute_wave32 and translate_compute, the compute counterpart of translate_mesh: the same hazard check, with "compute program requires unsupported cross-half wave64 semantics" in the error.
  • With it the CS prologue is [WaveSize(32)], with xcl_half = (gi >> 5) & 1 and lane_id = WaveGetLaneIndex() + 32 * xcl_half, as in mesh mode. numthreads, thread ids, group ids, TG_SIZE and LDS are unchanged.
  • translated_compute_pso passes geometry_wave32_required(this), the same adapter check console mesh pipelines use. On adapters with wave64 (RDNA) it is false and the generated HLSL is unchanged.

This doesn't cover programs with cross-half semantics (DPP/swizzle reductions, whole-wave mask counts, …). Those are still refused, as for mesh. #33 is working on a groupshared rendezvous for those. This PR is the smaller step that lets everything else run.

Validation

GTX 1650 (Turing, wave32 only), Windows 11, NVIDIA driver 32.0.16.2114, MSVC debug build: cargo test --workspace has 0 failures, as on main on this machine, and the three new tests ran and passed. I first worked on it on the same GPU on Linux (Wine + vkd3d-proton 2.14.1), where the results are the same.

  • New gpu_compute_wave64_as_wave32_halves: the program from gpu_compute_mode_dispatch_abi (two wave64s per group, LDS + s_barrier between them) translated split. Same results as the wave64 test checks. gpu_compute_mode_dispatch_abi now shares its program and check with it.
  • New gpu_compute_wave32_halves_keep_their_exec_bits: v_cmpx keeps lanes 0..39, so the high half has 8 live lanes. With lane_id left at WaveGetLaneIndex() it fails (lane 32 gives 0 instead of 33).
  • New split_compute_refuses_cross_half_semantics (no GPU): s_bcnt1_i32_b64 on VCC is refused split and translates with wave64.
  • The same program unsplit on this GPU: CreateComputePipelineState: 0x80070057, i.e. what main does.
  • cargo test -p xcl --lib: 0 failed on the GTX 1650 (41 GPU tests skipped with "no wave64", as before) and without a GPU.

Not tested on RDNA: there the split tests run [WaveSize(32)], which RDNA supports, and nothing else changes.

**@⁠gefydev** on GitHub · 2026-11-23 00:11 UTC · [original](https://github.com/xcl-dev/xcl/pull/70) `gefydev:recomp-compute-wave32` → `main` · +113 −13 · 5 files · 1 commits · closed without merging On NVIDIA (32-lane waves only) every translated console compute shader fails. The compute path always emits `[WaveSize(64)]`, since console compute programs are wave64, and the driver refuses that pipeline: ``` CreateComputePipelineState: E_INVALIDARG (0x80070057) ``` `translated_compute_pso` then records a translation error and the title's dispatches with that pipeline are skipped. The README mentions this ("console wave64 compute … programs are mostly refused there"). Mesh programs already have the fix for the same problem (#39): a logical wave64 runs as two native wave32 halves (`xcl_half`, `xcl_logical_wave64`), and `geometry_wave32_hazards` refuses programs that need both halves at once. This PR uses that for compute: - `Options::compute_wave32` and `translate_compute`, the compute counterpart of `translate_mesh`: the same hazard check, with "compute program requires unsupported cross-half wave64 semantics" in the error. - With it the CS prologue is `[WaveSize(32)]`, with `xcl_half = (gi >> 5) & 1` and `lane_id = WaveGetLaneIndex() + 32 * xcl_half`, as in mesh mode. `numthreads`, thread ids, group ids, TG_SIZE and LDS are unchanged. - `translated_compute_pso` passes `geometry_wave32_required(this)`, the same adapter check console mesh pipelines use. On adapters with wave64 (RDNA) it is false and the generated HLSL is unchanged. This doesn't cover programs with cross-half semantics (DPP/swizzle reductions, whole-wave mask counts, …). Those are still refused, as for mesh. #33 is working on a groupshared rendezvous for those. This PR is the smaller step that lets everything else run. ## Validation GTX 1650 (Turing, wave32 only), Windows 11, NVIDIA driver 32.0.16.2114, MSVC debug build: `cargo test --workspace` has 0 failures, as on `main` on this machine, and the three new tests ran and passed. I first worked on it on the same GPU on Linux (Wine + vkd3d-proton 2.14.1), where the results are the same. - New `gpu_compute_wave64_as_wave32_halves`: the program from `gpu_compute_mode_dispatch_abi` (two wave64s per group, LDS + `s_barrier` between them) translated split. Same results as the wave64 test checks. `gpu_compute_mode_dispatch_abi` now shares its program and check with it. - New `gpu_compute_wave32_halves_keep_their_exec_bits`: `v_cmpx` keeps lanes 0..39, so the high half has 8 live lanes. With `lane_id` left at `WaveGetLaneIndex()` it fails (lane 32 gives 0 instead of 33). - New `split_compute_refuses_cross_half_semantics` (no GPU): `s_bcnt1_i32_b64` on VCC is refused split and translates with wave64. - The same program unsplit on this GPU: `CreateComputePipelineState: 0x80070057`, i.e. what `main` does. - `cargo test -p xcl --lib`: 0 failed on the GTX 1650 (41 GPU tests skipped with "no wave64", as before) and without a GPU. Not tested on RDNA: there the split tests run `[WaveSize(32)]`, which RDNA supports, and nothing else changes.
Console compute programs are wave64, and the compute path always
emitted [WaveSize(64)]. On an adapter without 64-lane waves (NVIDIA)
the driver refuses that pipeline (E_INVALIDARG), so every translated
console compute shader failed there and its dispatches were skipped.

On such an adapter a wave64 compute program now runs as two native
wave32 halves, the same split mesh programs use (xcl_half,
xcl_logical_wave64); a program that needs both halves at once (whole-
wave masks, cross-lane exchange, …) is refused with the same hazard
check. Adapters with wave64 are unchanged.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:07:56 +00:00
github-bot closed this pull request 2026-11-26 04:07:56 +00:00
Author
Owner

@⁠FZNull on GitHub · 2026-11-23 00:51 UTC · original

Validated on native Windows 11 (not Wine/vkd3d-proton): RTX 4060 (Ada, lane range 32..32), MSVC, DXC 1.8.2502.11 from SDK 10.0.26100.

  • base dd713e3 / PR head 1772f1e
  • cargo test --workspace --no-fail-fast: 375 passed, 0 failed, 34 ignored (main: 372), 42.4 s
  • SKIPPED ...: no wave64 stays at 41 on this adapter; the 3 new split-compute tests pass
  • cargo build --workspace: 11.3 s, no warnings from the changed crates

No TDR, no device removal. Nothing from a game package was used.

AI-assisted.

**@⁠FZNull** on GitHub · 2026-11-23 00:51 UTC · [original](https://github.com/xcl-dev/xcl/pull/70#issuecomment-7088693662) Validated on native Windows 11 (not Wine/vkd3d-proton): RTX 4060 (Ada, lane range 32..32), MSVC, DXC 1.8.2502.11 from SDK 10.0.26100. - base `dd713e3` / PR head `1772f1e` - `cargo test --workspace --no-fail-fast`: **375 passed, 0 failed, 34 ignored** (main: 372), 42.4 s - `SKIPPED ...: no wave64` stays at 41 on this adapter; the 3 new split-compute tests pass - `cargo build --workspace`: 11.3 s, no warnings from the changed crates No TDR, no device removal. Nothing from a game package was used. _AI-assisted._
Author
Owner

@⁠certified-retart on GitHub · 2026-11-23 02:15 UTC · original

Verified 1772f1e end-to-end on native Windows 10 (D3D12 Agility SDK 1.620.2 / DXC 10.0.26100.0) on NVIDIA GeForce RTX 5070 (wave32, XCL_ADAPTER=0) combined with PR #78's gpu_compute_e2e test (console_wave64_compute_through_the_pso_hook_dispatch_and_read_back):

  • Without PR #70 (PR #78 alone on RTX 5070): driver rejects the translated wave64 compute PSO with 0x80070057 (E_INVALIDARG).
  • With PR #70 merged: CreateComputePipelineState translates and compiles the console wave64 CS (4376 B DXIL), dispatches through runner::dispatch_on, and passes full readback verification (per-thread IDs, TGID, LDS + s_barrier across both waves) on RTX 5070 in 0.53s (1 passed; 0 failed).
**@⁠certified-retart** on GitHub · 2026-11-23 02:15 UTC · [original](https://github.com/xcl-dev/xcl/pull/70#issuecomment-7089794372) Verified `1772f1e` end-to-end on native Windows 10 (D3D12 Agility SDK 1.620.2 / DXC 10.0.26100.0) on **NVIDIA GeForce RTX 5070 (wave32, `XCL_ADAPTER=0`)** combined with PR #78's `gpu_compute_e2e` test (`console_wave64_compute_through_the_pso_hook_dispatch_and_read_back`): - **Without PR #70** (PR #78 alone on RTX 5070): driver rejects the translated wave64 compute PSO with `0x80070057` (`E_INVALIDARG`). - **With PR #70 merged**: `CreateComputePipelineState` translates and compiles the console wave64 CS (`4376 B DXIL`), dispatches through `runner::dispatch_on`, and passes full readback verification (per-thread IDs, TGID, LDS + `s_barrier` across both waves) on RTX 5070 in **0.53s** (`1 passed; 0 failed`).
Author
Owner

@⁠Foniass on GitHub · 2026-11-23 02:39 UTC · original

Heads-up for the reviewer and @⁠gefydev: #67 solves the same problem (wave64 programs on 32-lane GPUs) another way, and it conflicts with this PR and with #71 / #72. The difference: #67 also runs programs whose halves must exchange values (through groupshared), which this PR still refuses.

I ran both on the same RTX 5070 Ti, merged onto current main; the table and details are in https://github.com/ivall/xcl/pull/67#issuecomment-7090105968. Short version: both pass the whole suite and #78's end-to-end compute test. On NVIDIA, #70 + #72 still skip 18 GPU tests, #67 skips 2. #72's f64 fix applies on top of #67 as well (one line in its test), so it's worth keeping either way.

**@⁠Foniass** on GitHub · 2026-11-23 02:39 UTC · [original](https://github.com/xcl-dev/xcl/pull/70#issuecomment-7090107408) Heads-up for the reviewer and @⁠gefydev: #67 solves the same problem (wave64 programs on 32-lane GPUs) another way, and it conflicts with this PR and with #71 / #72. The difference: #67 also runs programs whose halves must exchange values (through groupshared), which this PR still refuses. I ran both on the same RTX 5070 Ti, merged onto current `main`; the table and details are in https://github.com/ivall/xcl/pull/67#issuecomment-7090105968. Short version: both pass the whole suite and #78's end-to-end compute test. On NVIDIA, #70 + #72 still skip 18 GPU tests, #67 skips 2. #72's f64 fix applies on top of #67 as well (one line in its test), so it's worth keeping either way.
Author
Owner

@⁠ivall on GitHub · 2026-11-23 09:59 UTC · original

Thanks – closing this as superseded by #67 (merged), which runs wave64 compute (and mesh / ES+GS) as two wave32 halves that exchange masks and lane values through groupshared, so programs with cross-half semantics run too instead of being refused. Your lane_id = WaveGetLaneIndex() + 32 * xcl_half / exec-bit case is covered there by its split tests. Also verified on AMD with XCL_SPLIT_WAVE64=1.

**@⁠ivall** on GitHub · 2026-11-23 09:59 UTC · [original](https://github.com/xcl-dev/xcl/pull/70#issuecomment-7097359730) Thanks – closing this as superseded by #67 (merged), which runs wave64 compute (and mesh / ES+GS) as two wave32 halves that exchange masks and lane values through groupshared, so programs with cross-half semantics run too instead of being refused. Your `lane_id = WaveGetLaneIndex() + 32 * xcl_half` / exec-bit case is covered there by its split tests. Also verified on AMD with `XCL_SPLIT_WAVE64=1`.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.