Recompiler: enforce LOOP_BUDGET at loop headers in per-lane lowering #2769
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2769
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2769"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Saksukella on GitHub · 2026-11-26 11:33 UTC · original
Saksukella:fix/per-lane-loop-budget→amd-dev· +90 −10 · 3 files · 1 commits · openWhat is in it
crates/xcl/src/gpu/recomp/ssa.rs:Var::Budgetto track remaining loop-header iterations (LOOP_BUDGET = 1 << 16) per lane in the per-lane SSA lowering backend.crates/xcl/src/gpu/recomp/lower_dxil.rs:Var::Budgettoi32inDxilIr::ty()and add theVar::Budgetarm inDxilIr::escape().crates/xcl/src/gpu/recomp/lower.rs:rpo_pos[b] >= rpo_pos[s]), split each loop header into a budget-check entry block and continuation block (budget_cont), initializeVar::Budgettocrate::gpu::dxil::lower::LOOP_BUDGETat block 0, and branch toexitwhen the counter reaches 0 (otherwise decrement and continue).XCL_PER_LANE=1into parity with the HLSL backend (recomp/emit.rsxcl_budget = 1u << 16) and the per-instruction Direct DXIL backend (gpu/dxil/kernel.rsVAR_BUDGET), preventing runaway compute shaders (e.g. zero-stride or wrapping loop bounds) from hanging the GPU until Windows TDR (0x887a0006).infinite_loop_exits_at_loop_budgetverifying an unconditional back-edge loop exits cleanly after exactlyLOOP_BUDGETiterations.amd-dev.Tested
32.0.32029.2010), 24-thread x86_64 CPU, 32 GB RAM, Windows;rustc 1.100.0 (0ef1bc386 2026-11-09); debug (tests) and release (xcl.exe).cargo test -p xcl --lib gpu::recomp::lower::tests: 37 passed, 0 failed (0.43s), includinginfinite_loop_exits_at_loop_budget.Regression run
Not tested
AI use
XCL_GPU_CULPRIT/ DRED TDR diagnosis, DXBC disassembly comparison across backends, writing theVar::Budgetper-lane lowering patch and unit test, and running local tests and smoke verification. All diffs and measurements were verified locally on hardware.@oni-swr on GitHub · 2026-11-26 11:47 UTC · original
Independent amd-win test report (claim: #1607)
Tested: head
4dcc796b9d82220a3655494250bbdd4e00fcc560(unchanged since claim; no other reports) vs. baseb5c0275f(merge-base onamd-dev).Hardware: RX 7800 XT, Ryzen 7 5700X3D, Windows 11 Pro 10.0.26200, debug build, stable-x86_64-pc-windows-msvc. Not release, not a retail title.
Commands (
CARGO_TARGET_DIRseparate,-j 4):cargo test -p xcl --lib -j 4 -- --test-threads=4 --skip placed_title_textures_share_vram_and_preserve_pixels--test-threads=1, on head and on basecargo test -p xcl --lib -j 4 -- --test-threads=1 recomp::Results
gpu::recomp::lower::tests::infinite_loop_exits_at_loop_budget: passes.recomp::alone: 416 passed, 2 failed, 20 ignored (failures:f32_programs_on_the_gpu,a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier).placed_title_textures_share_vram_and_preserve_pixelsalone on head: passes.Attribution (alone,
--test-threads=1): the same 10 tests fail on base and on head:fuzz_validate_and_gpu_1(#2115),dispatch_chain_native_wave64_builds_whole,a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier,f32_programs_on_the_gpu,a_dispatch_with_a_pipeline_still_building_waits_at_the_submit,a_put_off_dispatch_runs_at_the_submit_when_its_build_outlasts_the_wait_budget,bitset_runs_emit_exact_contiguous_page_ranges,giant_driver_compiles_have_their_own_lane,title_bytes_are_used_in_place_when_all_are_readable,physical_home_without_sparse_windows_uses_coherent_window. The 11th,two_pass_binds_set_the_shared_view_heap, fails only in the parallel run and passes alone on both. So no failure I found is caused by this PR. I did not investigate the root causes of the pre-existing ones.SKIPPED: 4 lines, all
f16_programs_on_the_gpu(f16 arithmetic and packed, wave32/wave64, per-lane form refused: V_MUL_F16 / V_PK_MUL_F16, #1426). These are not coverage.Diff review: read the 3-file diff; no concrete defect found. The
LOOP_BUDGETcap is exercised only by the CPU-interpreter test, so the GPU (DXIL) path of the new loop-header block is covered only by the existing per-lane GPU tests, which do not include a loop that hits the budget. I did not run a retail title orscripts/smoke.ps1.AI use: Claude Code (Claude Sonnet 5.5), coordinated by Claude Code (Claude Opus 5.5). Results are from real runs on the hardware above.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.