perf(gpu): cache host root/IA state, drop phantom listed raw twins, and hold List::state per thin chunk #395
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/395"
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?
Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T13:38:18Z.
Summary
Eliminates three major command-recording and descriptor CPU bottlenecks along the
VICTORY_THINtranslation path (crates/victory-gpu), cutting per-frame recording thread CPU overhead without altering host GPU rendering semantics:Per-command-list host root & IA binding cache (
crates/victory-gpu/src/rootcache.rs,draw.rs,VICTORY_STATE_CACHE=0escape hatch)StateCacheinsidedraw::Statetracking emitted graphics and compute root bindings (Set*Root32BitConstants,Set*Root32BitConstant,Set*RootConstantBufferView,Set*RootShaderResourceView,Set*RootUnorderedAccessView,Set*RootDescriptorTable) plus input-assembler bindings (IASetPrimitiveTopology,IASetVertexBufferswith minimal changed contiguous range trimming,IASetIndexBuffer).shadow.refresh, residency tracking, and indirect batching side effects; invalidates properly acrossState::reset,State::replay(external passes/list cuts),SetDescriptorHeaps,Set*RootSignature,rectangles()scratch VB swaps, and internal compute passes (ambient,open_batch, indirect bounds clamping).Skip phantom raw-twin D3D12 descriptor creation in
make_listed_batched(crates/victory-gpu/src/descriptor/host.rs)HostHeap::make_listed_batchedpreviously passedSome(views.slot(at + 1))unconditionally tomake_twinned, even whenself.twinswas empty (raw_twins=falseon NVIDIA) or!twinned(&view).twin_window,GetGPUVirtualAddress,CreateShaderResourceView/CreateUnorderedAccessView/null_buffer_view) whose output slot was never copied (if made.twin && twins).listed_twin_slot(twin, twins, views.slot(at + 1))(Nonewhen!twinsor!twin), while lazily populatingListView::twin_madeif a cached view record is ever reused on a heap with twins.Chunk-scoped
List::statelock holding inthin::translate(crates/victory-gpu/src/list.rs,list/thin.rs)StateHold(HELD_STATETLS) around eachthin::translatechunk (~65k calls/frame) and routeswith_state_onand listreplay(cut,write_value) throughwith_locked_state, removing per-callMutex<draw::State>lock/unlock churn across translated commands while staying panic- and re-entrancy-safe.Verification
cargo +1.98.1-x86_64-pc-windows-gnu test --workspace -- --test-threads=1(victory-gpu: 845 passed, 0 failed, 39 ignored;victory-hle: 249 passed, 0 failed, 3 ignored;apps/victory: 47 passed + 2 census passed;victory-core: 15 passed;victory-formats: 69 passed, 7 ignored;victory-game: 3 passed;victory-loader --lib: 63 passed + 1no_dll_planting; notevictory-loader --test load_probefailed on MinGWld.exedue to MSVC/DELAYLOAD:flag)cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-pe -p victory-pipeline -p xtask --locked(victory-pe: 36 passed;victory-pipeline: 13 passed;xtask: 8 passed includingpolicy::tests::repository_passes_policy)cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --features diagnostics --lib --locked -- --test-threads=1(905 passed, 1 failedtimeline::report::tests::real_waits_are_recorded_with_who_ended_themon MinGW symbol lookup, 40 ignored; includes unit tests forrootcache,listed_views_skip_raw_twin_when_heap_has_no_twins, andstate_hold_reuses_held_mutex_across_calls_and_releases_on_drop)cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --locked -- -D warnings(passed)cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --all-features --locked -- -D warnings(passed)Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T14:01:50Z.
Triage (
e1322a6c, CIcheckPASS):+649/-134acrossrootcache.rs,draw.rs,descriptor/host.rs,list.rs,list/thin.rs,lib.rs): per-list host root/IA cache (VICTORY_STATE_CACHE=0kill-switch), skipping ~27.5k/frame phantom listed raw twins, and chunk-scopedList::state. Note file overlap indescriptor/host.rs&draw.rswith#393(anddraw.rswith#394) — merge sequentially once verified.#282) + Gate 3 plain--releaseA/B vsmain(931e127e,0crashes/DRED) +--features diagnosticsvisual check.