Repository navigation
Recompiler: enforce LOOP_BUDGET at loop headers in per-lane lowering - #2769
Saksukella wants to merge 2 commits into
Conversation
|
Independent amd-win test report (claim: #1607 (comment)) Tested: head Commands (
Results
Attribution (alone, SKIPPED: 4 lines, all Diff review: read the 3-file diff; no concrete defect found. The 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. |
gut0to
left a comment
There was a problem hiding this comment.
AI-assisted review (OpenAI GPT-6). I checked the SSA budget flow against the other lowering backends; I did not run tests or the game.
| } | ||
|
|
||
| #[test] | ||
| fn infinite_loop_exits_at_loop_budget() { |
There was a problem hiding this comment.
Var::Budget is initialized at entry and then consumed at every detected loop header, matching the shared xcl_budget in the other backends. This regression covers only one self-loop, so it does not pin SSA propagation through nested headers. Could you add a nested-loop case that shows the inner loop consumes the same per-lane budget and the total work remains bounded, rather than accidentally reinitializing at an inner header? AI-assisted review (OpenAI GPT-6); I checked the new lowering against the shared-budget paths in emit.rs and dxil/kernel.rs, but did not run tests or the game.
|
Added |
…xcl-dev#2818 (loop budget, wave32 mask kill, SDWA SDST, u32x2 routing)
|
Tested on the current Tested: RX 6800 (RDNA2, driver 32.0.21045.5002), Windows 11 Pro 26200, Rust 1.100.0, debug. This head
Review
Not tested: AI use: Claude Code (Claude Opus 5.5) read the diff and |
What 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_budgetandnested_loops_share_loop_budget_across_headersverifying 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.