kernelx: track paired 64 KiB views across sparse reservations #879
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!879
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-879"
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?
@JFyuhong on GitHub · 2026-11-24 07:18 UTC · original
JFyuhong:codex/track-sparse-mirrors→main· +124 −9 · 4 files · 2 commits · draftA retail title reserves two 24 GiB views of the same physical pages. When its CPU view fits in the sparse windows, the early return in
VirtualAllocleaves that view out of mirror tracking. The Bink decoder writes the CPU view, but the texture upload reads empty memory. Part of #697, found while testing #822 and investigating #675.What is in it
Tested
XCL_SAMPLE_*inputs were unset.cargo build --workspaceandcargo test --workspace --no-fail-fast -- --test-threads=4. Clean main09940bb: 713 reported passed, 3 failed, 41 ignored (2 GPU cases reportedSKIPPEDwithin the pass count). PR head1b2b636: 714 reported passed, 3 failed, 41 ignored (2 GPU cases reportedSKIPPEDwithin the pass count). The native-wave64 cases were skipped on this adapter.cargo test --workspace --no-fail-fast -- --test-threads=1, the same head reported 717 passed, 0 failed and 41 ignored, including the same two GPU skips.cargo test -p xcl --test sparse_mirrors -- --nocapture: both revised cases failed on the old notification behavior and passed on the revision. The existing GPU texture-upload test, extended to hold its texture across unpair/re-pair, also failed on the old code and passed after the notification change.48e7434, cfg(test) tile-identity assertions) to1b2b636in a separate checkout, tree41906742e26b, gave 717 reported passed, 0 failed and 41 ignored, with 2 wave64 skips, using the same workspace build and four-thread test commands. The PR branch itself retains the original cubemap test and the results above.e9705bb) with eight windows, the same saved profile and initial shader cache. Frames 830, 920 and 1010 of the opening movie were uniformly green before the patch. With this runtime change on that same build, those frames showed the full-colour movie and XCL logged the 24 GiB pair. Four windows on unmodified #822 also showed the movie.b54f6fewith four windows, the title reached intro Prestream and ended at+0x23cf683after 222.211 s and 1,625 presents. The four out-of-range RT SRVs all belonged to a distinct 2,199 MiB write-watched allocation. Allocation measurements on #585.Regression run
Release
scripts/smoke.ps1 -Game <read-only retail executable> -Seconds 60, with matching DXC settings.Main:
PR head:
Not tested
+0x23cf683with four and eight windows. With eight windows and this patch, the movie played but XboxBvhBuilder raised the 40-bit destination-address exception tracked in #585. That same error also occurred on clean #640 with its budget off. With 16 windows and the patch on #822 both 24 GiB views were below 2^40, yet Prestream still stopped at+0x23cf683.AI use
@iggyvilla on GitHub · 2026-11-24 07:53 UTC · original
Read of
b54f6fe(nothing built or run by me).1. Creating a pair does not bump
GPU_VIEW_MAP_GEN.reservedinserts intos.gpu(kernelx.rs:190-197) andreleasedbumps the generation when it removes one (:203-211).recheck_gpu_view_sourcesskips work while the generation is unchanged, and a texture registered at that address afterreleased(gpu)was moved back to its ownva. If the title then reserves the same address again andreservedpairs it, nothing tells those entries that backing memory exists again, so they keep reading the empty GPU view until an unrelated mapping change moves the generation. OneGPU_VIEW_MAP_GEN.fetch_add(1, Release)when the pair is inserted would close it, andsparse_mirrors.rs:28-47(the release / re-reserve sequence) could then assert the generation moved on the second pairing too.2. The integration test depends on the machine's memory layout.
assert_eq!(replacement, gpu)(line 36) needsVirtualAllocto hand back the address it just released, which is usual but not guaranteed, andassert!(!uma.contains(gpu) && in_graphics_reservation(gpu))(line 58) asserts which allocator took the second view. With a UMA that has more or larger windows, or afternote_coherent_needgrows the coherent window, that view lands in the UMA, which still registers and pairs (kernelx.rs:296) but fails the assert. Asserting the pairing unconditionally and skipping the host-fallback case whenuma.contains(gpu)would keep the test meaning the same on other layouts.3. Two assumptions worth a sentence in the PR.
reservedreturns at once forMEM_COMMITreservations (t & 0x1000), so a title that commits at reservation time gets no pair; and a GPU view is paired with the most recent unpaired CPU view of the same size, so two interleaved reservation streams of one size would pair the wrong views silently. The retail order (CPU view, then GPU view, reserve only) fits both, and the description could say so.AI use: Claude Code, Claude Sonnet 5.5, read the code at the head above; the points are mine.
@iggyvilla on GitHub · 2026-11-24 09:31 UTC · original
Read of the
1b2b636delta on top ofb54f6fe(nothing built or run by me); it answers the three points of my earlier read.1. The generation gap is closed.
reservednow bumpsGPU_VIEW_MAP_GENwhen it inserts a pair (kernelx.rs:195), andreleasedalready bumped on removal (:204-211), so the pair table and the generation move together on every insert, replace and removal; a CPU view alone does not bump.recheck_gpu_view_sourcesruns first inrefresh_once(title_textures.rs:691), so after the release a texture falls back to its ownvaand after the re-pair it follows the CPU view again. Both directions are asserted: the counter insparse_mirrors.rs(:45no bump for a CPU view,:62release,:71re-pair), and a live texture intitle_textures.rs:1349-1355(src == vaafter the release, the CPU view after the reuse), which fails without the bump because the recheck returns early on an unchanged generation.2. The layout dependence is gone. The two
assert_eq!s on returned addresses are removed;replacementandgpu_againare used as returned. The one remaining allocator assertion,!uma.contains(gpu) && in_graphics_reservation(gpu)(sparse_mirrors.rs:87), follows from the flags: two reservations ofsparse_bytes / 2 + 64 KiBcannot both be sparse, and the flags have neitherMEM_COMMITnorMEM_GRAPHICS(0x1000_0000,kernelx.rs:105), so the second cannot take the coherent window and goes to the watched fallback (gpu_visible_fallback,kernelx.rs:350-353). The new comment in the test says this.3. The two assumptions are in the description ("interleaved same-size streams from different owners are outside that observation"). The silent
MEM_COMMITearly return inreserved(kernelx.rs:186-188) is still only in the code; a clause in its comment would save the next reader the derivation.One test-only coupling. The registry test's
mirrors::reserved(gpu.0, SIZE, ...)pairs with the most recent unpaired CPU view of exactlySIZEin the process-global table. In the same lib-test binary,gpu_view_reservations_name_their_cpu_view(kernelx.rs:2410) registers a 24 GiB CPU view at0x7000_0000_0000and takes no lock, while the registry test holds onlytitle_textures' ownTEST_LOCKandVRAM_TEST_LOCK, so they can run together. What keeps them apart today isSIZE = 24 GiB + 64 KiB(title_textures.rs:1231); if either size moves, the failure depends on interleaving. A#[cfg(test)]lock shared by the two tests, or a size asserted unique on both sides, would turn the comment into a guarantee.AI use: Claude Code, Claude Sonnet 5.5, read both heads and checked each line reference; the points are mine.
@SlopTart on GitHub · 2026-11-24 09:33 UTC · original
Linux / AMD RDNA3 datapoint.
Merged state: head
1b2b636onto main077ce40, clean merge.Full suite,
cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4: 707 passed, 11 failed, 41 ignored; failures are the known Wine-lane set from my #42 rows plus this rig's title-textures flake family (see #718). paired 64 KiB sparse-view tracking green; mirror-upload flake hit.Not tested: retail titles (none here), Windows, RDNA4.
Counts only, no game data.
Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross
x86_64-pc-windows-gnu,XCL_NETWORK=0, release profile,--test-threads=4. My Linux rows: #42 / #718.AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.
@tiagonleal on GitHub · 2026-11-24 12:14 UTC · original · edited 2026-11-24 17:48 UTC
Windows / NVIDIA retail test of
1b2b636merged ontomain47efa2e(clean merge, merged tree2fb8df8).Tested
cargo build --workspace && cargo test --workspace -- --test-threads=4(debug) on the merged tree: 743 passed, 0 failed, 41 ignored. SKIPPED:gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask,gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware(no wave64). Same tree without the PR (47efa2e+ an unrelated one-file netoff change): 742 passed, 0 failed, 41 ignored.scripts/smoke.ps1 -Seconds 60, release, one run each, back to back:Not tested
mainthat ends in the title's GPU watchdog at+0x23cf683on this card, see #846).Run and written with Claude Code (Claude Opus 5.5).
@DavidM1911 on GitHub · 2026-11-25 09:52 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. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.