Recompiler: a compute loop's passes shrink with the dispatch's size #2291

Open
github-bot wants to merge 1 commit from github-bot/gh-2291 into main AGit
Owner

@⁠Prime1997 on GitHub · 2026-11-25 12:29 UTC · original
Prime1997:contrib/dispatch-loop-budget → main · +198 −8 · 5 files · 1 commits · open

Requested by Prime · project thread

A lane may run 65 536 loop passes before LOOP_GUARD ends its loops, so that console code looping on a count XCL gave it wrong does not keep the GPU busy. The bound is per lane, so the work it allows grows with the dispatch: WindNew:CS_AdvectFromParentStep (a542b07e605c8fd7) runs as 16 x 16 x 16 groups of 64 threads, and with a loop count that never comes that is about 31 s on an RTX 3060 Ti, where Windows removes the device after 2 s (the open dispatch of #1452; measurements in this comment). With this change every entry of a loop in a compute program has its own count of passes that shrinks with the dispatch's size, so a loop that runs away on its own ends in time. Part of #1452.

What is in it

  • crates/xcl/src/gpu/recomp/mod.rs: IO_LOOP_BUDGET (io slot 113, free in the trap-temp range), DISPATCH_LOOP_PASSES (2^28), dispatch_loop_budget(groups); the two loop emitters ask Em::loop_guard for what goes before a loop and at its top.
  • crates/xcl/src/gpu/recomp/emit.rs: Em::loop_guard. In a compute program a loop gets uint xcl_nK = xcl_cap; before it and if (xcl_nK == 0u) break; xcl_nK--; in front of the existing guard; the entry point sets xcl_cap = clamp(slot / threads per group, 1024, 65536) when the slot is not 0. The lane's budget of 65 536 for all its loops stays, so loops inside one another are not cut to one loop's share. Other stages and programs without a loop emit the HLSL they did.
  • crates/xcl/src/hle/d3d12x/bind.rs, console_list.rs: a direct dispatch writes its share (2^28 / groups) into the slot. An indirect dispatch leaves 0: 65 536 as before.
  • crates/xcl/src/gpu/recomp/tests.rs: dispatch_loop_budget_shrinks_with_the_groups, only_compute_programs_with_a_loop_read_the_dispatch_loop_budget (no GPU), gpu_compute_loop_passes_follow_the_dispatch.

Up to 4096 lanes nothing changes. At 16 x 16 x 16 groups of 64 threads one entry of a loop ends after 1024 passes.

Tested

  • hardware (GPU + driver, CPU), Rust version, debug / release: NVIDIA GeForce RTX 3060 Ti 8 GB (driver 617.14), Intel Core i5-10400, Windows 11 26200, Rust 1.100.0, debug.
  • cargo test -p xcl --lib -- gpu_compute_loop_passes_follow_the_dispatch dispatch_loop_budget_shrinks only_compute_programs_with_a_loop: 3 passed, 0 failed, no SKIPPED. The GPU test runs a loop that never ends as a wave32 and as a split wave64 program: it stops after 65 536 passes with the slot at 0, after 5000 and 1024 for shares of that size, and entered three times it runs 3 x 1024.
  • 62 compute programs of a retail title that have loops (every sixth by size of 346, and the five with the most loops, up to 95) compile with DXC with the new guard: 62 ok, 0 failed.
  • The a542 program alone on the GPU with a count that never comes, 16 x 16 x 16 groups: 485 ms when the loop is ended after 1024 passes, against about 31 s for 65 536 (0.47 ms a pass measured). That was measured with an earlier form of this change that set the lane's total to the same 1024; I have not timed this head yet.
  • cargo test --workspace -- --test-threads=4: 1157 passed, 0 failed, 46 ignored (SKIPPED GPU tests: 25 – 20 need 64-lane waves, 3 are cases the direct per-lane form refuses, heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows), pso_measurement_compiles_an_exact_synthetic_record (needs Windows Developer Mode)).

Regression run

Seeded 60 s runs without input (the same copied profile and shader cache for each, release builds from clean checkouts of the two commits, XCL_HEAP_WINDOWS=1 XCL_LAZY_PSO=1 XCL_LAZY_COMPUTE=1 XCL_PSO_PRELOAD=0 XCL_DXC_THREADS=2). The main run is from earlier the same day, not back to back.

