D3D12.X: a held heap keeps its unified memory until it goes (#1394) #1457
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!1457
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1457"
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?
@ySKELLETONX on GitHub · 2026-11-24 16:23 UTC · original
ySKELLETONX:d3d12x-heap-late-release→main· +302 −30 · 4 files · 2 commits · draftStacked on #1070; only the top commit (
65ca891) belongs here.mem_heap_releasegave a heap'sHEAP_UMAblock back at the title's lastRelease, also while a queue could still read the buffers placed in it (they live in the block, not in the PC heap). A coherent block went back on the free list, where the next allocation could take it; a sparse one was decommitted. A heap with a block is now held like a resource (late_release), and its block goes tolate_release::holdwith it (#1070) to be given back once the queues are past the work in flight. A heap without a block goes at once, as before. Fixes #1394.What is in it
crates/xcl/src/hle/d3d12x/real.rs:mem_heap_releaseholds the lastReleaseof a heap that has a block (theres_releasepattern) and passes the block tolate_release::hold. Testheld_release_tests::a_held_heap_keeps_its_unified_memory_until_it_goes(a queue held on a fence: the block stays allocated until the fence is signalled).Tested
stable-x86_64-pc-windows-msvc), debug build, DXC from Windows SDK 10.0.26100scripts/test.ps1(cargo test --workspace -- --test-threads=4) on this branch's tree (65ca891): 745 passed, 0 failed, 41 ignored; noSKIPPEDlinesmem_heap_release(the code before this change) it fails:the block of a heap went back while a queue still had workRegression run
None yet: no retail title here. This stays a draft until
scripts/smoke.ps1runs onmainand on this head are in.Not tested
XCL_LATE_RELEASE=0(the heap then goes at once, as before).AI use
@WebIdentity1 on GitHub · 2026-11-24 16:39 UTC · original · edited 2026-11-24 16:48 UTC
Independent native Windows validation of
65ca8911c50d657c3856d541341a4afc01d7b1cb, stacked on #1070d0ebe34473f3668b1ed9a58bbd2294cbbbed90c4. Updated with an actual sparse-buffer GPU copy.Sparse lifetime and bytes
Local test-only probe: seed the title-heap registration with no block, then call production
heap_blockanddev_create_placed_resource_x. The64KiB block is confirmed sparse; the placed resource's recorded console range matches it. Upload16,384 patterned words throughsparse::before_execute, queue a GPU CopyBufferRegion behind an unsignalled fence, then release both the placed buffer and title heap. Verify the allocation and committed CPU pages remain while the copy is pending. Signal, read back every word, and check eventual sparse-reservation release plus OS page decommit.Run alone in a fresh process for each adapter (
XCL_ADAPTER=3090/AMD):cargo test --locked -p xcl --lib sparse_heap_release_preserves_queued_copy_bytes -- --test-threads=1 --show-output --nocaptureFinal runs on RTX3090 and AMD integrated: 1 passed /0 failed /0 ignored each, no skips/timeouts. Each prints:
The completion fence reached1 and
GetDeviceRemovedReasonsucceeded. A separate3090 oracle control flips one uploaded word without changing expected output:0/1/0, exactly1 mismatch, both cleanup checks still true. Restored source, reran both GPUs successfully, verified all222 final source hashes against Windows.Earlier coherent control
The upstream fixture uses
create_device(None, ...); the local patch explicitly selects/prints the adapter. It signals before assertions so the failing control unblocks the queue. Filtera_held_heap_keeps_its_unified_memory_until_it_goeswith the same command:3090 andAMD each1/0/0, no skips/timeouts; coherent block held before signal and freed afterward. Restoring onlymem_heap_releasefrom exact parent makes the same3090 fixture fail0/1/0 because the block was already freed while fenced. Runtime source restored afterward. This old-function control was coherent-only; the sparse negative control checks the byte oracle, not the old release function.Full workspace — unmodified revisions
All221 source hashes checked for each archived revision. Interactive Session1:
cargo build --locked --workspace: exit0 on both.cargo test --locked --workspace --no-fail-fast -- --test-threads=4 --show-output:d0ebe34: 743 passed /1 failed /41 ignored.65ca891: 744 passed /1 failed /41 ignored.Same existing
gpu_clamp_and_omod_per_instructionfailure (test exit101), no timeout. Four explicit skips each:gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware(native wave64),test_title_draws_with_a_root_signature_under_the_debug_layer,uploads_start_from_each_subresources_state(debug layers absent).Environment / not tested
Windows10 Home19045, Ryzen7 7800X3D/32GB, RTX3090 driver591.74, AMD integrated32.0.21030.2001, Rust1.98.1 MSVC, SDK DXC1.8.2502.11, Agility1.620.2, debug. Focused probes in SSH Session0. Recompiler suite selects3090; upstream default-adapter fixtures may useAMD. Sample inputs absent and system XGameRuntime comparison unavailable.
Full-suite results are the unmodified stacked-parent comparison, not current-main integration or the scratch-probe tree. The sparse probe initializes global state and must run alone; it has not been qualified as a parallel suite test. It seeds heap registration directly, not a full title startup. No shader dispatch, retail/gameplay, disabled-late-release path or required
xcl-smokepair. No competing runtime implementation/PR.AI use
Codex (GPT-6) inspected source, prepared diagnostics/controls, executed native runs and wrote the report.
Complete test-only probe patch against65ca891 — run the named filters separately
@vitor127wt on GitHub · 2026-11-24 18:22 UTC · original
I ran the retail smoke comparison requested in #1243 on Proton. Both runs used the same Xbox title for 60 seconds, with fresh Proton prefixes and XCL caches.
Tested
7.3.5-2-cachyos).experimental-11.0-20261112-x86_64), vkd3d-protonec207194with the XCL patch from #257, DXC 1.9.2609.5 andVKD3D_CONFIG=ignore_shared_fence.cargo xwin build --offline --locked --target x86_64-pc-windows-msvc --release -p xcl --bin xcl. Ranscripts/linux/smoke.sh "$PROTON" "$PREFIX" "$GAME" 60from #257 withXCL_EXEpointing to the matching build.cargo xwin test --offline --locked --target x86_64-pc-windows-msvc --release -p xcl --lib --no-run. Ranwine <xcl-test.exe> a_held_heap_keeps_its_unified_memory_until_it_goes --test-threads=1 --nocapturewith Proton's Wine on the RTX 5070 Ti. 1 passed, 0 failed, 0 ignored, 0 skipped.Regression run
The
titlefield omits a local folder suffix. All measurements are as emitted by the script.mainPR head
Not tested
Native Windows with
scripts/smoke.ps1and the full workspace suite. Wine reportedpeak commit: 0 MBin both runs, so these blocks provide no usable peak memory comparison.AI use
OpenAI Codex (GPT-6, exact variant unavailable) ran the tests and prepared this report.
@DavidM1911 on GitHub · 2026-11-24 18:52 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodifiedmain.)Thanks!
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.