Recompiler: 2-D and 3-D compute groups take the direct DXIL route again #3189

Closed
Royalflamejlh wants to merge 1 commit from upstream-pr/3189 into main
Royalflamejlh commented 2026-11-28 17:16:15 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-11-28T17:16:15Z.


d9403543 sends every compute program with a 2-D or 3-D thread group to the HLSL path ("multidimensional groups need the HLSL console-linear thread reorder"). The direct translator has had that reorder since 746f7ddc: Lw::setup_lanes_compute (gpu/dxil/lanes.rs) hands each hardware wave the next console threads through a groupshared counter, as the HLSL entry's XCL_WT block does, and the split wave64 form numbers its threads as xcl_x_thread does. So the rule only keeps these programs off the direct route. Under Wine + vkd3d-proton, single driver builds of their HLSL-path DXIL from a retail title reached 43.8 and 45.9 GB and stopped every launch pass on our 62 GB Linux machine (4 runs).

This removes the rule. pso.rs is outside the translator source hash, so TRANSLATION_GLUE_REVISION goes to pso-glue-v5; without it the translated-shader cache keeps serving the HLSL translations of these programs (one of our runs reused all 26,503 cached records in 10 s and built them again).

It adds to #3154: most of these programs then hit the DispatchX prologue's "instruction after a terminator" that #3154 fixes (with both, 556 of the title's 751 multidimensional compute programs translate directly in the split wave64 form, 655 in the native form; 238 and 273 with this alone).