main:

xcl-smoke v1
commit: 568e7db7729c8fa6c8f0f4b32d798faaf11462bb
gpu: NVIDIA GeForce RTX 3060 Ti
title: 419239bf
seconds: 60
exit: 0x0
frames shown: 357 (PresentX 357)
presents per 2 s (last 3): 17 18 18
device removals: 0
crashes: 0
peak commit: 15226 MB

PR:

xcl-smoke v1
commit: 4bad50562dd5e1f7c3a26602367904a695296892
gpu: NVIDIA GeForce RTX 3060 Ti
title: 419239bf
seconds: 60
exit: 0x0
frames shown: 416 (PresentX 416)
presents per 2 s (last 3): 23 23 24
device removals: 0
crashes: 0
peak commit: 15191 MB

Not tested

  • The regression run reaches the title's start screen only: it does not reach the wind dispatch. The frame counts differ by run-to-run noise; no performance claim.
  • The title itself past the dispatch that hangs. Why the count is wrong there is not known; this only keeps the device.
  • A loop that runs away with another loop inside it still has the lane's 65 536 passes.
  • The direct DXIL translator keeps its fixed budget.
  • AMD / Intel GPUs, 64-lane hardware.

AI use

  • Claude Code with Claude Fable 5.2 did the measurements, wrote the code, the tests and this description, and opened the PR at Prime's request. The runs were on Prime's machine.

🤖 Generated with Claude Code

