kernelx: keep AllocateTitlePhysicalPages out of coherent UMA when sparse is on #2135
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!2135
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2135/head"
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?
@Simon-CR on GitHub · 2026-11-25 05:44 UTC · original
Simon-CR:pr/kernelx-no-coherent-spill→main· +44 −1 · 1 files · 1 commits · closed without mergingWhen
AllocateTitlePhysicalPagescannot fit a new physical-page backing allocation inside the sparse windows, it previously fell back tou.allocin the fixed coherent unified-memory window before falling back to plainMEM_RESERVEvirtual memory. Since physical-page homes only need virtual address space, spilling failed sparse allocations into coherent RAM needlessly consumes scarce GPU-visible coherent memory needed by command recordings and readback buffers. Part of #1566.What is in it
alloc_physical_home_blockincrates/xcl/src/hle/kernelx.rsto allocate physical page homes from sparse windows when enabled, skipping coherent fallback directly toMEM_RESERVEphysical_home_block_does_not_spill_into_coherent_when_sparse_enabledverifying coherent UMA remains untouched when sparse space is exhaustedTested
rustc 1.100.0 (0ef1bc386 2026-11-09)cargo test -p xcl --lib kernelx -- --test-threads=1 --nocapture: 41 passed, 0 failed, 1 ignored (scatter_timing)cargo test --workspace --no-fail-fast -- --test-threads=4: 1153 passed, 2 failed (only pre-existinggpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1seed 722 andfuzz_validate_and_gpu_3seed 1599 reproduced on unmodifiedorigin/main6020a33b, tracked in #2115 / #1679), 46 ignored across 21 test targets (debug build)SKIPPEDtests: gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's)); gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's)); gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's)); gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's)); gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's)); gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's)); heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows; shaders::tests::pso_measurement_compiles_an_exact_synthetic_record: cannot disable the driver cache (Windows Developer Mode is required): The application requested an operation that depends on an SDK component that is missing or mismatched. (0x887A002D)cargo build --release -p xcl) and 60 s retail title run (5ec87c56) completed cleanly with 0 device removals and 0 crashesRegression run
Not tested
main(verified during an extended local 240 s soak along with allocator reclamation), NVIDIA GPUs, Intel Arc GPUs, wave32-only GPUs, and Linux/WineAI use
@luckyteagirl on GitHub · 2026-11-25 06:07 UTC · original
Independent native Windows check of exact PR head
8a3e42cec3bb0a583c0abab85b872143f6462406againstmain6020a33b16ba2de25b3aef5947552f2dc1831f09.Hardware/toolchain: Windows 11 build 26200, Ryzen 9 5980HX, Radeon RX 6800M driver
30.0.13002.13003, Rust 1.99.0 MSVC, DXC/DXIL 1.9.2609.5.Tested
cargo test --locked -p xcl --lib -j 2 kernelx -- --test-threads=1 --show-output: 41 passed, 0 failed, 1 ignored on the exact PR head. This includesphysical_home_block_does_not_spill_into_coherent_when_sparse_enabled, which passed separately as a one-test filter too.cargo build --locked --workspace --release -j 2: passed.The short title runs reached only the first frame, with zero draws. They check startup, not a retail sparse-exhaustion path or sustained memory behavior. I did not run the full workspace suite on this PR head; my current-main GPU suite on this older driver has unrelated device-suspension failures tracked separately. No game data was uploaded.
AI-assisted testing and report drafting with OpenAI Codex (GPT-6); I checked the exact revisions and local logs before posting.
@fromthemoonx on GitHub · 2026-11-25 06:07 UTC · original
Passes on NVIDIA (RTX 3060, which has sparse windows here), at the head and merged onto current main. The new test fails when the coherent fallback is put back.
8a3e42c(base6020a33):cargo build --workspace+cargo test --workspace --no-fail-fast -- --test-threads=4: 1155 passed, 0 failed, 46 ignored. Merged onto main6e1e2be(no conflicts): 1155 passed, 0 failed, 46 ignored. 24 SKIPPED on both, the same as onmain: no wave64, the per-lane refusals andheap_window_out_of_memory_falls_back_to_the_switch_form. The new test does not skip.physical_home_block_does_not_spill_into_coherent_when_sparse_enabled: 10 of 10 runs.cargo test -p xcl --lib kernelx -- --test-threads=4: 41 passed, 5 of 5 runs..or_else(|| u.alloc(bytes, PHYS_PAGE)…)put back aftersparse_allocinalloc_physical_home_block, the new test fails (kernelx.rs:3111).Hardware: RTX 3060 12 GB (driver 610.88), Ryzen 7 5700X, Windows 11 Pro 26300, Rust 1.100.0 MSVC, DXC 1.9.2602.17, debug.
Not tested: a title (no smoke run here), so not whether a title that fills its sparse windows still runs with plain-memory homes instead of coherent ones.
AI use: Claude Code (Claude Opus 5.5) ran the tests and the mutation check and wrote this report.
@JoaoPauluu on GitHub · 2026-11-25 06:12 UTC · original
A regression run under Wine on Linux on the retail title: no device removal, no crash, frames level with
main(1376 here; 1368 and 1370 on the twomainruns). The title's GPU heaps stay outside unified memory here (UMA: 13507 MB of commit free, under 17408 MB), and noAllocateTitlePhysicalPagesline appears, so the changed path is not reached; this is a regression run only.Tested
x86_64-pc-windows-gnu.8a3e42cas it is (based on6020a33) andmain6e1e2be, no uncommitted changes. Retail title 1.0.2.1,scripts/linux/smoke.sh(#257) for 60 s, no input. Runs in order: main, this PR (with other PRs in between), main.Regression run
main (first run):
this PR:
The second
mainrun: 1370 frames,exit: 0x0, no device removal, no crash. Under Wine,peak commitreads 0 MB, so these blocks do not check memory.Not tested
AI use
@wish131400 on GitHub · 2026-11-25 06:27 UTC · original
Independent real physical-page API regression check for this PR, in addition to its existing local-UMA helper test.
Compared target
main6e1e2befc7430126b1e7b98b5c3fe93813c866b6with PR head8a3e42cec3bb0a583c0abab85b872143f6462406. Both were fixed source archives plus the same test-only module appended to kernelx.rs; production source was left unchanged. The PR head's actual parent is6020a33b, while its current target base is6e1e2be. The two archive trees differ only in README and kernelx.rs.Tested
rustc 1.98.1 (48a229cea 2026-09-01)MSVC; debug test profile. This test executes Win32 allocation APIs only; it does not initialize a GPU or DXC.cargo +stable test --locked --no-run -j1 -p xcl --lib --message-format=json-render-diagnostics, followed by its pinned standalone libtest binary in a fresh process:hle::kernelx::physical_home_api_regression::physical_page_api_does_not_spill_into_coherent_when_sparse_exhausted --exact --test-threads=1 --nocapture.XCL_*; setXCL_UMA_MB=1,XCL_COHERENT_MB=1,XCL_UMA_WINDOWS=4,XCL_HEAP_WINDOWS=0. The fixture asserts the actual coherent size is 1 MiB. Approximately 12 GiB is sparse VA reservation, not RAM/commit.API_POLICYassertion. PR head: 1 passed / 0 failed / 0 ignored / 0 SKIPPED. These are one case per binary, not five separate tests.The case uses the actual
AllocateTitlePhysicalPages/FreeTitlePhysicalPages, production registry/page_home, andVirtualQuery. It performs three available-sparse controls and two zero-commit sparse-exhaustion rounds; it cleans up each round before the final policy assertion.u.used()VirtualQuerystate before FreeBoth exhaustion rounds give those same results; all three available-sparse controls still select uncommitted sparse homes and free them successfully. The 65536 B is consumption of the already committed coherent allocator's budget, not a measurement of extra process commit or an FPS gain.
Not tested
GPU coherence/import/driver behavior, a retail title or smoke run, full workspace suite, multithreaded physical mapping/remapping, whole-system OOM, frame time/FPS. This is a focused allocator-policy/API regression, not a merge-ready runtime PR or a game performance claim. No game data or SDK content is included.
AI use
OpenAI Codex (GPT-6) reviewed the upstream change, wrote the test-only API extension, ran the builds/tests on the machine above, verified the actual logs/source/executable hashes, and drafted this user-authorized report.
Reproducer: append to crates/xcl/src/hle/kernelx.rs in both source snapshots
Fixture SHA256:
2d4994650f4f6aa106b8337058ce7bd5a7f549643503a291dfc0662a696e8a5b.Actual test exe SHA256: main
4bd1734e26ccade34e30f91d68409ee07eca29ed60860ed39ed6aecca3601e02; PRd7d04504892bd3829bcaa9f5b291a553fbb7860da443c2c35947bcab46bd8ece. Both successful builds reportedfresh=false; sources were hashed before and after. An earlier candidate invocation which reportedfresh=truewas rejected and not executed as evidence; the candidate was then actually rebuilt.@DavidM1911 on GitHub · 2026-11-25 06:32 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!
@pablogonz12 on GitHub · 2026-11-25 07:17 UTC · original
Full lib suite and integration tests under Wine on RADV, with
mainas the control. I found no regression from this PR. Head8a3e42cagainstmain6e1e2be(the PR's base6020a33differs from it only inREADME.md).Tested
cargo xwinx86_64-pc-windows-msvc, static CRT, release.UMA: 3 sparse VRAM window(s) (12 GiB VA) + 1 coherent window(s) (512 MB)in the test log). The new test runs, not skipped, and passes.kernelxfilter, one thread:main40 passed, 0 failed, 1 ignored; head 41 passed, 0 failed, 1 ignored..or_else(|| u.alloc(..))fallback put back in the helper, the new test fails (left: Some(30064771072),right: None).--test-threads=4, skippinginteger_ops_match_cpu,uaddc_and_usubb_match_cpuandjumps_to_outer_loop_heads_are_structured(they kill the test binary on this stack). 23 runs per side:mainmain, 1089/7/26 on headmain, 1086/10 on head0x887A0005), 12 failed: 1083/12 onmain, 1084/12 on headxapu_connect_returns_oom_and_cleans_up_on_failure: 1088/8fuzz_validate_and_gpu_2,directed_reference_basics,lower_dxilf32_programs_on_the_gpuandf64_programs_on_the_gpu,gpu_nonfused_mad_and_mac_prevent_fma_contraction,gpu_depth_buffer_created_for_unordered_access_is_placed,xma2_source_voice_decodes_and_manages_lifetime.maintoo, with the same 12 failing tests. It also happened in 2 of 10 more head runs with the new test left out (--skip physical_home_block), so the new test is not needed to trigger it. With 1 in 23 against 3 in 23, these runs do not show a difference between the two, and do not rule out a small one.xapu_connectfailure happened once in these runs (its assertion: "data buffer must be released when event creation fails", left 8192). I did not investigate it.SKIPPEDlines, identical in the first run of each side: six per-lane f16 / f32-conversion refusals andpso_measurement_compiles_an_exact_synthetic_record.e2e(window not cloaked, XMA2GetState),pls_quota,predication_e2e.Not tested
AI use
@raylitebull on GitHub · 2026-11-25 10:46 UTC · original
Code review on
8a3e42c:alloc_physical_home_blockincrates/xcl/src/hle/kernelx.rscleanly skips coherent UMA fallback wheneveru.has_sparse()is enabled, keeping coherentKEEPheadroom intact, with focused regression coverage.#2157(3e1eab2), which also guardsAllocateTitlePhysicalPagesagainst coherent UMA spillover under sparse layouts.Remaining before merge:
Build and testfinishing green plus dual-vendor (AMD + NVIDIA) verification on8a3e42c.@raylitebull on GitHub · 2026-11-25 10:51 UTC · original
Note: #2157 (
3e1eab2, guarding AllocateTitlePhysicalPages against coherent UMA spillover when sparse layouts are active, with both sparse and non-sparse unit tests) has now merged onto main (74f96b3). Check whether #2135 is now superseded and can be closed.@Simon-CR on GitHub · 2026-11-25 14:25 UTC · original
Thank you @raylitebull for the review and @luckyteagirl, @fromthemoonx, @JoaoPauluu, @wish131400, @DavidM1911, and @pablogonz12 for verifying this across AMD, NVIDIA, and Wine! Confirmed that #2157 (
74f96b3) already landed this fix onmain(Part of #1566), so I am closing #2135 as superseded.Pull request closed