What is in it

  • crates/xcl/src/gpu/recomp/pso.rs: direct_compute_needs_hlsl, its call and its test removed.
  • crates/xcl/build.rs: TRANSLATION_GLUE_REVISION = pso-glue-v5.
  • crates/xcl/src/gpu/recomp/tests.rs: direct_compute_translates_2d_and_3d_groups (8x8x1 and 4x4x4 through pso::direct_compute as wave32, wave64 and split wave64, validated under test; fails with the rule) and gpu_direct_compute_waves_take_consecutive_threads_of_2d_and_3d_groups (each lane holds the console's consecutive threads: lane = t % lanes and v_readfirstlane = t − lane, for 8x8x1, 4x4x4 and 8x8x4).

Tested

  • Linux, Wine 11.21 Staging, no GPU (lavapipe), Rust 1.98.0, release, x86_64-pc-windows-gnu: cargo test -p xcl --lib -- recomp:: gpu::dxil --test-threads=4: 654 passed, 1 failed, 23 ignored (main db3921dc: 653 / 1 / 23; the failure is gpu::dxil::round_tests::directed_reference_basics on both); about 351 GPU tests SKIPPED ("no GPU").
  • Windows, RTX 2070 SUPER, at f12eb2fd (this commit before a rebase onto 10d27297, same tree): the two new tests, gpu_compute_mode_dispatch_abi, gpu_split_wave64_waves_diverge and a_per_lane_2d_or_3d_group_runs_on_the_gpu: 5 passed (the last SKIPPED: no wave64). With the reorder disabled on purpose, the GPU test failed at 8x8x1 wave32 (thread 2 on lane 4), so the driver does pack 2-D groups out of order and the test catches it.
  • xcl shaders <pack> --direct --sample 0 --validate, a retail title's 1,636 compute programs: 708 translated in the split wave64 form and 801 in the native form, 0 validator failures and 0 panics; this survey does not go through pso.rs, so it is the same before and after.

Regression run

  • not made yet: scripts/smoke.ps1 on main and on this head.

Not tested

  • AMD / native wave64 on a GPU; the whole suite on a GPU; scripts/smoke.ps1; a title run with this change alone (our Linux branch carries the same removal); the driver memory of the direct builds.

AI use

  • Claude Code (Claude Opus 5.5) found the cause, wrote the change and the tests, ran them and wrote this description.
<!-- greyfinch-sync:ivall/xcl:issue:5542691087 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3189). Originally posted by [Royalflamejlh](https://github.com/Royalflamejlh) on 2026-11-28T17:16:15Z. --- `d9403543` sends every compute program with a 2-D or 3-D thread group to the HLSL path ("multidimensional groups need the HLSL console-linear thread reorder"). The direct translator has had that reorder since `746f7ddc`: `Lw::setup_lanes_compute` (`gpu/dxil/lanes.rs`) hands each hardware wave the next console threads through a groupshared counter, as the HLSL entry's `XCL_WT` block does, and the split wave64 form numbers its threads as `xcl_x_thread` does. So the rule only keeps these programs off the direct route. Under Wine + vkd3d-proton, single driver builds of their HLSL-path DXIL from a retail title reached 43.8 and 45.9 GB and stopped every launch pass on our 62 GB Linux machine (4 runs). This removes the rule. `pso.rs` is outside the translator source hash, so `TRANSLATION_GLUE_REVISION` goes to `pso-glue-v5`; without it the translated-shader cache keeps serving the HLSL translations of these programs (one of our runs reused all 26,503 cached records in 10 s and built them again). It adds to #3154: most of these programs then hit the DispatchX prologue's "instruction after a terminator" that #3154 fixes (with both, 556 of the title's 751 multidimensional compute programs translate directly in the split wave64 form, 655 in the native form; 238 and 273 with this alone). **What is in it** - `crates/xcl/src/gpu/recomp/pso.rs`: `direct_compute_needs_hlsl`, its call and its test removed. - `crates/xcl/build.rs`: `TRANSLATION_GLUE_REVISION` = `pso-glue-v5`. - `crates/xcl/src/gpu/recomp/tests.rs`: `direct_compute_translates_2d_and_3d_groups` (8x8x1 and 4x4x4 through `pso::direct_compute` as wave32, wave64 and split wave64, validated under test; fails with the rule) and `gpu_direct_compute_waves_take_consecutive_threads_of_2d_and_3d_groups` (each lane holds the console's consecutive threads: lane = t % lanes and `v_readfirstlane` = t − lane, for 8x8x1, 4x4x4 and 8x8x4). **Tested** - Linux, Wine 11.21 Staging, no GPU (lavapipe), Rust 1.98.0, release, `x86_64-pc-windows-gnu`: `cargo test -p xcl --lib -- recomp:: gpu::dxil --test-threads=4`: 654 passed, 1 failed, 23 ignored (`main` `db3921dc`: 653 / 1 / 23; the failure is `gpu::dxil::round_tests::directed_reference_basics` on both); about 351 GPU tests SKIPPED ("no GPU"). - Windows, RTX 2070 SUPER, at `f12eb2fd` (this commit before a rebase onto `10d27297`, same tree): the two new tests, `gpu_compute_mode_dispatch_abi`, `gpu_split_wave64_waves_diverge` and `a_per_lane_2d_or_3d_group_runs_on_the_gpu`: 5 passed (the last SKIPPED: no wave64). With the reorder disabled on purpose, the GPU test failed at 8x8x1 wave32 (thread 2 on lane 4), so the driver does pack 2-D groups out of order and the test catches it. - `xcl shaders <pack> --direct --sample 0 --validate`, a retail title's 1,636 compute programs: 708 translated in the split wave64 form and 801 in the native form, 0 validator failures and 0 panics; this survey does not go through `pso.rs`, so it is the same before and after. **Regression run** - not made yet: `scripts/smoke.ps1` on `main` and on this head. **Not tested** - AMD / native wave64 on a GPU; the whole suite on a GPU; `scripts/smoke.ps1`; a title run with this change alone (our Linux branch carries the same removal); the driver memory of the direct builds. **AI use** - Claude Code (Claude Opus 5.5) found the cause, wrote the change and the tests, ran them and wrote this description.
fromthemoonx commented 2026-11-28 18:10:31 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-11-28T18:10:31Z.


Whole suite on a GPU (listed under Not tested): passes on NVIDIA. With the native-wave reorder disabled, the new GPU test fails here as it did on your RTX 2070 SUPER.

Tested: f4e0ab9 (its base is current main 10d2729, so head = merged). RTX 3060 12 GB (driver 610.88, wave32 only), Ryzen 7 5700X, Windows 11 Pro 26300, Rust 1.100.0 MSVC, debug.

result
cargo test --workspace --no-fail-fast -- --test-threads=4 2153 passed, 0 failed, 48 ignored; 25 SKIPPED lines (no wave64, refused per-lane f16/f32 forms, heap_window_out_of_memory_falls_back_to_the_switch_form). main 10d2729 here: 2152 passed, 0 failed, 48 ignored
direct_compute_translates_2d_and_3d_groups, gpu_direct_compute_waves_take_consecutive_threads_of_2d_and_3d_groups alone 3 of 3 each; the GPU test ran (no SKIPPED)
scratch: the y * z > 1 branch in setup_lanes_compute (lanes.rs) disabled, so 2-D / 3-D groups in native waves use flattenedThreadIdInGroup the GPU test fails 3 of 3: [8, 8, 1] wave64 false: thread 2 (lane, the wave's first thread), left: (4, 0)

So this driver also forms 2-D waves out of console order, and the test catches it on wave32. The split-wave64 cases ran in their split form (no native wave64 here).

Not tested: native wave64 (AMD), scripts/smoke.ps1 / a title, a release build.

AI use: Claude Code (Claude Opus 5.5) ran the tests and the scratch mutation and wrote this report.

<!-- greyfinch-sync:ivall/xcl:comment:7243587842 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3189#issuecomment-7243587842). Originally posted by [fromthemoonx](https://github.com/fromthemoonx) on 2026-11-28T18:10:31Z. --- **Whole suite on a GPU (listed under Not tested): passes on NVIDIA. With the native-wave reorder disabled, the new GPU test fails here as it did on your RTX 2070 SUPER.** **Tested:** `f4e0ab9` (its base is current `main` `10d2729`, so head = merged). RTX 3060 12 GB (driver 610.88, wave32 only), Ryzen 7 5700X, Windows 11 Pro 26300, Rust 1.100.0 MSVC, debug. | | result | |---|---| | `cargo test --workspace --no-fail-fast -- --test-threads=4` | 2153 passed, 0 failed, 48 ignored; 25 `SKIPPED` lines (no wave64, refused per-lane f16/f32 forms, `heap_window_out_of_memory_falls_back_to_the_switch_form`). `main` `10d2729` here: 2152 passed, 0 failed, 48 ignored | | `direct_compute_translates_2d_and_3d_groups`, `gpu_direct_compute_waves_take_consecutive_threads_of_2d_and_3d_groups` alone | 3 of 3 each; the GPU test ran (no `SKIPPED`) | | scratch: the `y * z > 1` branch in `setup_lanes_compute` (`lanes.rs`) disabled, so 2-D / 3-D groups in native waves use `flattenedThreadIdInGroup` | the GPU test fails 3 of 3: `[8, 8, 1] wave64 false: thread 2 (lane, the wave's first thread)`, `left: (4, 0)` | So this driver also forms 2-D waves out of console order, and the test catches it on wave32. The split-wave64 cases ran in their split form (no native wave64 here). **Not tested:** native wave64 (AMD), `scripts/smoke.ps1` / a title, a release build. **AI use:** Claude Code (Claude Opus 5.5) ran the tests and the scratch mutation and wrote this report.
bmjask commented 2026-11-28 22:04:19 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-11-28T22:04:19Z.

Review: COMMENTED


Critical-review result: I found no concrete correctness defect in restoring the direct DXIL route for 2-D/3-D groups. The arrival-based lane assignment and added GPU validation are directionally appropriate.

The implementation is mergeable and Windows CI is green, but the PR description/regression evidence still needs to satisfy the repository gate before merge. Please update it from the exact current head and report any GPU skips separately from coverage.

Reviewed at f4e0ab9259 with Codex (GPT-5).

<!-- greyfinch-sync:ivall/xcl:review:6100275300 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3189#pullrequestreview-6100275300). Originally posted by [bmjask](https://github.com/bmjask) on 2026-11-28T22:04:19Z. **Review:** COMMENTED --- Critical-review result: I found no concrete correctness defect in restoring the direct DXIL route for 2-D/3-D groups. The arrival-based lane assignment and added GPU validation are directionally appropriate. The implementation is mergeable and Windows CI is green, but the PR description/regression evidence still needs to satisfy the repository gate before merge. Please update it from the exact current head and report any GPU skips separately from coverage. Reviewed at f4e0ab92592af8f74fb42e9826fc9eff9a518913 with Codex (GPT-5).
Kalmarv commented 2026-11-29 04:37:29 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-29T04:37:29Z.


merge-check
base: fa204595a4
head: f4e0ab9259
merge: clean, but it changes nothing: the trial merge's tree is main's own tree (e79c9fb4, from git merge-tree --write-tree). The PR's one commit is already on main as daae0330b9: same author, same message, the same changes to build.rs, pso.rs and recomp/tests.rs, differing only in line offsets. It came into main with #3203 (the nvidia-dev merge).
build: not run for this PR, since its merge equals main.
tests: both tests this PR adds already run on main. In a full suite on this machine (main fa204595 plus #2578, which touches only title_textures.rs), direct_compute_translates_2d_and_3d_groups and gpu_direct_compute_waves_take_consecutive_threads_of_2d_and_3d_groups passed on this 32-lane GPU.
review: nothing left to review; the changes are on main.
performance: none, because merging changes no file.
verdict: nothing to merge: the change is already on main (daae0330 via #3203), so this PR can be closed.
hardware / tool and model: NVIDIA GeForce RTX 5070 Ti 16 GB (driver 610.74, wave32 only), AMD Ryzen 9 9950X, Windows 11 build 26200; rustc 1.99.0, debug test profile, DXC 1.9.2609 via XCL_DXC_DIR. Claude Code, Claude Opus 5.5: ancestry and patch comparison, merge-tree check; this report.

<!-- greyfinch-sync:ivall/xcl:comment:7250763958 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3189#issuecomment-7250763958). Originally posted by [Kalmarv](https://github.com/Kalmarv) on 2026-11-29T04:37:29Z. --- merge-check base: fa204595a488c60c6c5f905244f0172072c9c2a9 head: f4e0ab92592af8f74fb42e9826fc9eff9a518913 merge: clean, but it changes nothing: the trial merge's tree is main's own tree (`e79c9fb4`, from `git merge-tree --write-tree`). The PR's one commit is already on `main` as daae0330b95c43b868f8957c29dc4ccae90ac8ef: same author, same message, the same changes to `build.rs`, `pso.rs` and `recomp/tests.rs`, differing only in line offsets. It came into `main` with #3203 (the nvidia-dev merge). build: not run for this PR, since its merge equals `main`. tests: both tests this PR adds already run on `main`. In a full suite on this machine (main fa204595 plus #2578, which touches only `title_textures.rs`), `direct_compute_translates_2d_and_3d_groups` and `gpu_direct_compute_waves_take_consecutive_threads_of_2d_and_3d_groups` passed on this 32-lane GPU. review: nothing left to review; the changes are on `main`. performance: none, because merging changes no file. verdict: nothing to merge: the change is already on `main` (daae0330 via #3203), so this PR can be closed. hardware / tool and model: NVIDIA GeForce RTX 5070 Ti 16 GB (driver 610.74, wave32 only), AMD Ryzen 9 9950X, Windows 11 build 26200; rustc 1.99.0, debug test profile, DXC 1.9.2609 via XCL_DXC_DIR. Claude Code, Claude Opus 5.5: ancestry and patch comparison, merge-tree check; this report.
Royalflamejlh commented 2026-11-30 02:14:17 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-11-30T02:14:17Z.


Closing: main has this change in its own form since daae0330 (#3203), and a trial merge of this head into main changes nothing.

<!-- greyfinch-sync:ivall/xcl:comment:7266827282 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3189#issuecomment-7266827282). Originally posted by [Royalflamejlh](https://github.com/Royalflamejlh) on 2026-11-30T02:14:17Z. --- Closing: `main` has this change in its own form since `daae0330` (#3203), and a trial merge of this head into `main` changes nothing.

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!3189
No description provided.