Repository navigation
Conversation
Idle put-aside PC command allocators previously stayed dirty in the swap pool indefinitely, holding D3D12 command-allocator memory and any deferred UMA blocks until the title happened to reset that specific title allocator again. Meanwhile, releasing a title allocator with work in flight dropped busy owned spare tracking and abandoned pending UMA blocks. - alloc_pool: track Backing::dirty, proactively reset idle put-aside PC allocators (never dereferencing title-owned allocators off-thread) and trim excess clean owned spares above MAX_IDLE_SPARES_PER_ALLOC (2) via reclaim_idle, triggered with a 500 ms cooldown outside STATE lock on allocator reset and release. - alloc_pool / console_list / bind / real / list_x: add reset_list_with_retire and order bind::forget before list_x::on_release and alloc_pool::forget_list so retired UMA blocks are recorded before list membership clears; track busy orphaned spares and title-allocator pending UMA through GPU fences via orphaned_spares, orphaned_retirements, and retire_orphan_uma; clear dead title allocator pointers in bind::on_title_allocator_release. - Add unit tests covering idle spare reset/trim, title pending UMA safety while sibling spares are busy, fence-gated orphan retirement, and reset_list_with_retire ordering. Assisted-by: Antigravity
When coherent unified memory is exhausted, small per-draw root/CBV copies and AllocateUploadMemory requests first rate-limit idle allocator-pool reclamation (50 ms cooldown), then seed one 256 KiB sparse VA block into the list's Arena instead of claiming a 64 KiB sparse block per small copy, sharing it across subsequent bump allocations on both command lists and console command lists.
|
A regression run under Wine on Linux on the retail title: no device removal, no crash, frames level with Tested
Regression run main (first run): this PR: The second Not tested
AI use
|
Contributor
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #2138; only the top commit belongs here.
When coherent unified memory fills up during heavy scene recording, every draw still needs small chunks of unified memory for its per-draw shader tables and constant-buffer copies, and console middleware calls
AllocateUploadMemory. Previously, when coherent unified memory ran out on a small request, recording either failed (unified memory is full) or risked allocating a separate 64 KiB sparse block for each tiny copy (burning sparse reservation blocks and virtual-address tiles on every small draw).This change handles small upload and binding requests cleanly when coherent unified memory is full: first it asks the swap pool to reclaim idle put-aside PC command allocators (rate-limited to once every 50 ms across concurrent threads so threads do not thrash a contended pool) and retries coherent memory; if coherent memory is still full and sparse unified memory windows are enabled, it allocates one 256 KiB sparse block, seeds the command list's bump arena with it, and serves subsequent small draws out of that same 256 KiB block until the allocator resets (doing the same for console command lists on
cl_allocate_upload_memoryanduma_copy). Larger requests continue taking dedicated sparse blocks before falling back to coherent memory + reclaim.What is in it
crates/xcl/src/gpu/uma.rs: splitArena::take_bumpout ofArena::take, addArena::seed_block(with overflow-safe bounds checks) so callers can attach a 256 KiB backing block to an active arena, and add unit testarena_seed_block_bump_allocates_and_tracks_block_oncecrates/xcl/src/hle/d3d12x/bind.rs: add a 50 ms cooldownmaybe_reclaim_alloc_poolretry, extract sharedalloc_recording_uma/alloc_recording_uma_withfallback helper used by bothallocate_upload_memoryandbind_abi's copy closure (dropping redundant sparse blocks outsideSTATESif another thread seeds concurrently), plus unit testalloc_recording_uma_falls_back_to_sparse_arena_block_without_per_copy_churnand GPU testgpu_sparse_arena_fallback_maps_va_uploads_to_gpu_and_frees_on_resetcrates/xcl/src/hle/d3d12x/console_list.rs: share the 256 KiB sparseArenablock seeding fallback incl_allocate_upload_memoryanduma_copywhen coherent unified memory is fullTested
rustc 1.100.0 (0ef1bc386 2026-11-09)cargo test -p xcl --lib ... -- --test-threads=1):gpu::uma::tests13 passed / 0 failed / 0 ignored;hle::d3d12x::bind::tests8 passed / 0 failed / 0 ignored;hle::d3d12x::console_list::tests5 passed / 0 failed / 0 ignored;XCL_HEAP_WINDOWS=1standalonehle::d3d12x::bind::tests::gpu_sparse_arena_fallback1 passed / 0 failed / 0 ignoredcargo test --workspace --no-fail-fast -- --test-threads=4: 1158 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 DXIL fuzz tests: fuzz_validate_and_gpu_1 fails on AMD (seed 722 and others, RDNA2-4), so the default suite is red there #2115 / Direct DXIL: geometry mode, MSAA loads and directed f32 rounding #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 gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #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 gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #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 gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #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 gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #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 gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #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 gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #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 crashes; peak commit was 17378 MB vs 19090 MB onmainRegression run
Not tested
mainalone (verified locally across a 240 s retail world-load soak with 0unified memory is fullerrors alongside the rest of the local patch set), NVIDIA GPUs, Intel Arc GPUs, wave32-only GPUs, and Linux/WineAI use
Arena::seed_blockand the throttled reclaim/sparse fallback path, adding the unit and GPU tests, running the test suite and smoke runs, and drafting this description. All builds, tests, and regression runs were executed locally on the hardware above.