Repository navigation
D3D12.X: create sparse placed buffers outside STATE and drain FORGOTTEN - #2539
ramon-victor wants to merge 1 commit into
Conversation
|
AMD run (listed as untested): the new test passes on an RX 9070 XT, with real reserved resources on AMD hardware. Head
Not tested: Intel; this test on the machine's RTX 3060 (it always uses the default adapter); a title. |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
Independent AMD RDNA4 (native wave64) test report on exact head Tested
Regression run (60 s retail-title smoke, (Matched Not tested
AI use
|
|
Tested: current PR head merged onto current
Not tested: retail titles (no title data on this lane, counts only). AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting. |
|
Focused test finding on the current clean head I changed only the test in a detached scratch checkout: remove its two notifications inside the forget_buffer_in(&local_state, &local_forgotten, ptr); // delayed notification for old object
let g = lock_state_in(&local_state, &local_forgotten);
let s = g.as_ref().unwrap();
assert_eq!(s.buffers.get(&ptr), Some(&vec![new_tile]), "late old release removed the replacement");
assert_eq!(s.pinned.get(&new_tile), Some(&1), "late old release unpinned the replacement");
The remaining contract is that a delayed retirement for object A must never retire object B merely because B reused A's pointer. A per-placement identity captured before the driver's final Windows 11 build 26300, RTX 3080 Ti / 621.35, rustc 1.99.1. AI use: Codex (GPT-6.2 Sol) prepared and ran the test and drafted this report; GPT-6.2 Astra reviewed the ownership reasoning. |
|
Two contributors checked independently and found that #2528 solves the same problem (for #2457) in a different way: #1607, group D122. You may want to compare them with the other author and agree on one, or say in the PR why both are needed. This is a hint from the community triage in #1607, not a maintainer decision. AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table. |
…#2528 + xcl-dev#2539) (cherry picked from commit 95bc8198b89ff2c73a556cb370ab5055bbf821ec)
Releases the
STATElock before callingreal::dev_create_reserved_resourceinsparse::place_buffer, then re-acquiresSTATEvialock_state_inso any deferredFORGOTTENentries for a reused COM pointer are drained before recording the newly placed buffer.Previously
place_bufferheldSTATEacrossdev_create_reserved_resource. If another thread ran finalReleaseon a sparse placed buffer at addressPwhileSTATEwas held,sparse::forget_buffer(P)hitTryLockError::WouldBlockand queuedPinFORGOTTEN. Once D3D12 reusedPfor the newly created reserved resource,place_bufferoverwrotes.buffers[P](leaking the old buffer's tile pins if still present), and the very nextlock_state()drainedFORGOTTENand deleted the live new buffer and its tile pins.Part of #2457 (specifically item 2; item 1 is tracked separately).
What is in it
crates/xcl/src/hle/d3d12x/sparse.rs:lock_state_in,forget_released_in,forget_buffer_in, andplace_buffer_inso the lock discipline and pointer-reuse recovery are directly testable against an isolatedStatewithout touching process-global statics.STATEguard after bounds-checking[start, end]and before invokingreal::dev_create_reserved_resource(matchingvram::place_on_pages), re-acquireSTATEvialock_state_in(drainingFORGOTTENbefore mapping/pinning), defensively unpin any stales.buffers[raw]entry before inserting, and release the newly created COM object ifSTATEor the sparse window disappeared while unlocked.tests::place_buffer_drains_forgotten_and_does_not_hold_state_across_createverifying thatSTATEis unlocked during resource creation, that a reused pointer with a deferredFORGOTTENrelease keeps its new buffer and tile pin while releasing the old buffer's tile pin, and thaton_abortruns cleanly ifSTATEis torn down while unlocked.Tested
621.24, wave32), AMD Ryzen 7 5700X, 32 GiB RAM, Windows 11 Pro (26300),rustc 1.99.0(x86_64-pc-windows-msvc), DXC/DXIL1.8.2502.11(Windows SDK10.0.26100.0).cargo test -p xcl --lib place_buffer_drains_forgotten_and_does_not_hold_state_across_create -- --nocapturefailed (0 passed, 1 failed:STATE must not be held across dev_create_reserved_resource).cargo test -p xcl --lib hle::d3d12x::sparse::tests -- --test-threads=1:18 passed, 0 failed, 1 ignored(early_commit_timingbenchmark)..\scripts\test.ps1, debug):1424 passed, 0 failed, 46 ignored(skipped on this adapter: wave64-only GPU tests, unsupported per-lane semantics variants,no heap windows).cargo build --release -p xcl) and clean 60 s retail smoke run (.\scripts\smoke.ps1).Regression run
Baseline (
main):PR (
23e129a):Not tested
dev_create_reserved_resource(reproduced deterministically viaplace_buffer_in+forget_buffer_inin the unit test).AI use
place_bufferto dropSTATEaround resource creation and drainFORGOTTENbefore recording, wrote the failing-first unit test, ran.\scripts\test.ps1, release build, and the 60 ssmoke.ps1run, and drafted this PR description.