kernelx: keep failed lazy commits in lazy set and report in crash line #488
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!488
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-488"
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?
@7ROBE on GitHub · 2026-11-24 00:59 UTC · original
7ROBE:fix/lazy-commit-failure→main· +108 −4 · 2 files · 1 commits · openWhat is in it
Fixes #467.
crates/xcl/src/hle/kernelx/lazy.rs: incommit, checkLAZY.contains(&page)first and onlyLAZY.remove(&page)afterVirtualAlloc(MEM_COMMIT)succeeds. On failure, leavepageinLAZYand record the failure count, last failing page address, andGetLastError()in atomics (no allocation or logging inside the vectored exception handler), exposed viafailure_summary().crates/xcl/src/eh.rs: inunhandled_filter, appendlazy::failure_summary()(lazy commit failed N times, last 0x... (err)) to the crash line when non-empty.hle::kernelx::lazy::tests::failed_lazy_commit_stays_lazy_and_reports_in_crash_line(spawns a child test process inside a Job Object withJOB_OBJECT_LIMIT_PROCESS_MEMORY) verifying that a page under the limit commits, a page past the limit stays inLAZY, and the unhandled-exception crash line includeslazy commit failedand1455 ERROR_COMMITMENT_LIMIT.Tested
cargo build --workspace(XCL_ADAPTER=radeon): passedcargo test --workspace -- --test-threads=4(XCL_ADAPTER=radeon): 677 passed; 0 failed; 41 ignoredxcllib:637 passed; 0 failed; 21 ignoredconsole_dlls_e2e:13 passed; 0 failedconsole_shaders:3 passed; 0 failed; 4 ignoreddisasm_e2e:1 passed; 0 failede2e:3 passed; 0 failedgpu_compute_e2e:2 passed; 0 failedgpu_pso_e2e:7 passed; 0 failedheap_probe:0 passed; 0 failed; 4 ignoredpls_quota:1 passed; 0 failedpredication_e2e:1 passed; 0 failedrpf_e2e:2 passed; 0 failedtexture_states:1 passed; 0 failedxg_oracle:6 passed; 0 failed; 12 ignored.\scripts\smoke.ps1 -Game "<game folder>" -Seconds 60(XCL_NETWORK=0,XCL_ADAPTER=radeon):Not tested
AI use
github-bot referenced this pull request2026-11-26 04:59:09 +00:00
@futurepro62 on GitHub · 2026-11-24 03:04 UTC · original
Tested exact head
bd7b9e4(on its base2997c9a): the new test fails intermittently here.Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 636 passed, 1 failed, 21 ignored in the lib tests (the run stops there): The child process overflows its stack instead of printing the crash line, so none of the threestderrchecks can pass.cargo test -p xcl --lib -- --exact hle::kernelx::lazy::tests::failed_lazy_commit_stays_lazy_and_reports_in_crash_line, 3 runs: failed, failed (same stack overflow), passed. So 3 failures in 4 runs counting the suite run.gpu_uma_import_check_at_init,gpu_typed_buffer_loads_and_stores,gpu_valu_16_and_64_bitandgpu_wave32_and_wave64_src_vccz_execz(the #344 deadlock, whichmainhas too and #443 fixes); I stopped it after 900 s and reran.Not tested
AI use
@futurepro62 on GitHub · 2026-11-24 04:44 UTC · original
Follow-up to my report above: why the new test's child overflows its stack, and a test-only change that makes it pass reliably here. The fix in
commititself looks right: whenever the child reaches the crash line, it showslazy commit failed 2 times, last 0x… (1455 ERROR_COMMITMENT_LIMIT).Two causes, both in the test's set-up of the commit-limited child
let mut stack_warm = [0u8; 64 * 1024]lives in the test function's own frame. The crash handler (eh::unhandled_filter, with itsformat!s,stack_callersand register descriptions) runs below that frame, in stack that was never touched. Under the job limit Windows cannot commit those pages, so the guard-page fault becomes a stack overflow (thread '…' has overflowed its stack) before the crash line is printed. A bigger array in the same frame doesn't help. Warming from a separate#[inline(never)]function does, because the pages it touches below the current frame stay committed.unhandled_filter→obj(v)→gpu::shader::readable→gpu::uma::get()initialises UMA lazily. In the child that happens inside the crash handler, after the lazy pages have used up the job's headroom, so it fails (UMA: could not reserve 2048 MB …) and a following allocation aborts (memory allocation of 720 bytes failed). Even with UMA set up earlier, the crash line's own strings sometimes need a new heap commit that the limit refuses (memory allocation of 726 bytes failed). Neither affects a title (UMA is set up long before any crash), but both make the test flaky.Measured (head
bd7b9e4; the child run directly,XCL_LAZY_LIMIT_CHILD=1 <lib test exe> --exact hle::kernelx::lazy::tests::failed_lazy_commit_stays_lazy_and_reports_in_crash_line --nocapture, local edits reverted after)#[inline(never)]fnuma::get()before the limituma::get()+ heap grown before the limitWith the last set-up, the test itself (
cargo test -p xcl --lib -- --exact …) passed 10 of 10 (before: 1 of 4), and the parallel lib run (--test-threads=4,XCL_REQUIRE_GPU=mesh) passed 2 of 2 (637 passed, 0 failed, 21 ignored).The change (test only; replaces the two
stack_warmlines):Not tested
cdbhere); the reasoning above comes from the experiments in the table. Whether the heap pre-growth holds on other machines (it relies on the process heap keeping freed small blocks committed). AMD, a release build.Hardware: NVIDIA GeForce RTX 5070 Ti (616.64), Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, debug.
AI use
@oz-stanislav-zhukov on GitHub · 2026-11-24 06:51 UTC · original
AI Qwen (agent) — follow-up test report, 2026-11-24
Tested this PR stacked on fresh
main(beaa245, which includes #797, #795, #798, #792, #713, #762, #634, #347, #490, #443, #348, #484, #690, …). Hardware: RTX 5060 Ti 16 GB, Windows 10 22H2 (19045), D3D12 Agility SDK 1.620.2 (stock driver reports SM 6.5, the game needs 6.6). Release build with line tables (CARGO_PROFILE_RELEASE_DEBUG=line-tables-only) so crash offsets resolve againstxcl.pdb.Title: GTA VI (Scarlett)
RockstarGamesInc.28872443D20A71.0.2.1,game_scarlett_master.exe.Results:
The #477 crash does not reproduce with this PR. Clean
maincrashes early in world loading with0xC0000005read of 0x80 bytes at window offset 0x16000 (stack throughhashbrownmap ops during thread spawn, preceded byDirectStorage: a request failed (0x89240009)on a.ttpf). With this PR merged, that crash and anylazy commit failedlog line are gone across multiple runs.The game now reaches the world and renders: stable ~28–30 fps, audio (Opus via xapu) decodes fine (23 892 packets, 0 errors), shaders translate and compile (0 skipped draws/dispatches).
It then crashes further along the same game-side call chain (game frames
+0x4daa2c8, +0x979f5b, +0x4fb0c2f, +0x50bb3f0are identical to the pre-fix crash), but inside different XCL code:0xC0000005write of 0x800 bytes at0x8225e60c0, top framexcl::vfs_hooks::move_file_a(vfs_hooks.rs:618) called fromxcl::hle::xgameruntime::gamesave::each_blob(gamesave.rs:392) — i.e. the game moves a file (ANSI API) while enumerating gamesave blobs.0xC0000005write of 0x800 bytes at0x8003ff940(faulting instruction in VCRUNTIME140 memcpy), top framexcl::hle::xg::copy_from(xg.rs:712, the detile→rows loop), second stack entryxcl::hle::d3d12x::fence_x::completed_value_address(fence_x.rs:92).Both destinations look like title-memory buffers whose target page is not committed at copy time.
Still visible in the log up to the crash:
DirectStorage: a request failed (0x89240030)repeatedly (12 KB chunks), and BCPack refusals accumulating (BC1/BC5/BC6H/BC7 — mode 6/7 unsupported), consistent with #505. Failed texture-streaming requests plausibly leave the destination regions uncommitted, which would explain both crash variants above (the game later copies into/out of those regions).Since the run-B crash sits in
CopyFromSubresource, I also cherry-picked the two commits from the closed PR #539 (7d1c466guard the destination span,9c4c3e6fix the 7-argument ABI with the extra u32 before src) onto this branch and re-ran:CopyFromSubresourcewas only entered twice in the whole run and both calls succeeded (per the new OK-path log); noinvalid spanwarnings.0xC0000005, now a write to 0x0 in game code (game_scarlett_master.exe+0x23cf683, rax=rbx=rbp=0), stack+0x4e4ba89 → +0x2215c35 → +0x71b9a20 → +0x2215eca; the previous best run crashed in the same game-side function region (+0x71b9b10). So the next blocker is one level deeper in the title's own streaming path, not inCopyFromSubresourceitself.DirectStorage: a request failed (0x89240030)and 27 BCPack refusals (#505 territory), 0×lazy commit failed.So: this PR is a real forward step (it removes the first hard crash on this title) and I'd vote to merge it; the next blocker looks like the DirectStorage-failure → uncommitted-region chain (#505 territory) rather than the lazy commit itself. All observations above were produced by AI Qwen running the title under XCL; no promises made on behalf of the account owner.
@asd3670576 on GitHub · 2026-11-24 10:43 UTC · original
Built and tested the PR head on a Windows 10 machine that has no Shader Model 6.6 and only a GNU toolchain, because the job-object test in this PR is the one that decides whether the fix is verifiable. Every count below is pasted from the run, not written by hand.
Machine
x86_64-pc-windows-gnu(no MSVC, no Windows SDK:cargo buildhere needs MinGW-w64 on PATH or it dies witherror calling dlltool 'dlltool.exe': program not found), Ryzen 9 5950X (32 logical CPUs), 64 GB RAM.H:\leonida\dxc\bin\x64(XCL_DXC_DIR). Agility 1.620.2 atH:\leonida\agility\build\native\bin\x64(XCL_D3D12_DIR) but it cannot load on this OS build (noID3D12SDKConfiguration1before KB5029331), so the inbox runtime caps at Shader Model 6.5 and XCL's GPU recompiler path is unavailable here.xcl-smokeblock from this machine.Apply / build
git fetch https://github.com/ivall/xcl pull/488/head:pr488→bd7b9e4abd0bfc95fc9b5e1dcae0477831461f95, checked out as-is: no rebase, no conflict resolution,git status --porcelainempty before the build and after it. The API reportsmergeable: true,mergeable_state: unstableagainst currentmain.cargo build --release --workspace→ exit code 0:One earlier build attempt here failed with three errors in
gpu/recomp/runner.rsandgpu/recomp/emit.rs(cannot find function sm65 in module super::pso,cannot find function wave_size); those came from an unrelated uncommitted edit in this working tree, not from this PR. Reverted and rebuilt clean.Tests
cargo test --release -p xcl --lib -- kernelx::lazy, three runs on the default thread count (this is where the flakiness shows):run 2, the failing one:
The same test by name,
cargo test --release -p xcl --lib -- --exact hle::kernelx::lazy::tests::failed_lazy_commit_stays_lazy_and_reports_in_crash_line, three runs — failed 3/3:So on this machine the test passes 2 of 3 times only when it runs next to the other
lazytests, and not once out of three when run alone. Both symptoms from @futurepro62's table show up here: the stack overflow, andmemory allocation of 770 bytes failedright afterUMA: could not reserve 2048 MB.cargo test --release -p xcl --lib -- gpu::recomp::dxc:cargo test --release --workspace --no-fail-fast -- --test-threads=4→ exit code 0. 16test result:lines (one per test binary plus the doc-test run); the xcl lib is:all 16 are
ok; summed over them: 677 passed; 0 failed; 41 ignored, which is the same total as in the description. The new test also passed inside that run. Skips, reported rather than counted as coverage: 86SKIPPEDlines, 84: no GPUand 2: no wave64, for exampleForcing the requirement shows the SM 6.5 cap directly (
XCL_REQUIRE_GPU=mesh cargo test --release -p xcl --lib -- --exact gpu::recomp::tests::gpu_bvh_intersect_ray):What this machine can and cannot verify. It cannot put any pressure on the commit limit: 64 GB of RAM against a 153 GB commit limit with 125 GB of it free, so the only commit-limit failure this PR's code ever sees here is the one the Job Object forces inside the test. That makes the test the whole verification of the fix - and it is the part that is unreliable here. With two other reports already showing the same child-process stack overflow on MSVC and Windows 11, this looks like a property of the test's set-up rather than of one machine; a release build on
x86_64-pc-windows-gnuwith a 32-thread host still hits it. What this box does add: the fix itself is a two-line ordering change incommitplus atomics, the other 676 workspace tests are unaffected, andeh.rs's newfailure_summary()call did not destabilise anything here. It cannot say anything about the GPU surface (SM 6.5 → 84 skips) and it ran no title, so there is no regression block from this machine.AI use: an agent (DeepSeek Harness, "auto" route - I do not know the underlying model) built the head, ran the tests and pasted the output.
@upipibi on GitHub · 2026-11-24 14:07 UTC · original
This and #487 (opened a minute earlier) both fix #467 the same way at the core. A lazy page whose
MEM_COMMITfails stays in the lazy set, and the last failure (page,GetLastError, count) goes into the crash line. Where they differ:lazy::ensurereturnbool.eh.rs's writability check anddstorage.rsthen treat a failed commit as unwritable instead of going on to touch the page. This PR keepsensureas it is.ERROR_COMMITMENT_LIMITand the like). It also has a test that runs a child process under a commit limit, so the failure path itself is exercised. #487's diff has no test of the failing commit.The two conflict in
lazy.rs. A maintainer may want #487's caller change together with this PR's test. Read from the diffs only; I have not run either.AI-assisted (Claude Code).
@crosettiremi on GitHub · 2026-11-24 15:43 UTC · original · edited 2026-11-24 15:44 UTC
One downstream Windows/RDNA3 integration result for
bd7b9e4. I ran the workspace serially on main930e8b4plus this change, local physical-page range validation and the graphics changes from #789/#968/#1248/#640. One library test failed. Its diagnostic was:The failure is in the child used by the test. This was a combined checkout. On the title route, the comparison build without #488 had a second-chance write access violation on a DirectStorage thread in write_physical_pages. The next two runs on the combined checkout both reached the story card and exited later with different driver errors. I did not capture a failed lazy commit on that route, so these results do not establish its cause.
Follow-up control: I checked out the unmodified PR head
bd7b9e4in a separate worktree and ran the exact focused test. It independently failed with the same missing 0xc0000005 and child stack-overflow diagnostic (0 passed, 1 failed).@thehollowedone on GitHub · 2026-11-25 06:19 UTC · original
I checked futurepro62’s test-only setup on bd7b9e4. Windows 11 build 26300, Rust 1.99.1 MSVC, debug build, RTX 3080 Ti host. These tests are CPU-only.
Tested
cargo test --offline --locked -p xcl --lib hle::kernelx::lazy::tests -- --nocapture --test-threads=1passed 3/3 on the published head. Running the built test executable with--exact hle::kernelx::lazy::tests::failed_lazy_commit_stays_lazy_and_reports_in_crash_line --nocapture --test-threads=1in 20 fresh processes passed 4/20. The child reported 15 stack overflows and one allocation failure.Not tested
Workspace suite, release, GPU, or retail behavior.
AI use
Codex (GPT-6, exact model variant unavailable) ran the tests and drafted this report.
@DavidM1911 on GitHub · 2026-11-25 14:06 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: 1038 passed, 1 failed in one parallel run; the failing test passes on a single-threaded rerun (1039/0). Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.Thanks!
@ddaikodaiko on GitHub · 2026-11-25 16:52 UTC · original
Test report:
failed_lazy_commit_stays_lazy_and_reports_in_crash_linefails on this PR's headCommit tested:
bd7b9e4(this PR's head). NVIDIA GeForce RTX 3060 Ti (driver 32.0.16.2140), AMD Ryzen 5 1600, 16 GB, Windows 10 22H2 19045, rustc 1.100.0, release.cargo test --release -p xcl --lib hle::kernelx::lazy: 2 passed, 1 failed. The child process dies before the crash line is written:Two causes, both in the test (the change to
commit()itself looks right):stack_warmis an array in the test's own frame, so it commits the pages above the stack pointer. The exception dispatch andunhandled_filterrun below it, on pages that are not committed yet, and with the job's limit used up the stack cannot grow.memory allocation of N bytes failed: at the limit, an allocation (theVecinensure, then the crash line'sformat!s) fails before the line is written.A version that passed 40 of 40 runs here:
VirtualAlloccommits, callcommit(page)directly (no heap in between), then release the filler;LAZY,FAILED_COMMITS == 1,LAST_FAILED_ERR == ERROR_COMMITMENT_LIMITand thatfailure_summary()names 1455;0xc0000005andlazy commit failed 2 times.With
commit()reverted to remove-before-commit, this version fails on "a page whose commit failed stays lazy". Diff against this PR's head (bd7b9e4), test only:lazy.rs test change
Not tested: AMD GPUs, Windows 11, debug builds.
Tool: Claude Code, Claude Opus 5.5 (ran the tests, wrote the test change and this report).
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.