Memory: defer GPU tiles for private physical page storage #1906
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1916"
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 CallMeBrado on 2026-11-24T23:03:33Z.
A DirectStorage transfer can fill a physical page before the title maps it anywhere the GPU can use it. XCL currently allocates a GPU tile at the page's home address as soon as the CPU needs backing. In two 60-second runs on the same title, the sparse pool peaked at 896 MiB on main and 320 MiB with deferred tiles enabled. Peak process commit fell from 14,596 to 13,947 MiB.
What is in it
XCL_DEFER_PRIVATE_HOME_TILES=1. Keep CPU-only sparse page homes private until mapped. When exposing a page, upload its existing bytes even if an earlier write-watch scan already consumed the write.Tested
cargo build --locked --workspaceandcargo build --locked --release -p xclpassed.cargo test --locked --workspace --no-fail-fast -- --test-threads=4 --show-outputreported 972 passed, 4 failed and 45 ignored.gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0through_3. The same seeds (70, 545, 1019, 1507) fail on clean main689f2dbon this adapter. All four report0x8007000EfromCreateComputePipelineState.Adapter skips reported by the workspace tests
gpu::recomp::lower::tests::a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu(no wave64)gpu::recomp::lower::tests::coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu(no wave64)gpu::recomp::lower::tests::cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu(no wave64)gpu::recomp::lower::tests::the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu(no wave64)gpu::recomp::lower_dxil::tests::a_per_lane_2d_or_3d_group_runs_on_the_gpu(no wave64)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)) / f16 arithmetic, wave64: no wave64 / f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's)) / f16 packed, wave64: no wave64)gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu(f32 arithmetic, wave64: no wave64 / f32 compares, wave64: no wave64 / f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's)) / f32 conversions, wave64: no wave64 / f32 rounding, wave64: no wave64 / f32 three-source, wave64: no wave64 / f32 transcendentals, wave64: no wave64)gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu(f64, wave64: no wave64)gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu(integer arithmetic, wave64: no wave64 / integer carries, wave64: no wave64)gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask(no wave64)gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware(no wave64)heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows)test_title_draws_with_a_root_signature_under_the_debug_layer(no xgameruntime.dll)Regression run
Main
This branch, with deferred tiles enabled
Not tested
AMD and Intel GPUs, Wine, title-specific
XCL_SAMPLE_*fixtures, and gameplay beyond the 60-second startup run.AI use
OpenAI Codex (GPT-6) isolated the change from a local build, wrote the test, ran the checks, and drafted this description.
Imported from ivall/xcl. Originally posted by Melow-code on 2026-11-24T23:10:40Z.
Review: APPROVED
896→320 MiB peak sparse pool is a strong win. The opt-in flag is the right approach since deferred allocation changes the fault pattern.
Imported from ivall/xcl. Originally posted by Filip722 on 2026-11-24T23:52:58Z.
On an RTX 5060 Laptop GPU (8 GiB, driver 615.78.08), the Series S startup trace shows a smaller sparse pool with this option. Bazzite 44, Proton Experimental 11.0-20261112, XCL main
20cf130plus the two-plane presenter from #615. The second executable addede2aa856and usedXCL_DEFER_PRIVATE_HOME_TILES=1. The runs started with separate copies of the same title settings and caches. No compiler ran alongside either title process.Both runs composited two planes. I stopped both when free VRAM stayed below 640 MiB for two samples. The window captures were still black. Neither run logged an NVIDIA Xid. This pair covers startup on one low-VRAM setup. Separately, the CPU-write / map / GPU-readback regression passed on this adapter in a composite build of the earlier main.
OpenAI Codex assisted with the builds, tests and report.
Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T23:54:45Z.
Full-suite run, since this PR has no test report yet. Tested exact head
e2aa856(on its base689f2db).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::dxil::fuzz_tests: 967 passed, 0 failed, 43 ignored. SKIPPED (no wave64):a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu,a_per_lane_2d_or_3d_group_runs_on_the_gpu,coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu,cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu,gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware,the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu.private_physical_pages_reach_the_gpu_on_mapping.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 976 passed, 0 failed, 45 ignored. SKIPPED:f16_programs_on_the_gpu(f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),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))),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))),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))),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).--skipleaves out tests that fail on main62265d3too, not because of this PR. On NVIDIA:heap_window_out_of_memory_falls_back_to_the_switch_form(#1651) and the fourgpu::recomp::lower_dxil::tests::*_programs_on_the_gputests (follow-up on #1651) fail becauserunner::skip_testturns their skips into failures underXCL_REQUIRE_GPU=mesh, andgpu::dxil::fuzz_testsseeds 70, 545, 1019 and 1507 failCreateComputePipelineStatewithE_OUTOFMEMORYon this card (drivers 616.64 and 621.40). On AMD:fuzz_validate_and_gpu_1fails on seed 540 (res[833]0x7 vs CPU 0x6). The AMD run does not setXCL_REQUIRE_GPU.Not tested
AI use
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-25T00:19:05Z.
Independent check of
e2aa856on an RTX 3080 Ti (621.35), Windows 11 build 26300 and Rust 1.99.1 MSVC. I extended only the synthetic test. A 64 KiB storage write allocated no GPU tile before mapping. The first map used an explicit sparse address distinct from the page’s home, and all 65,536 bytes matched GPU readback there. I then wrote a different pattern through the mapped page, moved it home, reset write-watch there, and verified all 65,536 updated bytes by GPU readback again.cargo test --offline --locked --release -p xcl --lib private_physical_pages_reach_the_gpu_on_mapping -- --nocapture --test-threads=1passed 1/1 with zero skips. The original home-only assertions ran as well. This check used no retail input and did not measure title memory or world-load time.AI-assisted. Codex (GPT-6 family, exact variant unavailable) extended the fixture, ran the test, and drafted this report.
Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-25T00:55:47Z.
Code review on
e2aa856:DEFER_PRIVATE_HOME_TILES(XCL_DEFER_PRIVATE_HOME_TILES=1) cleanly tracksSparseHome::CpuOnlyvsExposedinAway::sparse_homes, commits tiles and queuestitle_textures::rescan_cpu_backingfor contiguous private runs onMapTitlePhysicalPages, and deduplicates the rescanned dirty pages inrefresh_once. Default behavior when unset is unchanged.@Melow-codehas approved, and multiple NVIDIA GPUs have verifiede2aa856.What is still needed before merge: Independent AMD verification on
e2aa856(private_physical_pages_reach_the_gpu_on_mapping+ smoke) to satisfy dual-vendor coverage.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T02:24:56Z.
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!
Imported from ivall/xcl. Originally posted by pickles976 on 2026-11-25T15:06:53Z.
Independent Wine verification on unmodified PR head
e2aa856010a637d33adc2cf8b49766da91574747. No other PRs or local source patches were included in this check.Tested
2576c0b4adfae4a, vtable assertions not disabled).x86_64-pc-windows-msvcwith Windows SDK libraries and executed through the Wine Cargo runner:Not tested
Full workspace suite, native Windows, AMD/Intel, or a title on this exact head. This is synthetic memory-correctness coverage, not a claim of title VRAM savings or playability.
AI use
omp with
openai-codex/gpt-6-astraprepared the isolated checkout, cross-built and ran the test, and drafted this report from its output.Imported from ivall/xcl. Originally posted by crastinator on 2026-11-25T16:25:43Z.
Review: COMMENTED
AMD run, as asked: RX 6700 XT (RDNA2) under Wine. With
XCL_DEFER_PRIVATE_HOME_TILES=1, the sparse pools stay at 320 MB through a retail title's world load. Onmainthey grow from 896 MB to 1856 MB. The texture pages still fill the 12 GB card, so it alone does not get through.mainStacked with #1182 and #2306, the load stays at 5.8 GB local. The README conflict with
mainwas the only one, and I kept both texts. Heade2aa856.Tested (head
e2aa856, merged ontomain06c9f55, no conflicts unless noted)53aac418from #775), DXVK v3.1.1-97dxgiXCL_COHERENT_MB=512(the 4095 MB learned window is ~1 fps here, #284),XCL_ACTIVITY=1memory:line; "card full" means sysfsmem_info_vram_usedreached 11.5 GB, where my guard stops the run (a full card has crashed the compositor here before).Not tested
cargo testunder Wine: these were title runs only.main".AI use
Imported from ivall/xcl. Originally posted by brainhay5 on 2026-11-28T21:50:57Z.
Independent retail memory check on RTX 5070 Ti 16 GB (Blackwell) —
e2aa856, parent689f2dbNot a duplicate of @futurepro62's run above: that was the workspace suite on the same GPU. This is a retail-title memory measurement with matched arms.
One release binary of the head,
XCL_DEFER_PRIVATE_HOME_TILESoff vs on, arms interleaved off/on/off/on, 70 s each viaXCL_RUN_SECONDS=70. RTX 5070 Ti 16 GB, driver 32.0.16.1088, Ryzen 7 5800X3D, 64 GB RAM, Windows 11 22631. Title 1.0.2.1 (TitleId7952987A),XCL_NETWORK=0,XCL_PREPARE=0,XCL_ACTIVITY=1, press-A every 3 s. Figures are the peak of thememory:line fromhost.rsover each run.The sparse pool falls 2,048 → 320 MB and lands on the same value in both repeats. Mapped follows it (2,020 → 314 MB). Process commit and local video memory fall with it, while target pages and pool capacity do not change — the allocation is postponed, not the accounting.
Worth setting next to the 8 GiB laptop case above (4,736 → 4,288 MiB): here the reduction is 1,728 MB. That is consistent with the deferral removing allocations the title would otherwise make, with the smaller case bounded by free-VRAM pressure (those runs were stopped below 640 MiB free) rather than by the mechanism.
Tested
Not tested
0x5b).Limits
16 GB VRAM is above #3211's 6–8 GiB target, so this is a higher-memory control, not target coverage. The head is DIRTY against current
main, which has since moved 514 commits and mergednvidia-dev, so this qualifies the head against its documented parent only and says nothing about currentmain.Independent tester, no code changes.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T07:05:13Z.
Triage (#1607) – head
e2aa856#3123 is a port of this PR (its description says so): the same
XCL_DEFER_PRIVATE_HOME_TILES/SparseHomechange, built on nvidia-dev. This PR came first and has test and smoke results, so #3123 is the duplicate. The 45-46 lines shared with #3099, #3111, #3112, #3335, #3361, #3547 and #3554 come from amd-dev, which already contains this change; main does not.One point for the rebase: main now has
kernelx.rs:commit_homes_ahead, which callssparse::committedfor homes it commits ahead. This branch does not handle it, so with the option on those homes would still get GPU tiles at once (#3123 handles it).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.