Memory: enforce placeholder replacement and region bounds #2019
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!2019
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2019"
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?
@eizispark on GitHub · 2026-11-25 00:55 UTC · original
eizispark:fix/placeholder-region-bounds→main· +155 −11 · 1 files · 1 commits · openVirtualAlloccalls on placeholder reservations withoutMEM_REPLACE_PLACEHOLDERpreviously returnedNonefromplaceholders::allocand fell through tokernelx's sparse commit path. That allowedMEM_COMMITon an unreplaced placeholder (whichplaceholders::freenever decommits becauser.placeholderremainstrue, leaking RAM and D3D12 sparse tiles), allowedMEM_COMMIT | MEM_REPLACE_PLACEHOLDERwithoutMEM_RESERVE, and allowed commits on a replaced placeholder to straddle past its region end into adjacent placeholders or separate replacements.VirtualFreealso acceptedMEM_RELEASE | MEM_PRESERVE_PLACEHOLDERacross an entire unreplaced placeholder without splitting it and acceptedMEM_RELEASE | MEM_COALESCE_PLACEHOLDERSon a single placeholder.What is in it
crates/xcl/src/hle/kernelx/placeholders.rs: rejectMEM_RESERVE_PLACEHOLDER | MEM_REPLACE_PLACEHOLDER, rejectMEM_REPLACE_PLACEHOLDERwithoutMEM_RESERVEor with a null/zero-size range, intercept non-replacementVirtualAlloccalls inside tracked placeholder regions (rejecting unreplaced placeholders, re-reservations, zero-size calls, and out-of-region straddles with Windows'ERROR_INVALID_PARAMETER/ERROR_INVALID_ADDRESScodes, and aligning sub-page commits to their 4 KiB page base before notifyingsparse::committed), and reject degenerate single-placeholderMEM_PRESERVE_PLACEHOLDERsplits andMEM_COALESCE_PLACEHOLDERScoalesces inplaceholders::free.hle::kernelx::placeholders::testscovering unreplaced commit rejection, cross-region straddle rejection, sub-page commits inside a replaced slice, and degenerate single-placeholder split/coalesce rejection.Tested
rustc 1.100.0 (0ef1bc386 2026-11-09), debug and release.cargo test -p xcl --lib kernelx: 35 passed, 0 failed, 1 ignored.cargo test --workspace --no-fail-fast -- --test-threads=4: 861 passed, 0 failed, 42 ignored (SKIPPED GPU tests: 1 –heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows).Regression run
main:PR:
Not tested
MapViewOfFile3(..., MEM_REPLACE_PLACEHOLDER)over split placeholder slices beyondtesttitleand the 60 s retail smoke run above.AI use
kernelbase, wrote the regression tests andplaceholders.rsbounds checks, and ran the test suite and smoke verification.@raylitebull on GitHub · 2026-11-25 01:12 UTC · original
Code review on
8c7adcd:region_end,contains_range, andplaceholders_for_commitincrates/xcl/src/hle/kernelx/placeholders.rscleanly enforce non-overflowingchecked_addbounds and placeholder/mapped coverage for commit, protect, and free operations, with unit coverage inreject_out_of_bounds_free_and_protectandreplace_rejects_partial_map_or_wrong_size.CIworkflow approved (currently running).Remaining before merge:
Build and test (Windows, no GPU)finishing green plus an NVIDIA verification pass on8c7adcd.@JJAutoCompare on GitHub · 2026-11-25 01:28 UTC · original
PR #2019 empirical test report
Tested the clean live head
8c7adcdebe3eee539a19a7534fd727a13e145e5eof xcl-dev/xcl#2019. The remote PR head still matched after testing.git merge-tree --write-treeexited 0 against the initialorigin/mainat0e45b975235d6a46daf44076ee9bcd020ebef971and the newerorigin/mainat2bdf0477f84377d1b08e29424100c9bace4e530f.Tested
1.100.0 (0ef1bc386 2026-11-09)onx86_64-pc-windows-msvc. DXC1.9.2609.5 (01b62ad47). Unoptimized dev and test profiles withCARGO_INCREMENTAL=0,CARGO_PROFILE_DEV_DEBUG=0,CARGO_PROFILE_TEST_DEBUG=0, andXCL_ADAPTER=A770.cargo test --workspace --no-runsucceeded.cargo build --workspacesucceeded and produced both e2e fixture binaries.cargo test -p xcl --lib hle::kernelx::placeholders::tests:: -- --show-outputran outside the GPU lock. 3 passed, 0 failed, 0 ignored, 0 skipped. The log confirms UMA initialization, which the tests require to reach their assertions.hle::kernelx::placeholders::tests::replaced_placeholder_bounds_commits_to_its_own_regionhle::kernelx::placeholders::tests::split_and_coalesce_reject_degenerate_single_placeholder_operationshle::kernelx::placeholders::tests::unreplaced_placeholder_rejects_commit_and_keeps_pages_reservedcargo test --workspace --no-fail-fast -- --test-threads=4 --show-outputran once underInvoke-ArcTest.ps1. Cargo exited 101 after completing 20 test harness results. 843 passed, 18 failed, 42 ignored in the raw libtest totals. The six explicit skips below represent unexercised coverage even though libtest records the containing cases as passing. Sample-dependent paths also had no coverage because allXCL_SAMPLE_*variables were unset.Workspace failures
CreateComputePipelineStatereturned0x80070057in these 13 tests.gpu::dxil::ops_tests::doubles_match_cpugpu::dxil::ops_tests::groupshared_barrier_and_atomics_rungpu::recomp::tests::gpu_clamp_and_omod_per_instructiongpu::recomp::tests::gpu_f64_class_comparegpu::recomp::tests::gpu_f64_compares_with_nangpu::recomp::tests::gpu_f64_literal_high_wordgpu::recomp::tests::gpu_f64_rounding_and_conversionsgpu::recomp::tests::gpu_f64_rootsgpu::recomp::tests::gpu_f64_math_randomgpu::recomp::tests::gpu_frexp_f64_exp_and_mantgpu::recomp::tests::gpu_ldexp_f64gpu::recomp::tests::gpu_float_compares_randomgpu::recomp::tests::gpu_rndne_f64The remaining tests failed assertions.
gpu::recomp::tests::gpu_nonfused_mad_and_mac_prevent_fma_contraction— assertionleft == rightfailed: v_fma_f32 overflow control should stay fusedgpu::recomp::tests::gpu_ps_image_sample_offset_implicit_lod_between_mips— pixel (0,0) = 25.609375, expected 26gpu::recomp::tests::gpu_valu_16_and_64_bit— assertionleft == rightfailed: lane 0 v_add_f16 keeps the high halfgpu::recomp::tests::gpu_wave64_ps_whole_wave_reductions— assertionleft == rightfailed: pixel 0 (lane 0, wave of pixel 0): min / sum over the odd pixels, waterfall readtest_title_runs_and_game_folder_is_untouched— synthetic-title D3D12.X dynamic depth bias check #94 expected a green top-right pixel afterRSSetDepthBiasX(-1000.5)and read blue[0, 0, 255, 255].Explicit GPU skips (6)
SKIPPED gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64SKIPPED gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64SKIPPED placed_title_textures_share_vram_and_preserve_pixels: tiled tier < 2SKIPPED test_title_draws_with_a_root_signature_under_the_debug_layer: no d3d12SDKLayers.dllSKIPPED heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windowsSKIPPED uploads_start_from_each_subresources_state: no D3D12 debug layer (The application requested an operation that depends on an SDK component that is missing or mismatched. (0x887A002D))Not tested
origin/main, so the workspace failures have no same-host baseline comparison in this report.AI use
T3 Code / Codex (
gpt-6.2-sol) fetched and checked the revisions, built and ran the tests, and summarized the captured output. Coordinator #2 (T3 Code / Antigravity,gemini-4-neon) verified the counts against the saved log and published this report.@DavidM1911 on GitHub · 2026-11-25 04:01 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!
@ramon-victor on GitHub · 2026-11-26 00:01 UTC · original
Independent NVIDIA (wave32) full-suite + retail smoke test report on exact PR head
8c7adcdebe3eee539a19a7534fd727a13e145e5e(clean detached checkout, no local changes).Tested
x86_64-pc-windows-msvc), DXC/DXIL 1.8.2502.11 (Windows SDK 10.0.26100.0); debug tests, release smoke.cargo test -p xcl --lib hle::kernelx::placeholders::tests): 3 passed, 0 failed (with live UMA initialized:split_and_coalesce_reject_degenerate_single_placeholder_operations,unreplaced_placeholder_rejects_commit_and_keeps_pages_reserved,replaced_placeholder_bounds_commits_to_its_own_region)..\scripts\test.ps1): 861 passed, 0 failed, 42 ignored (3 GPU skips expected on this wave32 adapter: 2no wave64, 1no heap windows; lower total count reflects this PR's older base commit).cargo build --release -p xcl) and 60 s retail smoke run (XCL_NETWORK=0;title:hashed to3c290c16per#677since this PR's base predatessmoke.ps1hashing):Regression run
(Today's
main @ 08db802baseline on the same machine:1605frames,15009 MBpeak commit,0crashes,0device removals.)Not tested
XCL_SAMPLE_*tests (unset).AI use
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.