Direct DXIL: TG_SIZE counts a partial last wave #1950

Manually merged
github merged 2 commits from gh-pr/1950/head into gh-pr/1950/base 2026-11-26 05:11:13 +00:00
Owner

@⁠upipibi on GitHub · 2026-11-24 23:49 UTC · original
upipibi:fix/direct-tg-size-partial-wave → main · +7 −5 · 2 files · 2 commits · merged 2026-11-25 00:49 UTC

The direct DXIL translator sets TG_SIZE's wave count to threads / lanes. A compute group that is not a whole number of waves therefore reads one wave too few. 96 threads in wave64 give 1 where the console, and the HLSL path, give 2. Found by running #1934's XCL_DXIL_DIFF=1 mode (comment there): HLSL and direct differed in all 96 stored words of gpu_compute_tg_size_counts_a_partial_last_wave.

What is in it

  • crates/xcl/src/gpu/dxil/kernel.rs: the wave count is total.div_ceil(lanes), and TRANSLATOR_VERSION goes from 7 to 8 so cached kernels pick up the change. #1946 and #1952 also bump it to 8, so whichever merges later takes the next number.
  • crates/xcl/src/gpu/recomp/tests.rs: gpu_compute_tg_size_counts_a_partial_last_wave builds its kernel through direct_or, so with XCL_DIRECT_DXIL=1 it runs the direct translator. Until now it compiled only the HLSL path. The test's expectations are unchanged.

Tested
NVIDIA GeForce RTX 3070 8 GB (32-lane waves, split wave64), driver 616.56; Windows 11 Pro 26100; Rust 1.100.0 MSVC; debug; on main 95ae589.

  • gpu_compute_tg_size_counts_a_partial_last_wave: passes with and without XCL_DIRECT_DXIL=1. With the kernel.rs line reverted and XCL_DIRECT_DXIL=1 it fails: left: 1, 96 threads, wave64, thread 0.
  • XCL_DIRECT_DXIL=1 cargo test -p xcl --lib -- gpu_ --skip gpu_sparse_vram --test-threads=4: 110 passed, 0 failed, 1 ignored (the same as main). The sparse test was skipped because of #1727.
  • cargo test -p xcl --lib -- gpu::dxil --test-threads=4: 101 passed, 0 failed, 3 ignored.

Regression run
The change is one constant in the direct translator's compute prologue; the HLSL path is unchanged. Run by eizispark on an AMD Radeon RX 9070 XT (RDNA4), 60 s, main 20cf130 and this head 415fc5e (their report is in the comments):

xcl-smoke v1
commit: 20cf13022f764208384c610c2ae6a3f4eed201a2
gpu: AMD Radeon RX 9070 XT
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1678 (PresentX 1678)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14859 MB
xcl-smoke v1
commit: 415fc5ef4307ccbdf1cb91c45bb1db5c0deba1e6
gpu: AMD Radeon RX 9070 XT
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1678 (PresentX 1678)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14861 MB

main:

PR:

Not tested

  • AMD, native wave64, Wine.

AI use

  • Claude Code (Claude Opus 5.5) found the difference with #1934's differential mode, traced it, wrote the change and ran the tests.

🤖 Generated with Claude Code

