GPU tests: run wave64 kernels as two wave32 halves on 32-lane GPUs #71

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

@⁠gefydev on GitHub · 2026-11-23 00:26 UTC · original
gefydev:recomp-kernel-tests-wave32 → main · +90 −33 · 4 files · 1 commits · closed without merging

On an adapter without 64-lane waves (NVIDIA), 41 GPU tests print SKIPPED …: no wave64. Most of them check instruction semantics that don't depend on the wave size: f64, atomics, images, typed buffers, scalar moves. So on NVIDIA the recompiler's output for those instructions is never run at all.

This PR runs the kernels the same way console mesh programs already run there (#39): as two native wave32 halves of one logical wave64.

  • Options::hw_wave = 32 with a wave64 kernel: [WaveSize(32)], [numthreads(64, 1, 1)], xcl_half = gi >> 5, xcl_logical_wave64 = true, and lane_id / the VGPR slot is WaveGetLaneIndex() + 32 * xcl_half. Each half holds only its own word of a lane mask (the other word is 0) and the same uniform SGPRs, so the first lane of each half InterlockedOrs the SGPRs into the result. The result buffer is a fresh committed resource, so it starts zeroed. A mask then gets both words, and a uniform value stays the same.
  • runner::run_code / run_code_with use that when wave64_supported() is false. They refuse a program geometry_wave32_hazards flags ("needs a 64-lane wave (cross-half semantics: …)"), so a test can't pass on a split that changes its meaning.
  • The 22 tests whose programs pass that check now use gpu_ready_wave32. The others keep gpu_ready. Those are the cross-lane tests (DPP, swizzle, readlane, EXEC/VCC branches), the ones that draw, and the arena/mesh ones.
  • New gpu_kernel_halves_merge_lane_masks: v_cmp over 64 lanes gives vcc = (0xFFFFFFFF, 0xFF) with v0 < 40, and a uniform s_movk stays 0x1234.

Adapters with wave64 are unchanged: hw_wave stays 0, the tests run as before.

gpu_frexp_f64_exp_and_mant fails when split, so it keeps gpu_ready here: v_frexp_mant_f64 with NEG on a NaN keeps the sign. The f64 NEG modifier is emitted as -x, which DXIL compiles as fsub -0.0, x, and IEEE doesn't define the sign of a NaN result there. #72 fixes that on top of this one.

Validation

GTX 1650 (Turing, wave32 only), Windows 11, NVIDIA driver 32.0.16.2114, MSVC debug build, DXC from Windows SDK 10.0.26100:

  • cargo test --workspace (lib, e2e with the test title, console_dlls_e2e, gpu_pso_e2e, …): 0 failed, the same as main on this machine. No test that passes on main fails here.
  • cargo test -p xcl --lib gpu:: one at a time: 19 SKIPPED … no wave64 instead of 41. The 22 tests above ran on the GPU and passed, plus the new one.

Before that I checked each test on the same GPU on Linux (Wine + vkd3d-proton 2.14.1). There global_atomic_inc_x2 / dec_x2 hang in gpu_more_atomics_sub_dword_scratch_valu, even with one lane. On Windows they finish in ~60 ms with the right values, so that one is vkd3d's DXIL → SPIR-V, not the HLSL.

**@⁠gefydev** on GitHub · 2026-11-23 00:26 UTC · [original](https://github.com/xcl-dev/xcl/pull/71) `gefydev:recomp-kernel-tests-wave32` → `main` · +90 −33 · 4 files · 1 commits · closed without merging On an adapter without 64-lane waves (NVIDIA), 41 GPU tests print `SKIPPED …: no wave64`. Most of them check instruction semantics that don't depend on the wave size: f64, atomics, images, typed buffers, scalar moves. So on NVIDIA the recompiler's output for those instructions is never run at all. This PR runs the kernels the same way console mesh programs already run there (#39): as two native wave32 halves of one logical wave64. - `Options::hw_wave = 32` with a wave64 kernel: `[WaveSize(32)]`, `[numthreads(64, 1, 1)]`, `xcl_half = gi >> 5`, `xcl_logical_wave64 = true`, and `lane_id` / the VGPR slot is `WaveGetLaneIndex() + 32 * xcl_half`. Each half holds only its own word of a lane mask (the other word is 0) and the same uniform SGPRs, so the first lane of each half `InterlockedOr`s the SGPRs into the result. The result buffer is a fresh committed resource, so it starts zeroed. A mask then gets both words, and a uniform value stays the same. - `runner::run_code` / `run_code_with` use that when `wave64_supported()` is false. They refuse a program `geometry_wave32_hazards` flags ("needs a 64-lane wave (cross-half semantics: …)"), so a test can't pass on a split that changes its meaning. - The 22 tests whose programs pass that check now use `gpu_ready_wave32`. The others keep `gpu_ready`. Those are the cross-lane tests (DPP, swizzle, readlane, EXEC/VCC branches), the ones that draw, and the arena/mesh ones. - New `gpu_kernel_halves_merge_lane_masks`: `v_cmp` over 64 lanes gives `vcc = (0xFFFFFFFF, 0xFF)` with `v0 < 40`, and a uniform `s_movk` stays `0x1234`. Adapters with wave64 are unchanged: `hw_wave` stays 0, the tests run as before. `gpu_frexp_f64_exp_and_mant` fails when split, so it keeps `gpu_ready` here: `v_frexp_mant_f64` with NEG on a NaN keeps the sign. The f64 NEG modifier is emitted as `-x`, which DXIL compiles as `fsub -0.0, x`, and IEEE doesn't define the sign of a NaN result there. #72 fixes that on top of this one. ## Validation GTX 1650 (Turing, wave32 only), Windows 11, NVIDIA driver 32.0.16.2114, MSVC debug build, DXC from Windows SDK 10.0.26100: - `cargo test --workspace` (lib, e2e with the test title, console_dlls_e2e, gpu_pso_e2e, …): 0 failed, the same as `main` on this machine. No test that passes on `main` fails here. - `cargo test -p xcl --lib gpu::` one at a time: 19 `SKIPPED … no wave64` instead of 41. The 22 tests above ran on the GPU and passed, plus the new one. Before that I checked each test on the same GPU on Linux (Wine + vkd3d-proton 2.14.1). There `global_atomic_inc_x2` / `dec_x2` hang in `gpu_more_atomics_sub_dword_scratch_valu`, even with one lane. On Windows they finish in ~60 ms with the right values, so that one is vkd3d's DXIL → SPIR-V, not the HLSL.
On an adapter without 64-lane waves (NVIDIA) every kernel test that
needs wave64 was skipped: 41 of them, most of which check instruction
semantics that do not depend on the wave size (f64, atomics, images,
typed buffers, scalar moves).

Options::hw_wave = 32 now runs a wave64 kernel as two native wave32
halves, as console mesh programs do there: lane_id covers both halves,
each half ORs its SGPRs into the zeroed result, so a lane mask gets
both words and a uniform value stays the same. runner::run_code and
run_code_with use it on such an adapter, and refuse a program that
needs both halves at once (geometry_wave32_hazards). The 22 tests
whose programs pass that check switch to gpu_ready_wave32.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:07:58 +00:00
github-bot closed this pull request 2026-11-26 04:07:58 +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 a7a2074 (this PR includes #71)
  • cargo test --workspace --no-fail-fast: 372 -> 373 passed, 0 failed, 34 ignored
  • SKIPPED ...: no wave64 drops from 41 to 19, so 22 GPU tests that never ran on this adapter now run and pass
  • cargo test -p xcl --lib: 343 -> 344 passed

No TDR, no device removal; mesh and e2e tests unaffected. 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/71#issuecomment-7088693903) 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 `a7a2074` (this PR includes #71) - `cargo test --workspace --no-fail-fast`: **372 -> 373 passed, 0 failed, 34 ignored** - `SKIPPED ...: no wave64` drops from **41 to 19**, so 22 GPU tests that never ran on this adapter now run and pass - `cargo test -p xcl --lib`: 343 -> 344 passed No TDR, no device removal; mesh and e2e tests unaffected. Nothing from a game package was used. _AI-assisted._
Author
Owner

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

Tested a81bb28 locally on Windows 10 (with D3D12 Agility SDK 1.620.2 / DXC 10.0.26100.0) across both a wave32 NVIDIA GPU and a wave64 AMD GPU:

  • NVIDIA GeForce RTX 5070 (wave32, XCL_ADAPTER=0):
    • cargo test -p xcl --lib gpu::recomp::tests::gpu_ -- --test-threads=1 --nocapture
    • 24 GPU kernel tests executed and passed (0 failures, 3.53s), including gpu_kernel_halves_merge_lane_masks, gpu_atomic_fcmpswap_x2, gpu_atomic_fmin_fmax_*, gpu_bvh_intersect_ray, gpu_f64_class_compare, gpu_rndne_f64, gpu_global_atomics_and_sub_dword_access, gpu_more_atomics_sub_dword_scratch_valu, gpu_images_*, gpu_typed_buffer_loads_and_stores, gpu_valu_*, gpu_v_swaprel_b32, gpu_dword_addtid_per_lane_addresses, etc.
    • 18 genuinely wave64-only tests skipped with no wave64 as expected (plus gpu_retail_vs_blit_gen_amb_cube without XCL_SAMPLE_RPF and ignored gpu_arena_partial_commit_probe).
  • AMD Radeon Graphics (Ryzen 7 9800X3D iGPU, wave64, XCL_ADAPTER=1, XCL_REQUIRE_GPU=wave64):
    • 43 passed, 0 failed, 1 ignored (2.13s) — zero regressions on wave64 hardware.
**@⁠certified-retart** on GitHub · 2026-11-23 02:14 UTC · [original](https://github.com/xcl-dev/xcl/pull/71#issuecomment-7089777682) Tested `a81bb28` locally on Windows 10 (with D3D12 Agility SDK 1.620.2 / DXC 10.0.26100.0) across both a wave32 NVIDIA GPU and a wave64 AMD GPU: - **NVIDIA GeForce RTX 5070 (wave32, `XCL_ADAPTER=0`)**: - `cargo test -p xcl --lib gpu::recomp::tests::gpu_ -- --test-threads=1 --nocapture` - **24 GPU kernel tests executed and passed** (0 failures, 3.53s), including `gpu_kernel_halves_merge_lane_masks`, `gpu_atomic_fcmpswap_x2`, `gpu_atomic_fmin_fmax_*`, `gpu_bvh_intersect_ray`, `gpu_f64_class_compare`, `gpu_rndne_f64`, `gpu_global_atomics_and_sub_dword_access`, `gpu_more_atomics_sub_dword_scratch_valu`, `gpu_images_*`, `gpu_typed_buffer_loads_and_stores`, `gpu_valu_*`, `gpu_v_swaprel_b32`, `gpu_dword_addtid_per_lane_addresses`, etc. - 18 genuinely wave64-only tests skipped with `no wave64` as expected (plus `gpu_retail_vs_blit_gen_amb_cube` without `XCL_SAMPLE_RPF` and ignored `gpu_arena_partial_commit_probe`). - **AMD Radeon Graphics (Ryzen 7 9800X3D iGPU, wave64, `XCL_ADAPTER=1`, `XCL_REQUIRE_GPU=wave64`)**: - **43 passed, 0 failed, 1 ignored** (2.13s) — zero regressions on wave64 hardware.
Author
Owner

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

Same overlap as on #70: #67 also runs the GPU test kernels on 32-lane GPUs (2 tests left SKIPPED on an RTX 5070 Ti, against 18 with this PR), and the two conflict in emit.rs and runner.rs. Side-by-side results: https://github.com/ivall/xcl/pull/67#issuecomment-7090105968. The f64 fix in #72 applies on top of #67 too, with gpu_ready_wave32 → gpu_ready in its test.

**@⁠Foniass** on GitHub · 2026-11-23 02:39 UTC · [original](https://github.com/xcl-dev/xcl/pull/71#issuecomment-7090107640) Same overlap as on #70: #67 also runs the GPU test kernels on 32-lane GPUs (2 tests left `SKIPPED` on an RTX 5070 Ti, against 18 with this PR), and the two conflict in `emit.rs` and `runner.rs`. Side-by-side results: https://github.com/ivall/xcl/pull/67#issuecomment-7090105968. The f64 fix in #72 applies on top of #67 too, with `gpu_ready_wave32` → `gpu_ready` in its test.
Author
Owner

@⁠ivall on GitHub · 2026-11-23 10:21 UTC · original

Thanks – closing as superseded by #67 (merged), which runs wave64 kernels / compute / mesh / ES+GS on 32-lane GPUs as two wave32 halves that exchange masks and lane values, so the cross-lane tests run there too (2 skips left on an RTX 5070 Ti vs 18–19 with this approach). The f64 sign-bit fix from #72 is on main (c2887bb).

**@⁠ivall** on GitHub · 2026-11-23 10:21 UTC · [original](https://github.com/xcl-dev/xcl/pull/71#issuecomment-7097813785) Thanks – closing as superseded by #67 (merged), which runs wave64 kernels / compute / mesh / ES+GS on 32-lane GPUs as two wave32 halves that exchange masks and lane values, so the cross-lane tests run there too (2 skips left on an RTX 5070 Ti vs 18–19 with this approach). The f64 sign-bit fix from #72 is on `main` (c2887bb).

Pull request closed

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