D3D12.X: reject PAGE_GUARD/overflow in cpu_writes and handle stale fence wakeups #1369
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1379"
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?
Imported from ivall/xcl. Originally posted by b3IKK on 2026-11-24T15:24:31Z.
Fixes two bugs in
crates/xcl/src/hle/d3d12x/cpu_writes.rs:writable()andwrite_now()omitted thePAGE_GUARDcheck and overflow-checked arithmetic thatwrite_u64_now()already performed, so aPAGE_GUARDpage reported writable and could fault the worker thread on store, and largeva + lenvalues overflowedusize.WaitForSingleObjectcall: if an earlier job timed out and its fence completed later while waiting on a subsequent job, the stale signal woke the worker prematurely and applied bottom-of-pipe writes before the GPU finished.This shares one
is_writable_committed()helper acrosswritable(),write_now(), andwrite_u64_now(), and extractswait_for_fence()which resets the event before arming and loops untilGetCompletedValue() >= valueor the wait deadline expires.What is in it
crates/xcl/src/hle/d3d12x/cpu_writes.rs: unifyPAGE_GUARD+ checked bounds inis_writable_committed(); addwait_for_fence()deadline loop withResetEvent; add unit testswritable_and_write_now_reject_guard_page_and_overflow(verified failing before the fix) andwait_for_fence_ignores_stale_wakeup_from_timed_out_fence.Since the last push: rebased onto
main06c9f55.mainalready hasu64_writable_nowwith thePAGE_GUARDand alignment checks, so only the dword path andwritable()share the newis_writable_committed; the u64 path staysmain's. Thewait_for_fencechange merged unchanged.Tested
stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5, debug (scripts/test.ps1) and release (scripts/smoke.ps1).\scripts\test.ps1(cargo build --workspace+cargo test --workspace -- --test-threads=4): 1267 passed, 0 failed, 46 ignored (SKIPPED: the wave64 / direct-DXIL per-lane tests that need 64-lane hardware or a semantics mode this adapter refuses,no heap windows, andcannot disable the driver cache (Windows Developer Mode is required))cargo test -p xcl --lib cpu_writes: 5 passed, 0 failed (writable_and_write_now_reject_guard_page_and_overflowfailed before the fix)Regression run
main (
426a5a7, clean tree, no local changes):PR (
aaf89e0, clean tree, no local changes):(The main block is
426a5a7, an ancestor of the currentmain, from the same machine and data folder.)Not tested
AI use
main06c9f55, resolved the conflicts, ran the suite and thescripts/smoke.ps1pair at the head above.Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T15:32:30Z.
Full-suite run, since this PR has no test report yet. Tested exact head
7b3fc47(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.writable_and_write_now_reject_guard_page_and_overflow,wait_for_fence_ignores_stale_wakeup_from_timed_out_fence.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4: 753 passed, 0 failed, 41 ignored, no skips.Not tested
AI use
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T16:49:43Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodifiedmain.)Thanks!
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T05:03:19Z.
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.Thanks!
— Devin
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-12-01T02:31:57Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:34:07Z.
Triage (#1607) – head
aaf89e0#1819 (opened later) has the same
PAGE_GUARD/overflow helper and aResetEventbefore arming the fence. It also moves to per-queue workers and 64-bit stores, but it does not loop onGetCompletedValueafter a stale wakeup the way this PR'swait_for_fencedoes. Main still has neither fix.In
cpu_writes.rs,write_nowdrops theuma.in_committed_windowfast path thatwritable()keeps. Every write in unified memory now costs a VirtualQuery, and a rangewritable()accepted can be dropped bywrite_nowif VirtualQuery reports it as more than one region.The branch conflicts heavily with main, where
write_nowbecamewrite_now_inand fence reads go throughreal::fence_completed.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.