**@⁠upipibi** on GitHub · 2026-11-24 23:49 UTC · [original](https://github.com/xcl-dev/xcl/pull/1950) `upipibi:fix/direct-tg-size-partial-wave` → `main` · +7 −5 · 2 files · 2 commits · merged 2026-11-25 00:49 UTC The direct DXIL translator sets TG_SIZE's wave count to `threads / lanes`. A compute group that is not a whole number of waves therefore reads one wave too few. 96 threads in wave64 give 1 where the console, and the HLSL path, give 2. Found by running #1934's `XCL_DXIL_DIFF=1` mode (comment there): HLSL and direct differed in all 96 stored words of `gpu_compute_tg_size_counts_a_partial_last_wave`. **What is in it** - `crates/xcl/src/gpu/dxil/kernel.rs`: the wave count is `total.div_ceil(lanes)`, and `TRANSLATOR_VERSION` goes from 7 to 8 so cached kernels pick up the change. #1946 and #1952 also bump it to 8, so whichever merges later takes the next number. - `crates/xcl/src/gpu/recomp/tests.rs`: `gpu_compute_tg_size_counts_a_partial_last_wave` builds its kernel through `direct_or`, so with `XCL_DIRECT_DXIL=1` it runs the direct translator. Until now it compiled only the HLSL path. The test's expectations are unchanged. **Tested** NVIDIA GeForce RTX 3070 8 GB (32-lane waves, split wave64), driver 616.56; Windows 11 Pro 26100; Rust 1.100.0 MSVC; debug; on `main` `95ae589`. - `gpu_compute_tg_size_counts_a_partial_last_wave`: passes with and without `XCL_DIRECT_DXIL=1`. With the `kernel.rs` line reverted and `XCL_DIRECT_DXIL=1` it fails: `left: 1`, 96 threads, wave64, thread 0. - `XCL_DIRECT_DXIL=1 cargo test -p xcl --lib -- gpu_ --skip gpu_sparse_vram --test-threads=4`: 110 passed, 0 failed, 1 ignored (the same as `main`). The sparse test was skipped because of #1727. - `cargo test -p xcl --lib -- gpu::dxil --test-threads=4`: 101 passed, 0 failed, 3 ignored. **Regression run** The change is one constant in the direct translator's compute prologue; the HLSL path is unchanged. Run by eizispark on an AMD Radeon RX 9070 XT (RDNA4), 60 s, `main` `20cf130` and this head `415fc5e` (their report is in the comments): ``` xcl-smoke v1 commit: 20cf13022f764208384c610c2ae6a3f4eed201a2 gpu: AMD Radeon RX 9070 XT title: 9cc6a39e seconds: 60 exit: 0x0 frames shown: 1678 (PresentX 1678) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14859 MB ``` ``` xcl-smoke v1 commit: 415fc5ef4307ccbdf1cb91c45bb1db5c0deba1e6 gpu: AMD Radeon RX 9070 XT title: 9cc6a39e seconds: 60 exit: 0x0 frames shown: 1678 (PresentX 1678) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14861 MB ``` main: PR: **Not tested** - AMD, native wave64, Wine. **AI use** - Claude Code (Claude Opus 5.5) found the difference with #1934's differential mode, traced it, wrote the change and ran the tests. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The direct translator set TG_SIZE's wave count to threads / lanes, so a
group of 96 threads in wave64 read 1 wave where the console (and the HLSL
path) give 2. It is now threads.div_ceil(lanes). The existing test
gpu_compute_tg_size_counts_a_partial_last_wave now runs through
direct_or, so XCL_DIRECT_DXIL=1 covers this path; it fails without the
fix (left: 1, right: 2 for 96 threads in wave64).

Found with #1934's XCL_DXIL_DIFF=1.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:11:12 +00:00
github manually merged commit 415fc5ef43 into gh-pr/1950/base 2026-11-26 05:11:13 +00:00
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-24 23:58 UTC · original · edited 2026-11-25 00:05 UTC

Full-suite run, since this PR has no test report yet. Tested exact head 415fc5e (on its base 95ae589).

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 -- --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::dxil::fuzz_tests: 975 passed, 0 failed, 43 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, 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.
  • No new #[test] functions in the diff.
  • Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 984 passed, 0 failed, 45 ignored. SKIPPED: f16_programs_on_the_gpu (f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #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 #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 #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 #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 #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 62265d3 too, not because of this PR. On NVIDIA: heap_window_out_of_memory_falls_back_to_the_switch_form (#1651) and the four gpu::recomp::lower_dxil::tests::*_programs_on_the_gpu tests (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.
**@⁠futurepro62** on GitHub · 2026-11-24 23:58 UTC · [original](https://github.com/xcl-dev/xcl/pull/1950#issuecomment-7148000059) · edited 2026-11-25 00:05 UTC Full-suite run, since this PR has no test report yet. Tested exact head `415fc5e` (on its base `95ae589`). **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 -- --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::dxil::fuzz_tests`: **975 passed, 0 failed, 43 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`, `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`. - No new `#[test]` functions in the diff. - Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, `XCL_ADAPTER=radeon`), `cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1`: **984 passed, 0 failed, 45 ignored**. SKIPPED: `f16_programs_on_the_gpu` (f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), `f16_programs_on_the_gpu` (f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #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 #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 #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 #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 #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 `62265d3` too, not because of this PR. On NVIDIA: `heap_window_out_of_memory_falls_back_to_the_switch_form` (#1651) and the four `gpu::recomp::lower_dxil::tests::*_programs_on_the_gpu` tests ([follow-up on #1651](https://git.gtahub.st/github/xcl-dev--xcl/issues/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.
Author
Owner

@⁠eizispark on GitHub · 2026-11-25 00:25 UTC · original

Hardware test report — commit 415fc5e

@⁠upipibi Verified 415fc5ef4307ccbdf1cb91c45bb1db5c0deba1e6 on AMD Radeon RX 9070 XT (RDNA4, native wave32 + wave64): pass, including the XCL_DIRECT_DXIL=1 native wave64 path and the xcl-smoke pair against ancestor main (20cf130).

Tested

  • Hardware: Windows 11 x64, AMD Ryzen 7 9800X3D, AMD Radeon RX 9070 XT (RDNA4, native wave32 + wave64, driver 32.0.32015.16001), 32 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09), debug tests + release smoke
  • Native RDNA4 wave64 + Direct DXIL targeted checks:
    • cargo test -p xcl --lib gpu_compute_tg_size_counts_a_partial_last_wave -- --nocapture --test-threads=1 (XCL_DIRECT_DXIL unset, HLSL path): 1 passed, 0 failed, 0 skipped
    • XCL_DIRECT_DXIL=1 cargo test -p xcl --lib gpu_compute_tg_size_counts_a_partial_last_wave -- --nocapture --test-threads=1 (translate_compute with KernelOptions { wave64: true, split: false, .. } for (96, true), (64, true), (128, true) on 64-lane hardware waves, plus (96, false) and (40, false) on 32-lane waves): 1 passed, 0 failed, 0 skipped
  • Unfiltered cargo test --workspace --no-fail-fast -- --test-threads=4: 983 passed, 2 failed, 45 ignored (8 skipped), with 0 new failures:
    • Only the 2 pre-existing #1679 AMD fuzz seeds failed (gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 seed 722, gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_3 seed 1599)
    • 8 skipped: 6 gpu::recomp::lower_dxil::tests f16/f32 direct-DXIL per-lane cases refused where #1426 semantics differ from the console's; shaders::tests::pso_measurement_compiles_an_exact_synthetic_record (Windows Developer Mode required, 0x887A002D); heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows

Regression run (scripts/smoke.ps1, 60 s, warm shader/driver cache; first post-TRANSLATOR_VERSION = 8 cache-rebuild pass also exited 0x0 with 1614 frames, 60 60 60, 0 removals, 0 crashes, 14859 MB)
main (20cf13022f764208384c610c2ae6a3f4eed201a2):

xcl-smoke v1
commit: 20cf13022f764208384c610c2ae6a3f4eed201a2
gpu: AMD Radeon RX 9070 XT
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1678 (PresentX 1678)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14859 MB

PR (415fc5ef4307ccbdf1cb91c45bb1db5c0deba1e6):

xcl-smoke v1
commit: 415fc5ef4307ccbdf1cb91c45bb1db5c0deba1e6
gpu: AMD Radeon RX 9070 XT
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1678 (PresentX 1678)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14861 MB

Not tested

  • Wine; retail run with XCL_DIRECT_DXIL=1 enabled

AI use

  • Antigravity (Google DeepMind, Gemini 4 Carbon) ran the native wave64 Direct DXIL test, workspace test suite, and 60-second retail smoke check and formatted this report.
**@⁠eizispark** on GitHub · 2026-11-25 00:25 UTC · [original](https://github.com/xcl-dev/xcl/pull/1950#issuecomment-7148486827) ### Hardware test report — commit `415fc5e` @⁠upipibi Verified `415fc5ef4307ccbdf1cb91c45bb1db5c0deba1e6` on AMD Radeon RX 9070 XT (RDNA4, native wave32 + wave64): **pass**, including the `XCL_DIRECT_DXIL=1` native wave64 path and the `xcl-smoke` pair against ancestor `main` (`20cf130`). **Tested** - Hardware: Windows 11 x64, AMD Ryzen 7 9800X3D, AMD Radeon RX 9070 XT (RDNA4, native wave32 + wave64, driver `32.0.32015.16001`), 32 GB RAM, `rustc 1.100.0 (0ef1bc386 2026-11-09)`, debug tests + release smoke - Native RDNA4 wave64 + Direct DXIL targeted checks: - `cargo test -p xcl --lib gpu_compute_tg_size_counts_a_partial_last_wave -- --nocapture --test-threads=1` (`XCL_DIRECT_DXIL` unset, HLSL path): `1 passed, 0 failed, 0 skipped` - `XCL_DIRECT_DXIL=1 cargo test -p xcl --lib gpu_compute_tg_size_counts_a_partial_last_wave -- --nocapture --test-threads=1` (`translate_compute` with `KernelOptions { wave64: true, split: false, .. }` for `(96, true)`, `(64, true)`, `(128, true)` on 64-lane hardware waves, plus `(96, false)` and `(40, false)` on 32-lane waves): `1 passed, 0 failed, 0 skipped` - Unfiltered `cargo test --workspace --no-fail-fast -- --test-threads=4`: `983 passed, 2 failed, 45 ignored` (`8 skipped`), with `0` new failures: - Only the 2 pre-existing `#1679` AMD fuzz seeds failed (`gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1` seed 722, `gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_3` seed 1599) - `8 skipped`: 6 `gpu::recomp::lower_dxil::tests` f16/f32 direct-DXIL per-lane cases refused where `#1426` semantics differ from the console's; `shaders::tests::pso_measurement_compiles_an_exact_synthetic_record` (`Windows Developer Mode required`, `0x887A002D`); `heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows` **Regression run** (`scripts/smoke.ps1`, 60 s, warm shader/driver cache; first post-`TRANSLATOR_VERSION = 8` cache-rebuild pass also exited `0x0` with `1614` frames, `60 60 60`, `0` removals, `0` crashes, `14859 MB`) `main` (`20cf13022f764208384c610c2ae6a3f4eed201a2`): ``` xcl-smoke v1 commit: 20cf13022f764208384c610c2ae6a3f4eed201a2 gpu: AMD Radeon RX 9070 XT title: 9cc6a39e seconds: 60 exit: 0x0 frames shown: 1678 (PresentX 1678) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14859 MB ``` PR (`415fc5ef4307ccbdf1cb91c45bb1db5c0deba1e6`): ``` xcl-smoke v1 commit: 415fc5ef4307ccbdf1cb91c45bb1db5c0deba1e6 gpu: AMD Radeon RX 9070 XT title: 9cc6a39e seconds: 60 exit: 0x0 frames shown: 1678 (PresentX 1678) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14861 MB ``` **Not tested** - Wine; retail run with `XCL_DIRECT_DXIL=1` enabled **AI use** - Antigravity (Google DeepMind, Gemini 4 Carbon) ran the native wave64 Direct DXIL test, workspace test suite, and 60-second retail smoke check and formatted this report.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 02:50 UTC · original

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

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-25 02:50 UTC · [original](https://github.com/xcl-dev/xcl/pull/1950#issuecomment-7151258018) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
This discussion has been locked. Commenting is limited to contributors.
No description provided.