hle,eh: reclaim partial physical frees, shard lazy VEH, harden dstorage/input/audio #2004
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!2004
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2004"
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?
@raylitebull on GitHub · 2026-11-25 00:37 UTC · original
raylitebull:feat/world-sys-dstorage-and-phys→main· +1413 −257 · 10 files · 2 commits · openHardens HLE world streaming, physical-page reclamation, lazy VEH sharding, monitor/mwait patching, audio buffer reuse, and GameInput/KBM playability:
kernelx/lazy.rs:XMemVirtualAlloc/ overflowalloc_physical_homeMEM_RESERVEfallbacks below the 40-bit VA ceiling viaalloc_below_40bit(VirtualAlloc2, preserving#2157's sparse-layout coherent UMA opt-out); stops largeAllocateTitlePhysicalPagespools from stealing pre-committed coherent UMA; skips committing lazy pages on reads while ensuring lazy pages before writes (uses existing upstreamXMemIsToolsMemAvailableinkernelx.rs).PHYS_BLOCKScounters with a per-page live bitmap (PhysBlock) for exact per-page liveness (physical_pages_live+is_live_physical_page), double-free immunity, and immediate coalescedMEM_DECOMMIT+sparse::decommittedon partialFreeTitlePhysicalPagescalls.4 MiBstripes (kernelx/lazy.rs) with atomicLAZY_COUNT/LAZY_COMMITTED_ANYfast paths and batchedlazy::mark/unmark.dstorage.rs,dstorage/parallel.rs,dstorage/parallel_tests.rs):#1405execution-time physical page-list resolution (!dest_on_stack+read_own+kernelx::physical_pages_live+ zero-entry reread) insidedstorage.rs::write_dest_physical_pagesacross sequentialexecute()anddstorage/parallel.rs(InFlightTask::dest_on_stack), refreshing stale/freed entries on write/read retry (0x89240009prevention) and extending parallel decompression to physical-page destinations and supported BCPack requests.Monitorx/Mwaitx& EH (eh.rs):SEENmutex inemulate_console_onlywith a lock-freeAtomicU16bitmask and live-patchesMonitorx->nop;nop;nopandMwaitx->pause;nopvia atomic alignedu64CAS +FlushInstructionCache(opt-out viaXCL_NO_PATCH_MONITORX=1).opus.rs,acphal.rs):IMFSample/IMFMediaBufferpairs acrossMftDecoderpackets; splitsXApustream locks to per-stream mutexes with reusable PCM/float scratch buffers and atomic progress throttling (preserving#471'sChannel::connectclear).gameinput.rs,kbm.rs):GetNextReading/GetPreviousReadinghistory; extendsXCL_PRESS_ATfor triggers/sticks/durations; addsZ/Cbumper keys; gates mouse buttons on capture/non-sizing and guards zero-delta poll velocity decay (preserving#552's PlayStation HID fallback).Part of #1833.
What is in it
crates/xcl/src/eh.rs,crates/xcl/src/hle/{acphal.rs, dstorage.rs, dstorage/parallel.rs, dstorage/parallel_tests.rs, gameinput.rs, kbm.rs, kernelx.rs, kernelx/lazy.rs, opus.rs}(10files).Tested
rustc 1.99.1 (58cf8f9c3 2026-10-13), rebased cleanly onto73e3aba6(57560bf5).cargo check --workspace --tests: passed (0warnings in touched files).cargo test -p xcl --lib -- --test-threads=4 hle::kernelx:: hle::dstorage:: hle::gameinput:: hle::kbm:: hle::acphal:: hle::opus:: eh::tests::: 128 passed, 0 failed, 1 ignored (0.61s, including#1405,#495,#2157,#509,#563,#2048, and all 13#2004tests).Regression run
scripts/smoke.ps1pair on57560bf5vs73e3aba6has not been run yet. AMD and NVIDIA reviewers are invited to verify57560bf5vs73e3aba6(includingscripts/smoke.ps1, DirectStorage streaming, and GameInput/KBM paths) and post results in the comments.Not tested
scripts/smoke.ps1pair on57560bf5, fullcargo test --workspacesuite on57560bf5, runtime GPU execution across AMD / NVIDIA / Intel hardware, and Linux/Wine/vkd3d-proton.AI use
73e3aba6, and unit tests; the author reviewed the diff and test output.@raylitebull on GitHub · 2026-11-25 00:47 UTC · original
Overlap note: full credit to #565 (@ZekkJJ) for retaining recent
GameInputreadings forGetNextReading/GetPreviousReadingingameinput.rs.If #565 lands first, we will drop the reading-history hunks from #2004 and keep #2004 focused on its independent
eh,acphal,dstorage,kbm,kernelx,lazy,opus, andXCL_PRESS_AT/ rumble changes.@futurepro62 on GitHub · 2026-11-25 01:03 UTC · original · edited 2026-11-25 01:24 UTC
Full-suite run, since this PR has no test report yet. Tested exact head
462a456(on its base6567c5f).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::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::dxil::fuzz_tests: 999 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.monitorx_and_mwaitx_patch_to_nop_and_pause_safely,xapu_reuses_stream_scratch_and_supports_concurrent_streams,parallel_decode_supports_physical_page_destinations_and_late_refresh,rumble_skips_disconnected_pad_and_deduplicates_unchanged_speeds,next_and_previous_reading_walk_state_changes_and_terminate,extended_scripted_actions_drive_triggers_sticks_and_durations,mouse_buttons_require_capture_and_not_sizing,high_frequency_zero_polls_do_not_prematurely_decay_velocity,xmem_tools_mem_and_40bit_virtual_alloc,physical_page_reads_skip_commit_writes_ensure_lazy_and_free_unmarks,partial_free_tracks_exact_liveness_decommits_homes_and_ignores_double_free,sharded_lazy_batch_spans_stripes_and_unmarks_cleanly,mft_decoder_reuses_cached_samples_across_packets.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 1009 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 main7994cd1too, not because of this PR. On NVIDIA:heap_window_out_of_memory_falls_back_to_the_switch_form(#1651), the fourgpu::recomp::lower_dxil::tests::*_programs_on_the_gputests andconst_and_null_mask_operands_agree_with_hlsl_on_the_gpu(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
@Anon64 on GitHub · 2026-11-25 01:47 UTC · original
Regression run for this PR: head
462a456, based onmain80f4819. RTX 3060 12 GB (581.80, wave32), Windows 11 26200, release,XCL_NETWORK=0, A pressed every 4 s from 20 s,scripts/smoke.ps1on a retail title for 60 s, in one batch with themainrun.main
80f4819:this PR:
No device removals or crashes; 98 % of main's frames, 105 % of its peak commit.
Not tested: the whole suite; world loading; whether the title reaches all of the changed code in these 60 s (default settings:
XCL_DIRECT_DXILandXCL_HEAP_WINDOWSunset).Written with Claude Code (Claude Opus 5.5) from runs on this machine.
@raylitebull on GitHub · 2026-11-25 01:54 UTC · original
Rebased and trimmed
#2004cleanly ontod63071a(4d7d3bb+c57227f):#563duplicate: removed our duplicateXMemIsToolsMemAvailable()definition fromcrates/xcl/src/hle/kernelx.rs(using#563's implementation onmain).#509(#476): updateddstorage.rs::refresh_stale_pagesto useread_own(ReadProcessMemory) so unmapped page arrays never fault while still refreshing stale/freed page entries.#552Ǘ: cleanly kept the PlayStation HID fallback ingameinput.rsandChannel::connectclear inacphal.rs.Pushed
c57227ffor GitHub ActionsBuild and testand fresh verification.@DavidM1911 on GitHub · 2026-11-25 03:51 UTC · original
Verification on RTX 3060 Ti (Windows 11): merge conflict with current
main— needs a rebase before it can be tested.@raylitebull on GitHub · 2026-11-25 10:57 UTC · original
Rebased
#2004cleanly onto5478c4a7(52e01595+6bdf9b99), integrating#2157(3e1eab29, keepingalloc_physical_homesparse-layout coherent UMA skip and wiringalloc_below_40bitinto its plainMEM_RESERVEfallback).Verified locally (
cargo check --workspace --tests+126 passed, 0 failed, 1 ignoredacrosskernelx,dstorage,gameinput,kbm,acphal,opus, andehtests, including both#2157tests) and pushed6bdf9b99— ready for re-testing (ping@DavidM1911)!@Toons29 on GitHub · 2026-11-25 03:42 UTC · original · edited 2026-11-25 15:29 UTC
Regression run of
6bdf9b99on the retail title, for this PR's Regression run section. Both blocks are fromscripts/smoke.ps1as printed, not edited:mainon568e7db7, this PR on its head commit with no uncommitted changes, same title and time.Against the limits in CONTRIBUTING.md: 104 % of
main's frames, 100 % of its peak commit, no crash, no device removal.AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0,
cargo build --release -p xcl, 60 s,XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.AI use: Claude Code (Claude Opus 5.5) built both trees and ran
scripts/smoke.ps1; both blocks are exactly as printed, and I approved posting this.@raylitebull on GitHub · 2026-11-25 18:16 UTC · original
Rebased
#2004cleanly onto73e3aba6(9b81c214+57560bf5), integrating#1405(bb27ed6dexecution-time DirectStorage physical page-list resolution):#1405's execution-time physical page-list resolution (!dest_on_stack+read_own+kernelx::physical_pages_live+ zero-entry reread) insidedstorage.rs::write_dest_physical_pagesso sequentialexecute()anddstorage/parallel.rs(InFlightTask::dest_on_stack) share identical#1405/#476semantics.kernelx::physical_pages_liveandkernelx::is_live_physical_pagebacked byPhysBlock's exact per-page bitmap, and updatedparallel_decode_supports_physical_page_destinations_and_late_refreshto use a heap-allocatedvec![stale_page[0]]matching#1405.cargo check --workspace --tests+128 passed, 0 failed, 1 ignoredacrosskernelx,dstorage,gameinput,kbm,acphal,opus, andehtests, including#1405,#495,#2157,#509,#563,#2048) and pushed57560bf5.@DavidM1911 on GitHub · 2026-11-26 00:49 UTC · original
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
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.