Repository navigation
Conversation
|
Review (head 9baafc6, diff read, not a merge-check):
Suggested verdict: not yet (move the flag set before the take, or take the effects after the flush). (Review written with Claude Code, Claude Opus 5.5; the first point was traced in the code.) |
KickoffX flushes the deferred two-pass draws before it takes the recording's effects: on a list without a title_list wrapper the effects were taken first, so the shared view-heap use (and the pipeline state and native generations) the flush records stayed in the list's state for its next recording. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
9baafc6 to
c0533b6
Compare
|
Re-review (head c0533b6, diff read, not a merge-check: the
Fine: AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point. |
|
Test report (not a merge-check: AI-written and posted by Foniass without a human check of each point. |
bmjask
left a comment
There was a problem hiding this comment.
Review of c0533b64: 2 finding(s). 2 are inline.
These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it.
| ) -> Result<(), String> { | ||
| // the pair is translated with heap windows when they are on (`pso::mem_windows`): as `bind_abi` | ||
| super::list_x::ensure_view_heap(this); | ||
| let shared_view_bound = ensure_view_heap_cached(this); |
There was a problem hiding this comment.
The two-pass paths (bind_two_pass_stage, sliced dispatch_mesh, defer_*) now use the per-recording heap cache instead of calling list_x::ensure_view_heap on every stage. That removes the re-check that bound the shared view and sampler heaps once they existed. With XCL_HEAP_WINDOWS=1, if a recording's first ensure runs before console_heap::global_heap() or the shared sampler heap exists, the cache stores (heap_bound=true, shared_view_bound=false), and later two-pass stages in that recording never bind the now-existing shared heap. The translated MS/GS shaders then index ResourceDescriptorHeap with the title's heaps or none, giving wrong descriptors or device removal. The use also isn't recorded, so eviction treats the heap as unused. Before this PR, every stage called ensure_view_heap and recovered.
| if let Some((mesh, stages, shared_view_bound)) = &staged { | ||
| let stage = if compute { &stages[slice as usize] } else { mesh }; | ||
| emit_two_pass_stage(list, stage, compute); | ||
| record_two_pass_stage(this, list, stage, compute, *shared_view_bound); |
There was a problem hiding this comment.
record_two_pass_stage notes shared-view use only when emit_two_pass_stage returns true, but the caller still issues list.Dispatch / pc_dm when the stage emitted nothing. With a null rs/pso, the Dispatch or DispatchMesh runs with whatever pipeline and root signature were bound before. If that pipeline reads the shared view heap and was carried across KickoffX or split_recording via init_pso, the new segment's uses_shared_view_heap stays false, so SHARED_VIEW_EPOCHS misses a GPU read of the shared heap and eviction can free it under that read. Before the new gating this under-report couldn't happen. Either skip the dispatch when nothing was emitted, or note the use whenever a dispatch is issued.
Problem
crates/xcl/src/hle/d3d12x/bind.rs(bind_two_pass_stage, the sliceddispatch_meshpath,defer_dispatch_mesh/defer_execute_indirect, andflush_two_pass) calledlist_x::ensure_view_heap(this)directly, discarded itsboolreturn value, bypassed the per-recording(s.heap_bound, s.shared_view_bound)cache, and never calledlist_x::note_shared_view_heap_use(this). As a result, a command-list segment containing only two-pass MS/GS draws reporteduses_shared_view_heap == false, allowingSHARED_VIEW_EPOCHS/with_quiescent_shared_view_heap(XCL_TEXTURE_BUDGET_EVICT=1) to treat the shared view heap as quiescent while two-pass draws were still readingResourceDescriptorHeap.crates/xcl/src/hle/d3d12x/list_x.rs,ensure_view_heapreturnedfalseearly whenever bothview_rawandsampler_rawwereNone(for example under defaultXCL_HEAP_WINDOWS=0when no default sampler heap was injected), even ifset_descriptor_heaps_xhad already bound the shared view heap (b.shared_view_heap == true).Fix
crates/xcl/src/hle/d3d12x/list_x.rs: Splitensure_view_heapintoensure_view_heap_with(this, view_raw, sampler_raw)so the early return whenview_raw.is_none() && sampler_raw.is_none()readsLISTS[this].bindings.shared_view_heapinstead of unconditionally returningfalse. Added#[cfg(test)]helpersuses_shared_view_heap_for_test/seed_shared_view_heap_for_testand unit testensure_view_heap_preserves_already_bound_shared_view_heap.crates/xcl/src/hle/d3d12x/bind.rs: Extractedensure_view_heap_cachedandnote_shared_view_use, and updatedemit_two_pass_stage/record_two_pass_stage,bind_two_pass_stage, sliceddispatch_mesh,defer_dispatch_mesh,defer_execute_indirect,flush_two_pass, andbind_abi_with_root_resolvedto share the per-recording heap cache and recordlist_x::note_shared_view_heap_useonly when two-pass stages or deferred draws actually emit with the shared view heap bound (failed stage binds, dropped un-flushed deferred draws, and state-only flushes do not mark use). Added deterministic unit teststwo_pass_stage_records_shared_view_heap_use_and_caches_heap_checkandflush_two_pass_records_shared_view_heap_use_only_when_draws_emit.crates/xcl/src/hle/d3d12x/vram.rs: Added#[cfg(test)] with_srv_tracking_for_testholdingVRAM_TEST_LOCKwith a panic-safe RAII reset guard for deterministic parallel unit testing.Tested
cargo check --workspace --all-targets— clean (0 errors).XCL_HEAP_WINDOWS=0):cargo test -p xcl --lib -- ensure_view_heap_preserves two_pass_stage_records_shared_view_heap flush_two_pass_records_shared_view_heap shared_view_use shared_view_heap --nocapture— 7 passed, 0 failed.XCL_HEAP_WINDOWS=1on NVIDIA GeForce RTX 5070 Ti):cargo test -p xcl --lib -- ensure_view_heap_preserves two_pass_stage_records_shared_view_heap flush_two_pass_records_shared_view_heap two_pass_binds_set_the_shared_view_heap --nocapture— 4 passed, 0 failed.32.0.16.1074,XCL_DXC_DIRset to DXC1.9.2609.5):cargo test --workspace -- --test-threads=4— exit 0, all test binaries passed.Regression run
Baseline (
mainancestorf0e8fdd5c3942ddd399d5ee11384c8595c5aacff):Branch (
9baafc68bd714190aa02a3c31a18041c7edefbec, warm cache; an initial cold-blob run hit a pre-existing title watchdog crash during a 34.6 s compute PSO driver compile, after which the warm-cache run completed cleanly):Not tested
XCL_TEXTURE_BUDGET_EVICT=1enabled simultaneously withXCL_TWO_PASS_BATCH=2under active VRAM pressure (the shared view-heap epoch capture and flush/reset/bind gating are covered by the new unit tests and existingvram/list_xepoch tests).AI use
Written and verified with an AI coding assistant; all code edits, unit tests, GPU test runs, and smoke verification were reviewed and executed locally.