Repository navigation
Conversation
SYNC_GRAPH.title_fences stored the title's raw ID3D12Fence pointer without a reference. If the title released the fence while an entry still had waits or signals, the next prune_title_fence called GetCompletedValue on a freed object (also for a new fence allocated at the same address). TitleFenceSync now holds its own reference, taken when the entry is created. Entries are removed once their waits and signals are empty (completed, or u64::MAX after device removal). The removed references are dropped after SYNC_GRAPH is unlocked so Release never runs under the global lock. Tests use a synthetic COM ID3D12Fence that counts AddRef/Release and records a GetCompletedValue made at refcount 0; they fail without the owned reference. The queue_dispatch test's fake fence gets AddRef/Release slots. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Independent Linux/Wine verification of Tested: Windows MSVC target, Rust 1.98.1, Wine 11.0, single test thread, 9 GiB memory / 512 MiB swap cgroup limits and 180 s timeout. Fresh
These are CPU/mock-COM lifetime tests, not a GPU run. The mock detects accesses at refcount zero but does not physically free its backing allocation. The machine has an RTX 4060 Laptop GPU / 16 GiB RAM and a diagnostic-relaxed vkd3d installation, but neither establishes native GPU coverage for these fixtures. Not tested: full suite, native Windows, real D3D12 fence destruction, title launch, RAM savings, or correction of our Game Init stall ( Suggested additional regression: make the mock's Local evidence: |
|
Test report: passes on NVIDIA. Exact head Tested
Not tested
Claude Code (Claude Opus 5.5) ran the tests and wrote this report. |
Fixes #2840
SYNC_GRAPH.title_fenceskept the title's rawID3D12Fencepointer without a reference. If the title released the fence while an entry still had waits or signals, the nextprune_title_fencecalledGetCompletedValueon a freed object.TitleFenceSyncnow owns a reference taken when the entry is created, and the entry is removed (reference released) once it has no waits or signals left. The released references are dropped afterSYNC_GRAPHis unlocked, soReleasenever runs under the global lock. XCL does not wrap title fences with a release hook (the title gets PC fences directly), so the owned reference is the fix that covers every path.What is in it
crates/xcl/src/hle/d3d12x/list_x.rs:TitleFenceSync.fence,prune_title_fence(tf),take_idle_title_fence(s),title_fence_entry;note_title_queue_wait/signalandbreak_cycles_before_title_signaldrop the released references after unlocking. Two unit tests with a synthetic COM fence (countsAddRef/Release, records aGetCompletedValueat refcount 0).crates/xcl/src/hle/d3d12x/real.rs: the fake fence inqueue_slot_18_before_the_layout_is_known_writes_8_bytesgetsAddRef/Releaseslots (the graph now calls them).would_signal_close_cycleare removed on the next wait/signal note, not in that call (it runs under a lock held by its caller).Tested
cargo check --workspace --tests -j 4: finished, no new warnings.cargo test -p xcl --lib -j 4 title_fence_entry: 2 passed, 0 failed, 0 ignored.cargo test -p xcl --lib -j 4 queue_slot_18_before: 1 passed, 0 failed, 0 ignored.refs == 2.Regression run
Pending: the paired
scripts/smoke.ps1runs (main and this head) and the full GPU workspace suite wait for the GPU slot. This PR stays a draft until they are pasted here.Not tested
cargo test --workspaceon a GPU, including the GPU sync-graph tests inlist_x.rs(one of them buildsTitleFenceSync { .., ..Default::default() }; it compiles but was not run).AI use
🤖 Generated with Claude Code