Recompiler: XCL_LOOP_BUDGET sets the loop iteration budget of a lane #1284
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!1284
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1284"
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?
@upipibi on GitHub · 2026-11-24 14:19 UTC · original
upipibi:feat/loop-budget-env→main· +67 −4 · 4 files · 2 commits · openLOOP_GUARDcaps every lane at 65 536 loop iterations. In the stops of #505, the GPU runs translated compute loops at 100 % for tens of seconds. The current reading there is that the loops run on data a skipped dispatch never wrote:If that reading holds, the budget is what finally ends those loops. There was no way to try a lower one without editing the prelude, so this adds a switch for it. It is a diagnostic, not a fix: the default does not change.
Part of #505.
What is in it
gpu/recomp/mod.rs:loop_budget()readsXCL_LOOP_BUDGET. A whole number from 1 sets the budget; anything else keeps 65 536. Documented atLOOP_GUARD.gpu/recomp/emit.rs: with the variable set to anything but 65 536, the prelude'sstatic uint xcl_budget = 1u << 16;becomesstatic uint xcl_budget = <n>u;. Unset, the HLSL is byte for byte as onmain, so DXIL cache keys and driver blobs stay valid (an earlier head wrote a#defineinto every prelude; changed after @not-rex's point on #505).gpu/recomp/pso.rs:XCL_LOOP_BUDGETjoins the switches whose translations are not cached in memory or on disk (cache_allowed, and its test). DXC's cache is keyed by the HLSL, so it stays correct. The first run with a new value recompiles every shader it meets.gpu/recomp/tests.rs:loop_budget_reads_a_whole_number_from_onechecks the parser.gpu_loop_budget_caps_a_loopruns a loop whose exit never comes (s_cmp_lgagainst 0 after the first increment). It checks that the unset translation keepsmain's prelude line, then that the loop stops after 4 096 iterations with the budget at 4096, and 61 440 iterations later at 65 536.Tested
f3eb053applied onmain1a0bbe3, debug, Windows 11,cargo test -p xcl --lib -- gpu:: --test-threads=4. RX 9070 XT (RDNA4, native wave64):gpu_loop_budget_caps_a_looppasses; 631 passed, 2 failed, 22 ignored (the 2 are #2115's AMD fuzz seeds, the same onmain). RTX 3060: the new test passes; 633 passed, 0 failed, 22 ignored.f3eb053f(rebased ontomain426a5a74, the firstmainwith green CI after5478c4a7, whose two failing tests main fixed in0d13b071), RTX 3070 (616.56):gpu_suite (--skip gpu_sparse_vram) 144 passed, 0 failed withXCL_DIRECT_DXIL=0and with=1.main426a5a74gives 143 passed on both.cargo build --workspace+cargo test --workspace --no-fail-fast -- --test-threads=4:3980a81(before the rebases; the current head isf3eb053): 753 passed, 0 failed, 41 ignored;main930e8b4: 751 passed, 0 failed, 41 ignored, same machine.gpu_geometry_wave32_prefix_count_over_a_maskandgpu_wave32_program_in_wave64_hardware.XCL_LOOP_BUDGET=4096 cargo test -p xcl --lib loop_budget: 2 passed. The budget follows the variable.Dispatch(4,1,1)to reach 65 536 iterations. At 4 096 it is 16 times shorter.Regression run
Pair for the current head
f3eb053againstmain1a0bbe3, run by thehollowedone (comment, thanks): RTX 3080 Ti (621.35), stockscripts/smoke.ps1, clean release builds, 60 s. Pasted unedited. Their note: it checks the default startup path; the world load and a non-defaultXCL_LOOP_BUDGETwere outside these runs.Earlier pair, for the old head
0b28a6b, from Kalmarv's run (thanks):From Kalmarv's run on an RTX 5070 Ti (NVIDIA 610.74),
main20cf130and this head0b28a6b, 60 s each (#1284), thanks:Not tested
mainsends enormous compute programs to the direct DXIL translator, which uses its fixeddxil::lower::LOOP_BUDGET.XCL_LOOP_BUDGETsets only the HLSL path's budget, so it doesn't reach those programs.AI use
🤖 Generated with Claude Code
@futurepro62 on GitHub · 2026-11-24 14:34 UTC · original
Full-suite run, since this PR has no test report yet. Tested exact head
e1573e3(on its base930e8b4).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 753 passed, 0 failed, 41 ignored. SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.loop_budget_reads_a_whole_number_from_one,gpu_loop_budget_define_caps_a_loop.Not tested
AI use
@Kalmarv on GitHub · 2026-11-24 15:25 UTC · original
Regression pair for
3980a81againstmain930e8b4(this PR's base), on a retail title, for the Regression run section. Both runs pass: no device removal, no crash, 101 % ofmain's frames, 105 % of its peak commit.Tested
scripts/smoke.ps1, the same retail title for 60 s each:mainat930e8b4(this PR's base) first, then this PR's head, one after the other on the same machine.XCL_LOOP_BUDGETwas unset, so the PR's run used the default budget.main930e8b4:this PR,
3980a81:For #505 (earlier runs, not this pair). On this machine the 100 % phase before the removal is one dispatch: the BVH builder's refit program (
cs b6043104de672057), whose threads climb parent links, and a local build ofmainthat skipped it had no device removal. A lowerXCL_LOOP_BUDGETcaps exactly that climb.Not tested
XCL_PSO_WAIT_MS=50+XCL_LOOP_BUDGET=4096for 300 s (one1573e3, before the last push): it ended at 118 s in the known title crash at+0x2215c35(#1270), before the point where #505 stops. It may have reused cached programs built with the default budget, so it does not show the 4096 budget applied. There is nomainrun with these settings.AI use: Claude Code (Claude Opus 5.5)
@not-rex on GitHub · 2026-11-24 19:14 UTC · original
RTX 3080 (10 GB, driver 610.88, Windows 11), retail 1.0.2.1 into the world: with
XCL_LOOP_BUDGET=4096the GPU no longer hangs; it works in bounded bursts and the title keeps presenting for about 110 s longer, until a different fault in the title.Tested
main930e8b4+ #1123 + #1254 (diagnostics) + this PR at3980a81(clean merge), release. Warm DXIL cache and save from earlier runs, no full pipeline precompile.XCL_PSO_WAIT_MS=50, A pressed at 30 and 40 s,XCL_ACTIVITY=1,XCL_NETWORK=0, 400 s limit, GPU sampled withnvidia-smievery 2 s. One run with the budget; the comparison run is the same tree without this PR (without the variable this PR leaves the HLSL unchanged).maintree)XCL_LOOP_BUDGET=4096ListX #101#101GPU queue.Wait … did not complete within 5000 ms0x887A0006(hung) at 168.5 s0xC0000005at+0x4e8b4be(read at -1, about ten threads at once) at 241.3 sWith the budget, the title limps on at about 1 present and 40-60 submissions per 2 s for ~110 s after the point where the tree without it hangs, and the GPU keeps coming back between bursts. That fits the reading on #505 that the stop is loops running long on data a skipped dispatch never wrote. The title then faults at
+0x4e8b4be, which I haven't seen in any other run on this machine; it may be what a capped loop leaves behind.Not tested: other budgets (4096 only); more than one run; without
XCL_PSO_WAIT_MS; AMD.AI use: Claude Code (Claude Opus 5.5) ran the runs on my machine through a scripted runner and wrote this report.
@upipibi on GitHub · 2026-11-24 23:32 UTC · original
Rebased onto
main20cf130(now0b28a6b). One conflict inrecomp/mod.rs: #1307'sSTRUCTURED_BYTES_PER_CODE_BYTElanded next toloop_budget; both are kept, unchanged. RTX 3070, driver 616.56: tests matchingloop_budget/loop, 23 passed, 0 failed, with and withoutXCL_DIRECT_DXIL=1.@upipibi on GitHub · 2026-11-24 23:39 UTC · original
The rebase onto
20cf130moved the head to0b28a6b, so thePR descriptioncheck now wants the Regression-run pair made on that head. The pair in the description (Kalmarv's, thanks) is for3980a81. The rebase changed only the conflict lines inrecomp/mod.rs;loop_budgetis untouched and the suite passes. I can't make a smoke run here (no title). If someone with one has a minute, ascripts/smoke.ps1pair ofmain20cf130and0b28a6bwould clear it, and I'll paste it in with credit.@Kalmarv on GitHub · 2026-11-24 23:45 UTC · original
@upipibi on it: a
scripts/smoke.ps1pair ofmain20cf130and0b28a6bon an RTX 5070 Ti is queued behind a run that's using the GPU now. I'll post both blocks here within the hour.AI use: Claude Code (Claude Opus 5.5) wrote this.
@Kalmarv on GitHub · 2026-11-25 00:03 UTC · original
@upipibi here is the pair.
scripts/smoke.ps1, the same retail title for 60 s each, one after the other, release builds from clean trees. RTX 5070 Ti (NVIDIA 610.74), Ryzen 9 9950X, Windows 11 26200. A separate NVIDIA driver build was running in another process during both runs.main20cf130:#1284
0b28a6b:1289 / 1279 frames (101 %), peak commit 27396 / 26967 MB (102 %), no device removal or crash on either run. No out-of-memory or exception lines in either log.
AI use: Claude Code (Claude Opus 5.5) ran the pair and wrote this.
@JJAutoCompare on GitHub · 2026-11-25 03:00 UTC · original
XCL PR #1284 — Intel Arc A770 loop budget compatibility
Tested
Commands
Process environment for both commands (XCL_LOOP_BUDGET unset).
Prebuilt the library test executable outside the Arc lock (Cargo reported 1m 02s).
Exact test arguments for the Cargo-reported executable.
The GPU command ran in a child Windows PowerShell with -NoProfile -NonInteractive -ExecutionPolicy RemoteSigned -EncodedCommand, with the test executable path passed through XCL_PR1284_LIBTEST_EXE. RemoteSigned applied to that process only. The machine policy was unchanged.
Logs beside this report include prebuild.log, prebuild.jsonl, parser.stdout.log, parser.stderr.log, gpu.stdout.log, gpu.stderr.log, and run-status.log.
Not tested
AI use
@thehollowedone on GitHub · 2026-11-25 12:14 UTC · original
Here is the requested pair from the stock
scripts/smoke.ps1on clean release builds of main 1a0bbe3 and PR head f3eb053.RTX 3080 Ti (621.35), Ryzen 7 9800X3D, Windows 11 build 26300, Rust 1.99.1 MSVC. Both runs used separate copies of the same starting profile and DXIL cache seed, networking and PSO preload off, a 16 GiB job commit cap, and a 12 GiB system commit floor.
XCL_LOOP_BUDGETwas unset and no input was sent. Both runs completed normally.This checks the default startup path. World load and the non-default loop budget were outside these runs.
AI-assisted. Codex (GPT-6, exact variant unavailable) ran the smoke pair and drafted this report.
@DarkPanda69 on GitHub · 2026-11-25 13:26 UTC · original
AMD run (listed as untested), plus an RTX 3060: the new GPU test passes on both.
Head
f3eb053applied onmain1a0bbe3, debug, Windows 11 Pro 26200,cargo test -p xcl --lib -- gpu:: --test-threads=4:gpu_loop_budget_caps_a_loopok. 631 passed, 2 failed, 22 ignored, 6 SKIPPED; the 2 failures are the AMD fuzz seeds tracked in #2115, the same onmain.Not tested: a title with or without
XCL_LOOP_BUDGET, Wine.AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
@DavidM1911 on GitHub · 2026-11-26 01:17 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.Thanks!
— Devin
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.