Recompiler: add an opt-in thread-limit mask for direct compute #3015

Closed
KDenKC wants to merge 2 commits from upstream-pr/3015 into main
KDenKC commented 2026-11-27 12:21:18 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by KDenKC on 2026-11-27T12:21:18Z.


Stacked on #2610 (review only the last commit)

What is in it

Add an opt-in direct-DXIL compute entry that masks lanes outside the requested thread dimensions. It ballots the per-axis bounds after the existing padding mask and intersects the result with EXEC. #2610 supplies the rounded dispatch counts and thread limits. The runtime selection will use this entry for partial groups in a follow-up.

Related: #1751 (BVH rehydration passes issue thread-dimension DispatchX with partial last groups), #1833 (world-load roadmap).

Why

A 200-second diagnostic run counted 2,999 partial-group dispatches in 3,009 thread-dimension DispatchX calls, across four pipelines in the last logged sample. The first appeared at world load. The unguarded-store test shows how extra lanes can write past the requested extent and checks that the mask suppresses them. The ordinary entry emits byte-identical DXIL. This translator source change triggers a one-time rebuild of existing direct-DXIL cache entries.

Tested

All at this head, 1208606b, release.

  • RTX 5090 (621.24), Ryzen 7 9800X3D, Windows 11. Wave32 and split-wave64 GPU readbacks passed. The GPU lacks native wave64, so that case prints SKIPPED here.
  • AMD Radeon Graphics iGPU. All four focused cases passed, including the native-wave64 GPU readback.
  • Compared ordinary translation against bytes captured on the #2610 parent, for wave32, split wave64 and native wave64. All three were byte-identical. The cross-run and cross-thread byte test also passed.
  • cargo build --workspace passed. cargo test --workspace --no-fail-fast -- --test-threads=4 (XCL_NETWORK=0, RTX 5090): 1,430 passed, 4 failed, 47 ignored, 27 SKIPPED. The 4 failures are the known fuzz_validate_and_gpu_0..3 (#1905). The SKIPPED include the native-wave64 case on this GPU.

Regression run

main (08db8020, the base under #2610 and this change; the same block as in #2610's description):

xcl-smoke v1
commit: 08db8020d323bf478964fcc586152cce54959cfc
gpu: NVIDIA GeForce RTX 5090
title: 9cc6a39e
seconds: 200
exit: 0x0
frames shown: 2034 (PresentX 2034)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 31275 MB

This PR (1208606b):

xcl-smoke v1
commit: 1208606bbe3a896a5677370b96dbec77aabbe333
gpu: NVIDIA GeForce RTX 5090
title: 9cc6a39e
seconds: 200
exit: 0x0
frames shown: 2054 (PresentX 2054)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 31614 MB

Both: the retail title, -Seconds 200, RTX 5090, a copy of the same precompiled cache, the same scripted input to the world load, full-size frame dumps. The main run used a never-used exe name; this head's run reused a warm one. The ordinary compute translation is unchanged (byte-identical DXIL) and the masked entry is not selected yet, so this is a regression check only.

AMD testing requested

On an AMD adapter with native wave64, run this from the branch in PowerShell with DXC available.

$env:XCL_NETWORK = '0'
$env:XCL_ADAPTER = 'amd'
cargo test -p xcl --lib gpu::dxil::dispatchx_tests:: -- --test-threads=1 --nocapture

Please share the adapter, driver and result, including whether dispatchx_native_wave64_masks_excess_lanes ran without a SKIPPED line.

Not tested

In-title behavior and first-use compile timing are for the runtime follow-up.

AI use

Codex (GPT-6.2-Sol) wrote the change, tests and description. Claude Code (Claude Opus 5.5) ran the independent validation on both adapters and the smoke pair.

🤖 Generated with Claude Code

https://claude.ai/code/session_013oPUFCA9W9F8Qb5MPK33bR

<!-- greyfinch-sync:ivall/xcl:issue:5526530885 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3015). Originally posted by [KDenKC](https://github.com/KDenKC) on 2026-11-27T12:21:18Z. --- **Stacked on #2610 (review only the last commit)** **What is in it** Add an opt-in direct-DXIL compute entry that masks lanes outside the requested thread dimensions. It ballots the per-axis bounds after the existing padding mask and intersects the result with EXEC. #2610 supplies the rounded dispatch counts and thread limits. The runtime selection will use this entry for partial groups in a follow-up. Related: #1751 (BVH rehydration passes issue thread-dimension `DispatchX` with partial last groups), #1833 (world-load roadmap). **Why** A 200-second diagnostic run counted 2,999 partial-group dispatches in 3,009 thread-dimension `DispatchX` calls, across four pipelines in the last logged sample. The first appeared at world load. The unguarded-store test shows how extra lanes can write past the requested extent and checks that the mask suppresses them. The ordinary entry emits byte-identical DXIL. This translator source change triggers a one-time rebuild of existing direct-DXIL cache entries. **Tested** All at this head, `1208606b`, release. - RTX 5090 (621.24), Ryzen 7 9800X3D, Windows 11. Wave32 and split-wave64 GPU readbacks passed. The GPU lacks native wave64, so that case prints `SKIPPED` here. - AMD Radeon Graphics iGPU. All four focused cases passed, including the native-wave64 GPU readback. - Compared ordinary translation against bytes captured on the #2610 parent, for wave32, split wave64 and native wave64. All three were byte-identical. The cross-run and cross-thread byte test also passed. - `cargo build --workspace` passed. `cargo test --workspace --no-fail-fast -- --test-threads=4` (`XCL_NETWORK=0`, RTX 5090): 1,430 passed, 4 failed, 47 ignored, 27 SKIPPED. The 4 failures are the known `fuzz_validate_and_gpu_0..3` (#1905). The SKIPPED include the native-wave64 case on this GPU. **Regression run** `main` (`08db8020`, the base under #2610 and this change; the same block as in #2610's description): ``` xcl-smoke v1 commit: 08db8020d323bf478964fcc586152cce54959cfc gpu: NVIDIA GeForce RTX 5090 title: 9cc6a39e seconds: 200 exit: 0x0 frames shown: 2034 (PresentX 2034) presents per 2 s (last 3): 0 0 0 device removals: 0 crashes: 0 peak commit: 31275 MB ``` This PR (`1208606b`): ``` xcl-smoke v1 commit: 1208606bbe3a896a5677370b96dbec77aabbe333 gpu: NVIDIA GeForce RTX 5090 title: 9cc6a39e seconds: 200 exit: 0x0 frames shown: 2054 (PresentX 2054) presents per 2 s (last 3): 0 0 0 device removals: 0 crashes: 0 peak commit: 31614 MB ``` Both: the retail title, `-Seconds 200`, RTX 5090, a copy of the same precompiled cache, the same scripted input to the world load, full-size frame dumps. The `main` run used a never-used exe name; this head's run reused a warm one. The ordinary compute translation is unchanged (byte-identical DXIL) and the masked entry is not selected yet, so this is a regression check only. **AMD testing requested** On an AMD adapter with native wave64, run this from the branch in PowerShell with DXC available. ```powershell $env:XCL_NETWORK = '0' $env:XCL_ADAPTER = 'amd' cargo test -p xcl --lib gpu::dxil::dispatchx_tests:: -- --test-threads=1 --nocapture ``` Please share the adapter, driver and result, including whether `dispatchx_native_wave64_masks_excess_lanes` ran without a `SKIPPED` line. **Not tested** In-title behavior and first-use compile timing are for the runtime follow-up. **AI use** Codex (GPT-6.2-Sol) wrote the change, tests and description. Claude Code (Claude Opus 5.5) ran the independent validation on both adapters and the smoke pair. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_013oPUFCA9W9F8Qb5MPK33bR
KDenKC commented 2026-11-28 16:16:26 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by KDenKC on 2026-11-28T16:16:26Z.


Closing this together with #2610, which it was stacked on: main handles DispatchX thread limits inline now (bmjask's d9403543 and #3157), a different design from this opt-in mask. Thank you @bmjask.

Nobody tested this one on its own. The masking question was answered on #2610 and #3066, by jennydeth, minimalhipster990 and CharlyRien. Thank you for that.

The one gap left on main: the opt-in per-lane path still ignores the thread limits.

AI use: an agent swarm: Claude Fable 5.2, Claude Opus 5.5, GPT-6.2-Sol and Gemini 4 Neon.

<!-- greyfinch-sync:ivall/xcl:comment:7242111094 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3015#issuecomment-7242111094). Originally posted by [KDenKC](https://github.com/KDenKC) on 2026-11-28T16:16:26Z. --- Closing this together with #2610, which it was stacked on: `main` handles DispatchX thread limits inline now (bmjask's `d9403543` and #3157), a different design from this opt-in mask. Thank you @bmjask. Nobody tested this one on its own. The masking question was answered on #2610 and #3066, by jennydeth, minimalhipster990 and CharlyRien. Thank you for that. The one gap left on `main`: the opt-in per-lane path still ignores the thread limits. AI use: an agent swarm: Claude Fable 5.2, Claude Opus 5.5, GPT-6.2-Sol and Gemini 4 Neon.

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