Skip to content

Direct DXIL: TG_SIZE counts a partial last wave - #1950

Merged
raylitebull merged 2 commits into
xcl-dev:mainfrom
upipibi:fix/direct-tg-size-partial-wave
Nov 25, 2026
Merged

raylitebull merged 2 commits into
xcl-dev:mainfrom
upipibi:fix/direct-tg-size-partial-wave

Conversation

@upipibi

@upipibi upipibi commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

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. Direct DXIL: lower i64 min/max as compare/select #1946 and Direct DXIL: fix compute init and metadata #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.

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

🤖 Generated with Claude Code

upipibi and others added 2 commits November 24, 2026 17:48
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 xcl-dev#1934's XCL_DXIL_DIFF=1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…IZE change

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@futurepro62

futurepro62 commented Nov 24, 2026 •

Copy link
Copy Markdown

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

@eizispark

Copy link
Copy Markdown

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.

@raylitebull
raylitebull merged commit 7994cd1 into xcl-dev:main Nov 25, 2026
2 of 5 checks passed
anoyarou added a commit to anoyarou/xcl that referenced this pull request Nov 25, 2026
Brings main to full parity with upstream/main (7994cd1):
- xcl-dev#1950: Direct DXIL TG_SIZE counts a partial last wave (TRANSLATOR_VERSION 8)

Assisted-by: Antigravity (Gemini 4)
@DavidM1911

Copy link
Copy Markdown
Contributor

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

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants