Repository navigation
Conversation
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 (xcl-dev#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 <noreply@anthropic.com>
|
@Prime1997 A heads-up from our #1284 (
If the upper bound of the clamp (and AI-assisted (Claude Code). Read from the two diffs only; nothing run. |
|
AMD targeted tests on clean head
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, Main: PR: 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. AI use: OpenAI Codex (GPT-6; exact variant unavailable) ran the tests and smoke pair and drafted this report. |
|
AMD RDNA3 (native wave64) test report for exact head Tested
Not tested
AI use: Claude Code (Claude Sonnet 5.5) ran the build and tests and wrote this report; the numbers are from the runs above. |
|
Independent Radeon iGPU and RTX 5090 check of Tested
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. |
…ink with the dispatch, in both translators) Upstream pull request xcl-dev#2291 (its commit cherry-picked, author kept) gives every entry of a loop in a compute program its own count of passes: the dispatch's share of 2^28 passes for a thread group among the group's threads, between 1024 and 65 536. The lane's budget of 65 536 for all its loops is per lane, so the GPU time it allows grows with the dispatch: a retail title's program of 4 x 4 x 4 threads dispatched as 16 x 16 x 16 groups with a loop count that never comes was measured upstream at about 31 s on a mid-range GPU, past the time Windows gives a GPU before it resets the driver. That commit covers the HLSL path. Compute programs here run through the direct DXIL translator, so its plain form gets the same bound: the loop directly around each loop of the CFG (cfg::loop_parents), a count for each loop set at the program's entry and set back at the head of the loop around it, from the same io slot. A loop that runs out ends the thread's program there. ExecuteIndirect dispatches, the compact form and the per-lane form keep the lane's budget alone. XCL_DISPATCH_LOOP_BUDGET=0 leaves the slot empty: as before. Software adapter, whole library suite on the branch: 1352 passed, 0 failed, 24 ignored; 54 tests that open the hardware GPU not run; the GPU tests of the bound (gpu_direct_compute_loop_passes_follow_the_dispatch, gpu_compute_loop_passes_follow_the_dispatch) printed SKIPPED there and have not run on this tree. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Requested by Prime · project thread
A lane may run 65 536 loop passes before
LOOP_GUARDends 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 askEm::loop_guardfor 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 getsuint xcl_nK = xcl_cap;before it andif (xcl_nK == 0u) break; xcl_nK--;in front of the existing guard; the entry point setsxcl_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
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.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:
PR:
Not tested
AI use
🤖 Generated with Claude Code