**@⁠Prime1997** on GitHub · 2026-11-25 12:29 UTC · [original](https://github.com/xcl-dev/xcl/pull/2291) `Prime1997:contrib/dispatch-loop-budget` → `main` · +198 −8 · 5 files · 1 commits · open <!-- claude-projects-attribution: {"github_login":"Prime1997"} --> _Requested by **Prime** · [project thread](https://claude.ai/code/project/chan_014ndQaTcZS9FWDAjYnDD1nA?thread=cmsg_014ndQaTcZS9FWDAjYnDD1nAP6bMmXPkAf9NWU5DUiM7bB)_ A lane may run 65 536 loop passes before `LOOP_GUARD` ends its loops, so that console code looping on a count XCL gave it wrong does not keep the GPU busy. The bound is per lane, so the work it allows grows with the dispatch: `WindNew:CS_AdvectFromParentStep` (a542b07e605c8fd7) runs as 16 x 16 x 16 groups of 64 threads, and with a loop count that never comes that is about 31 s on an RTX 3060 Ti, where Windows removes the device after 2 s (the open dispatch of #1452; measurements in [this comment](https://git.gtahub.st/github/xcl-dev--xcl/issues/1452)). With this change every entry of a loop in a compute program has its own count of passes that shrinks with the dispatch's size, so a loop that runs away on its own ends in time. Part of #1452. **What is in it** - `crates/xcl/src/gpu/recomp/mod.rs`: `IO_LOOP_BUDGET` (io slot 113, free in the trap-temp range), `DISPATCH_LOOP_PASSES` (2^28), `dispatch_loop_budget(groups)`; the two loop emitters ask `Em::loop_guard` for what goes before a loop and at its top. - `crates/xcl/src/gpu/recomp/emit.rs`: `Em::loop_guard`. In a compute program a loop gets `uint xcl_nK = xcl_cap;` before it and `if (xcl_nK == 0u) break; xcl_nK--;` in front of the existing guard; the entry point sets `xcl_cap = clamp(slot / threads per group, 1024, 65536)` when the slot is not 0. The lane's budget of 65 536 for all its loops stays, so loops inside one another are not cut to one loop's share. Other stages and programs without a loop emit the HLSL they did. - `crates/xcl/src/hle/d3d12x/bind.rs`, `console_list.rs`: a direct dispatch writes its share (2^28 / groups) into the slot. An indirect dispatch leaves 0: 65 536 as before. - `crates/xcl/src/gpu/recomp/tests.rs`: `dispatch_loop_budget_shrinks_with_the_groups`, `only_compute_programs_with_a_loop_read_the_dispatch_loop_budget` (no GPU), `gpu_compute_loop_passes_follow_the_dispatch`. Up to 4096 lanes nothing changes. At 16 x 16 x 16 groups of 64 threads one entry of a loop ends after 1024 passes. **Tested** - hardware (GPU + driver, CPU), Rust version, debug / release: NVIDIA GeForce RTX 3060 Ti 8 GB (driver 617.14), Intel Core i5-10400, Windows 11 26200, Rust 1.100.0, debug. - `cargo test -p xcl --lib -- gpu_compute_loop_passes_follow_the_dispatch dispatch_loop_budget_shrinks only_compute_programs_with_a_loop`: 3 passed, 0 failed, no SKIPPED. The GPU test runs a loop that never ends as a wave32 and as a split wave64 program: it stops after 65 536 passes with the slot at 0, after 5000 and 1024 for shares of that size, and entered three times it runs 3 x 1024. - 62 compute programs of a retail title that have loops (every sixth by size of 346, and the five with the most loops, up to 95) compile with DXC with the new guard: 62 ok, 0 failed. - The a542 program alone on the GPU with a count that never comes, 16 x 16 x 16 groups: 485 ms when the loop is ended after 1024 passes, against about 31 s for 65 536 (0.47 ms a pass measured). That was measured with an earlier form of this change that set the lane's total to the same 1024; I have not timed this head yet. - `cargo test --workspace -- --test-threads=4`: 1157 passed, 0 failed, 46 ignored (SKIPPED GPU tests: 25 – 20 need 64-lane waves, 3 are cases the direct per-lane form refuses, `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows), `pso_measurement_compiles_an_exact_synthetic_record` (needs Windows Developer Mode)). **Regression run** Seeded 60 s runs without input (the same copied profile and shader cache for each, release builds from clean checkouts of the two commits, `XCL_HEAP_WINDOWS=1 XCL_LAZY_PSO=1 XCL_LAZY_COMPUTE=1 XCL_PSO_PRELOAD=0 XCL_DXC_THREADS=2`). The main run is from earlier the same day, not back to back. main: ``` xcl-smoke v1 commit: 568e7db7729c8fa6c8f0f4b32d798faaf11462bb gpu: NVIDIA GeForce RTX 3060 Ti title: 419239bf seconds: 60 exit: 0x0 frames shown: 357 (PresentX 357) presents per 2 s (last 3): 17 18 18 device removals: 0 crashes: 0 peak commit: 15226 MB ``` PR: ``` xcl-smoke v1 commit: 4bad50562dd5e1f7c3a26602367904a695296892 gpu: NVIDIA GeForce RTX 3060 Ti title: 419239bf seconds: 60 exit: 0x0 frames shown: 416 (PresentX 416) presents per 2 s (last 3): 23 23 24 device removals: 0 crashes: 0 peak commit: 15191 MB ``` **Not tested** - The regression run reaches the title's start screen only: it does not reach the wind dispatch. The frame counts differ by run-to-run noise; no performance claim. - The title itself past the dispatch that hangs. Why the count is wrong there is not known; this only keeps the device. - A loop that runs away with another loop inside it still has the lane's 65 536 passes. - The direct DXIL translator keeps its fixed budget. - AMD / Intel GPUs, 64-lane hardware. **AI use** - Claude Code with Claude Fable 5.2 did the measurements, wrote the code, the tests and this description, and opened the PR at Prime's request. The runs were on Prime's machine. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A lane may run 65 536 loop passes before LOOP_GUARD ends its loops, so
that console code looping on a count XCL gave it wrong does not keep the
GPU busy for minutes. That bound is per lane: the work it allows grows
with the dispatch, and a large dispatch outlasts the 2 s Windows waits
before it removes the device.

WindNew:CS_AdvectFromParentStep (a542b07e605c8fd7, 4 x 4 x 4 threads) is
dispatched as 16 x 16 x 16 groups and loops while a counter differs from
a count in title memory. Run alone on an RTX 3060 Ti with synthetic
inputs, the translated program takes 1.0 ms with a count of 0, 6.7 ms
with 64, 25 ms with 256 – and with a count that never comes 111 ms when
the loop is ended after 256 passes and 485 ms after 1024 (0.47 ms a
pass), which is 31 s for 65 536. That is the dispatch left open when the
device was removed (#1452).

A compute dispatch whose group counts are known now passes its share of
2^28 loop passes for one group in a free io slot (IO_LOOP_BUDGET), and
in a compute program every entry of a loop has its own count of passes:
that share among the group's threads, between 1024 and 65 536 a lane.
Up to 4096 lanes nothing changes; at 16 x 16 x 16 groups of 64 threads
one entry of a loop ends after 1024 passes. The lane's budget of 65 536
for all its loops stays, so loops inside one another are not cut to one
loop's share: only a loop that runs away on its own is ended early. A
slot of 0 (an indirect dispatch, the test runner) leaves 65 536, and
programs without a loop, other stages and the direct translator emit
what they did.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:25:59 +00:00
Author
Owner

@⁠upipibi on GitHub · 2026-11-25 12:51 UTC · original

@⁠Prime1997 A heads-up from our #1284 (XCL_LOOP_BUDGET, mergeable, head f3eb053). It isn't a duplicate, but the two meet in the same place:

  • #1284 makes the per-lane xcl_budget that LOOP_GUARD counts down configurable: XCL_LOOP_BUDGET swaps the prelude's 1u << 16 for any whole number from 1. This PR adds a per-loop xcl_cap in front of that guard, defaulting to 1u << 16 and clamped to 1024..=1u << 16 (emit.rs:4699, :4873 at 4bad505). With both merged, raising XCL_LOOP_BUDGET above 65 536 would no longer let a single loop in a compute program run longer, because xcl_cap would end it first. Lowering it still works, because LOOP_GUARD fires first.
  • They also conflict as text: git merge-tree of the two heads stops in recomp/emit.rs and recomp/mod.rs.

If the upper bound of the clamp (and xcl_cap's default) took loop_budget() from #1284 instead of a literal 1u << 16, the two would compose. Whichever merges second needs that. I'm happy to rebase #1284 onto this one if it lands first.

AI-assisted (Claude Code). Read from the two diffs only; nothing run.

**@⁠upipibi** on GitHub · 2026-11-25 12:51 UTC · [original](https://github.com/xcl-dev/xcl/pull/2291#issuecomment-7162950475) @⁠Prime1997 A heads-up from our #1284 (`XCL_LOOP_BUDGET`, mergeable, head `f3eb053`). It isn't a duplicate, but the two meet in the same place: - #1284 makes the per-lane `xcl_budget` that `LOOP_GUARD` counts down configurable: `XCL_LOOP_BUDGET` swaps the prelude's `1u << 16` for any whole number from 1. This PR adds a per-loop `xcl_cap` in front of that guard, defaulting to `1u << 16` and clamped to `1024..=1u << 16` (`emit.rs:4699`, `:4873` at `4bad505`). With both merged, raising `XCL_LOOP_BUDGET` above 65 536 would no longer let a single loop in a compute program run longer, because `xcl_cap` would end it first. Lowering it still works, because `LOOP_GUARD` fires first. - They also conflict as text: `git merge-tree` of the two heads stops in `recomp/emit.rs` and `recomp/mod.rs`. If the upper bound of the clamp (and `xcl_cap`'s default) took `loop_budget()` from #1284 instead of a literal `1u << 16`, the two would compose. Whichever merges second needs that. I'm happy to rebase #1284 onto this one if it lands first. AI-assisted (Claude Code). Read from the two diffs only; nothing run.
Author
Owner

@⁠oni-swr on GitHub · 2026-11-25 13:19 UTC · original

AMD RDNA3 (native wave64) test report for exact head 4bad50562dd5e1f7c3a26602367904a695296892, as pushed (not merged onto current main).

Tested

  • AMD Radeon RX 7800 XT (RDNA3, native wave64), driver 32.0.31035.1003; Windows 11 Pro 10.0.26200; Rust 1.100.0 (stable-x86_64-pc-windows-msvc); debug; DXC 1.9.0.5512 (dxcompiler.dll)
  • cargo build --workspace: ok
  • Targeted: dispatch_loop_budget_shrinks_with_the_groups, only_compute_programs_with_a_loop_read_the_dispatch_loop_budget, gpu_compute_loop_passes_follow_the_dispatch: 3 passed, 0 failed (the GPU one ran, not skipped)
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 1156 passed, 1 failed, 46 ignored (summed over all test binaries)
  • SKIPPED: 7 lines in the full run (6 `lower_dxil` f16/f32 per-lane-form cases "refused (unsupported V_MUL_F16 / V_PK_MUL_F16 / V_CVT_F16_F32 ... #1426 semantics)", plus `heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows`). The one failure is `gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1` (seed 722: res[30] = 0x1, CPU 0x7fffffff). It is not in code this PR touches, and I reproduced the same failure and seed on `main` at `1a0bbe3` with `cargo test -p xcl --lib fuzz_validate_and_gpu_1`, so it is pre-existing on RDNA3, not caused by this PR.

Not tested

  • No game title, no scripts/smoke.ps1 regression run (synthetic GPU/unit tests only)
  • Not merged onto current main; other GPUs (NVIDIA / Intel / RDNA2 / RDNA4)
  • Whether the new tests fail without the fix; the interaction with #1284 (XCL_LOOP_BUDGET) mentioned in the comments

AI use: Claude Code (Claude Sonnet 5.5) ran the build and tests and wrote this report; the numbers are from the runs above.

**@⁠oni-swr** on GitHub · 2026-11-25 13:19 UTC · [original](https://github.com/xcl-dev/xcl/pull/2291#issuecomment-7163604789) AMD RDNA3 (native wave64) test report for exact head `4bad50562dd5e1f7c3a26602367904a695296892`, as pushed (not merged onto current `main`). **Tested** - AMD Radeon RX 7800 XT (RDNA3, native wave64), driver 32.0.31035.1003; Windows 11 Pro 10.0.26200; Rust 1.100.0 (stable-x86_64-pc-windows-msvc); debug; DXC 1.9.0.5512 (dxcompiler.dll) - `cargo build --workspace`: ok - Targeted: `dispatch_loop_budget_shrinks_with_the_groups`, `only_compute_programs_with_a_loop_read_the_dispatch_loop_budget`, `gpu_compute_loop_passes_follow_the_dispatch`: 3 passed, 0 failed (the GPU one ran, not skipped) - `cargo test --workspace --no-fail-fast -- --test-threads=4`: 1156 passed, 1 failed, 46 ignored (summed over all test binaries) - SKIPPED: 7 lines in the full run (6 \`lower_dxil\` f16/f32 per-lane-form cases "refused (unsupported V_MUL_F16 / V_PK_MUL_F16 / V_CVT_F16_F32 ... #1426 semantics)", plus \`heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows\`). The one failure is \`gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1\` (seed 722: res[30] = 0x1, CPU 0x7fffffff). It is not in code this PR touches, and I reproduced the same failure and seed on \`main\` at \`1a0bbe3\` with \`cargo test -p xcl --lib fuzz_validate_and_gpu_1\`, so it is pre-existing on RDNA3, not caused by this PR. **Not tested** - No game title, no `scripts/smoke.ps1` regression run (synthetic GPU/unit tests only) - Not merged onto current `main`; other GPUs (NVIDIA / Intel / RDNA2 / RDNA4) - Whether the new tests fail without the fix; the interaction with #1284 (`XCL_LOOP_BUDGET`) mentioned in the comments **AI use**: Claude Code (Claude Sonnet 5.5) ran the build and tests and wrote this report; the numbers are from the runs above.
Author
Owner

@⁠Lum7nt on GitHub · 2026-11-25 13:10 UTC · original · edited 2026-11-25 13:19 UTC

AMD targeted tests on clean head 4bad50562dd5e1f7c3a26602367904a695296892: Windows 11 build 26300, Radeon RX 9070 XT (driver 32.0.32029.2010), Rust 1.100.0 MSVC, DXC/DXIL 1.9.2609.5, release profile. Set XCL_ADAPTER=9070 XT, XCL_REQUIRE_GPU=wave64. For each filter below I ran cargo test --offline --locked --release -p xcl --lib <filter> -- --nocapture --test-threads=1:

  • gpu_compute_loop_passes_follow_the_dispatch: 1 passed, 0 failed, 0 ignored.
  • dispatch_loop_budget_shrinks_with_the_groups: 1 passed, 0 failed, 0 ignored.
  • only_compute_programs_with_a_loop_read_the_dispatch_loop_budget: 1 passed, 0 failed, 0 ignored.

No SKIPPED messages. The first is the small single-group GPU fixture covering wave32 and wave64 program options and the different loop limits; the other two are CPU checks.

60 s retail smoke comparison: clean release builds; PR run first, then main. Same title, XCL_ADAPTER=9070 XT, XCL_HEAP_WINDOWS=1, XCL_PSO_PRELOAD=0; no automated input. The PR produced 254 frames versus main’s 1556 (16.3%, below the 80% comparison threshold), with zero recorded crashes or device removals. This single pair is order-sensitive and does not establish a cause or a reproducible regression; caches and profile state were not reset between runs. The last three PR present intervals recovered to 11, 59, 60.

Main:

xcl-smoke v1
commit: 1a0bbe3a2ba91ea8f5b6fc29130a053868d3c9e6
gpu: AMD Radeon RX 9070 XT
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1556 (PresentX 1557)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14676 MB

PR:

xcl-smoke v1
commit: 4bad50562dd5e1f7c3a26602367904a695296892
gpu: AMD Radeon RX 9070 XT
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 254 (PresentX 254)
presents per 2 s (last 3): 11 59 60
device removals: 0
crashes: 0
peak commit: 15323 MB

Not tested: the large wind dispatch, progression past the loading hang, full workspace, or a controlled cache/profile comparison.

Repeat after main: Same settings and no reset; PR/main/PR run order. The repeated PR run showed 1577 frames, compared with 1556 on main. This makes the first result non-reproducible in this sequence but does not identify its cause.

xcl-smoke v1
commit: 4bad50562dd5e1f7c3a26602367904a695296892
gpu: AMD Radeon RX 9070 XT
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1577 (PresentX 1577)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15041 MB

AI use: OpenAI Codex (GPT-6; exact variant unavailable) ran the tests and smoke pair and drafted this report.

**@⁠Lum7nt** on GitHub · 2026-11-25 13:10 UTC · [original](https://github.com/xcl-dev/xcl/pull/2291#issuecomment-7163388645) · edited 2026-11-25 13:19 UTC **AMD targeted tests** on clean head `4bad50562dd5e1f7c3a26602367904a695296892`: Windows 11 build 26300, Radeon RX 9070 XT (driver `32.0.32029.2010`), Rust 1.100.0 MSVC, DXC/DXIL 1.9.2609.5, release profile. Set `XCL_ADAPTER=9070 XT`, `XCL_REQUIRE_GPU=wave64`. For each filter below I ran `cargo test --offline --locked --release -p xcl --lib <filter> -- --nocapture --test-threads=1`: - `gpu_compute_loop_passes_follow_the_dispatch`: 1 passed, 0 failed, 0 ignored. - `dispatch_loop_budget_shrinks_with_the_groups`: 1 passed, 0 failed, 0 ignored. - `only_compute_programs_with_a_loop_read_the_dispatch_loop_budget`: 1 passed, 0 failed, 0 ignored. No SKIPPED messages. The first is the small single-group GPU fixture covering wave32 and wave64 program options and the different loop limits; the other two are CPU checks. **60 s retail smoke comparison:** clean release builds; PR run first, then main. Same title, `XCL_ADAPTER=9070 XT`, `XCL_HEAP_WINDOWS=1`, `XCL_PSO_PRELOAD=0`; no automated input. The PR produced 254 frames versus main’s 1556 (16.3%, below the 80% comparison threshold), with zero recorded crashes or device removals. This single pair is order-sensitive and does not establish a cause or a reproducible regression; caches and profile state were not reset between runs. The last three PR present intervals recovered to 11, 59, 60. Main: ``` xcl-smoke v1 commit: 1a0bbe3a2ba91ea8f5b6fc29130a053868d3c9e6 gpu: AMD Radeon RX 9070 XT title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 1556 (PresentX 1557) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14676 MB ``` PR: ``` xcl-smoke v1 commit: 4bad50562dd5e1f7c3a26602367904a695296892 gpu: AMD Radeon RX 9070 XT title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 254 (PresentX 254) presents per 2 s (last 3): 11 59 60 device removals: 0 crashes: 0 peak commit: 15323 MB ``` Not tested: the large wind dispatch, progression past the loading hang, full workspace, or a controlled cache/profile comparison. **Repeat after main:** Same settings and no reset; PR/main/PR run order. The repeated PR run showed 1577 frames, compared with 1556 on main. This makes the first result non-reproducible in this sequence but does not identify its cause. ``` xcl-smoke v1 commit: 4bad50562dd5e1f7c3a26602367904a695296892 gpu: AMD Radeon RX 9070 XT title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 1577 (PresentX 1577) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15041 MB ``` AI use: OpenAI Codex (GPT-6; exact variant unavailable) ran the tests and smoke pair and drafted this report.
Author
Owner

@⁠nnonno91 on GitHub · 2026-11-25 14:52 UTC · original

Independent Radeon iGPU and RTX 5090 check of 4bad50562dd5e1f7c3a26602367904a695296892, including the first two budgets on either side of the floor at 1,024 passes.

Tested

  • Windows 11 25H2 build 26200.9974, Ryzen 7 9800X3D, Rust 1.100.0 MSVC, SDK DXC/DXIL 1.8.2502.11, unoptimized profile. AMD Radeon(TM) Graphics driver 32.0.21042.62 and RTX 5090 driver 32.0.16.1742.
  • cargo test --locked -p xcl --lib -- dispatch_loop_budget --nocapture --test-threads=1 gave 2 passed, 0 failed on the unchanged head.
  • I added two cases to the GPU fixture: with 64 threads per group, slot values 65,599 and 65,600 had to end the loop after 1,024 and 1,025 passes respectively. cargo test --locked -p xcl --lib gpu_compute_loop_passes_follow_the_dispatch -- --nocapture --test-threads=1 gave 1 passed, 0 failed on each adapter selected by XCL_ADAPTER. The cases ran in wave32 and logical wave64 on both GPUs. All other cases in the fixture also passed, including repeated loop entry. Zero ignores or skips in all runs. The two temporary cases were removed.

Not tested

A retail dispatch, indirect dispatch behavior in an end-to-end run, the parent and the full workspace suite.

AI use

OpenAI Codex (GPT-6.2 Sol) added the temporary boundary cases, ran the checks and wrote this report.

**@⁠nnonno91** on GitHub · 2026-11-25 14:52 UTC · [original](https://github.com/xcl-dev/xcl/pull/2291#issuecomment-7165962953) Independent Radeon iGPU and RTX 5090 check of `4bad50562dd5e1f7c3a26602367904a695296892`, including the first two budgets on either side of the floor at 1,024 passes. **Tested** - Windows 11 25H2 build 26200.9974, Ryzen 7 9800X3D, Rust 1.100.0 MSVC, SDK DXC/DXIL 1.8.2502.11, unoptimized profile. AMD Radeon(TM) Graphics driver 32.0.21042.62 and RTX 5090 driver 32.0.16.1742. - `cargo test --locked -p xcl --lib -- dispatch_loop_budget --nocapture --test-threads=1` gave 2 passed, 0 failed on the unchanged head. - I added two cases to the GPU fixture: with 64 threads per group, slot values 65,599 and 65,600 had to end the loop after 1,024 and 1,025 passes respectively. `cargo test --locked -p xcl --lib gpu_compute_loop_passes_follow_the_dispatch -- --nocapture --test-threads=1` gave 1 passed, 0 failed on each adapter selected by `XCL_ADAPTER`. The cases ran in wave32 and logical wave64 on both GPUs. All other cases in the fixture also passed, including repeated loop entry. Zero ignores or skips in all runs. The two temporary cases were removed. **Not tested** A retail dispatch, indirect dispatch behavior in an end-to-end run, the parent and the full workspace suite. **AI use** OpenAI Codex (GPT-6.2 Sol) added the temporary boundary cases, ran the checks and wrote this report.
Author
Owner

@⁠Prime1997 on GitHub · 2026-11-25 16:33 UTC · original

@⁠upipibi agreed, and thanks for reading both diffs. The two compose the way you describe: the cap's default and the clamp's upper bound are the prelude's literal 65 536 only because loop_budget() is not on main. If #1284 lands first I rebase and take loop_budget() in both places; if this one lands first, that is the same two-line change in your rebase.

Thanks @⁠Lum7nt, @⁠oni-swr and @⁠nnonno91 for the runs on AMD (native wave64 included) and the boundary cases at 1024 / 1025 passes.

Two updates from my side:

  • Rebase. main moved under this (3f4495a, #2080 changed translated_dispatch), so the PR shows a conflict. The rebased commit is ready (bind_abi(…, Some([x, y, z])), then the dispatch chain as main has it; targeted tests 3 passed, workspace suite 1278 passed, 0 failed, 46 ignored on the RTX 3060 Ti). I push it together with its regression run so the description never names a head it was not run on.
  • Timing with the final form (the earlier 485 ms was measured with a first version that cut the lane's total): in the translation of a build that carries this commit, with the slot as bind_abi writes it for 16 x 16 x 16 groups, one a542 dispatch with a count that never comes takes 511 ms (271 ms for 2048 groups, 121 ms for 1024). Counts of 0 / 64 / 256 take 1.0 / 6.8 / 23 ms as before.
  • A limit I measured the hard way: the cap bounds one dispatch. Five of those 511 ms dispatches back to back in one command list were removed on this card (0x887a0006); one alone was not. So if a title issues several runaway dispatches in a row, this is not enough on its own. The same reasoning says a dispatch that main now runs in slabs (#2080) should keep the whole dispatch's size for the slot, which the rebase does.

AI use: Claude Code (Claude Fable 5.2) wrote this and ran the measurements on Prime's machine.

**@⁠Prime1997** on GitHub · 2026-11-25 16:33 UTC · [original](https://github.com/xcl-dev/xcl/pull/2291#issuecomment-7168182494) @⁠upipibi agreed, and thanks for reading both diffs. The two compose the way you describe: the cap's default and the clamp's upper bound are the prelude's literal 65 536 only because `loop_budget()` is not on `main`. If #1284 lands first I rebase and take `loop_budget()` in both places; if this one lands first, that is the same two-line change in your rebase. Thanks @⁠Lum7nt, @⁠oni-swr and @⁠nnonno91 for the runs on AMD (native wave64 included) and the boundary cases at 1024 / 1025 passes. Two updates from my side: - **Rebase.** `main` moved under this (3f4495a, #2080 changed `translated_dispatch`), so the PR shows a conflict. The rebased commit is ready (`bind_abi(…, Some([x, y, z]))`, then the dispatch chain as `main` has it; targeted tests 3 passed, workspace suite 1278 passed, 0 failed, 46 ignored on the RTX 3060 Ti). I push it together with its regression run so the description never names a head it was not run on. - **Timing with the final form** (the earlier 485 ms was measured with a first version that cut the lane's total): in the translation of a build that carries this commit, with the slot as `bind_abi` writes it for 16 x 16 x 16 groups, one a542 dispatch with a count that never comes takes 511 ms (271 ms for 2048 groups, 121 ms for 1024). Counts of 0 / 64 / 256 take 1.0 / 6.8 / 23 ms as before. - **A limit I measured the hard way:** the cap bounds one dispatch. Five of those 511 ms dispatches back to back in one command list were removed on this card (`0x887a0006`); one alone was not. So if a title issues several runaway dispatches in a row, this is not enough on its own. The same reasoning says a dispatch that `main` now runs in slabs (#2080) should keep the whole dispatch's size for the slot, which the rebase does. AI use: Claude Code (Claude Fable 5.2) wrote this and ran the measurements on Prime's machine.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 17:29 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 17:29 UTC · [original](https://github.com/xcl-dev/xcl/pull/2291#issuecomment-7169585915) 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 pull request has changes conflicting with the target branch.
  • crates/xcl/src/hle/d3d12x/bind.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2291/head:github-bot/gh-2291'
git switch 'github-bot/gh-2291'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2291'
git switch 'github-bot/gh-2291'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2291'
git switch 'github-bot/gh-2291'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2291'
git switch 'main'
git merge --squash 'github-bot/gh-2291'
git switch 'main'
git merge --ff-only 'github-bot/gh-2291'
git switch 'main'
git merge 'github-bot/gh-2291'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.