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

Closed
gefydev wants to merge 1 commit from upstream-pr/71 into main
gefydev commented 2026-11-23 00:26:13 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by gefydev on 2026-11-23T00:26:13Z.


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.

<!-- greyfinch-sync:ivall/xcl:issue:6549773411 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/71). Originally posted by [gefydev](https://github.com/gefydev) on 2026-11-23T00:26:13Z. --- 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.
upstream-sync closed this pull request 2026-11-24 06:57:01 +00:00
FZNull commented 2026-11-24 07:00:21 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by FZNull on 2026-11-23T00:51:54Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7088693903 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/71#issuecomment-7088693903). Originally posted by [FZNull](https://github.com/FZNull) on 2026-11-23T00:51:54Z. --- 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._
certified-retart commented 2026-11-24 07:00:22 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by certified-retart on 2026-11-23T02:14:31Z.


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.
<!-- greyfinch-sync:ivall/xcl:comment:7089777682 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/71#issuecomment-7089777682). Originally posted by [certified-retart](https://github.com/certified-retart) on 2026-11-23T02:14:31Z. --- 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.
Foniass commented 2026-11-24 07:00:22 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-11-23T02:39:17Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7090107640 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/71#issuecomment-7090107640). Originally posted by [Foniass](https://github.com/Foniass) on 2026-11-23T02:39:17Z. --- 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.
ivall commented 2026-11-24 07:00:26 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ivall on 2026-11-23T10:21:01Z.


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).

<!-- greyfinch-sync:ivall/xcl:comment:7097813785 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/71#issuecomment-7097813785). Originally posted by [ivall](https://github.com/ivall) on 2026-11-23T10:21:01Z. --- 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

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!70
No description provided.