GPU: skip redundant AddRef and retire when HostHeap::keep retains the same resource #3655
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3655"
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 Marvisak/VIctory. Originally posted by Luislariosss on 2026-11-28T03:22:34Z.
When a descriptor slot is rewritten with a view pointing to the same
ID3D12Resourceit already keeps,HostHeap::keep()previously cloned the resource (AddRef), replaced the entry, and pushed the old reference intohost::retire()(Release+ retirement queue entry) unnecessarily.Changes
HostHeap::keep_reftakingOption<(Cow<'_, ID3D12Resource>, ...)>and delegatekeep()to it.ID3D12Resource(as_raw()match): skipclone(),mem::replace, andhost::retire()(updating only the shadow metadata if it changed).Cow::Borrowedfrom callers that already hold a reference (raw_view_atand adjacent slot pairs) soAddRefonly happens when the resource actually changes.descriptor::host::tests::keeping_the_same_resource_retires_nothingusing a#[cfg(test)]thread-local retire log.Verification
cargo xtask policy(191 files ok)cargo clippy -p victory-gpu --all-targets -- -D warnings(default and--features diagnostics)cargo test -p victory-gpu --lib descriptor::(23 passed, 0 failed)Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-28T07:10:02Z.
Independent software WARP verification against
main63bcca43c6a00a758510398fa43096ce7e4f7df0(clean merge with head7847813d, merge tree4ab263f55392b25dcee369ca2e6d75af1240ffe0).Environment: Windows 11 x64, software WARP (
VICTORY_WARP=1,VICTORY_D3D12_WARP=1, Microsoft Basic Render Driver),d3d10warp.dll10.0.26100.9818 (WinBuild.160101.0800),dxil.dll1.8.2502.11.Results (
victory-gpu):63bcca43:246 passed, 0 failed, 1 ignored(keeping_the_same_resource_retires_nothingabsent).#3655(4ab263f5):247 passed, 0 failed, 1 ignored; regressionkeeping_the_same_resource_retires_nothingpassed, and the depth-bounds draw readback passed on Microsoft Basic Render Driver.cargo clippy --workspace --all-targets -- -D warnings(both feature configurations), and asset policy check (191 files) all passed.Code review notes:
Arc<Shadow>while skipping retirement and the diagnostics lifetime note; the raw-view and raw-pair helpers borrow resources until ownership is needed by the slot. No defects found.#2971and#3456conflict indescriptor/host.rs. Combines cleanly with#3658(1aae4335ef9c44cefa56951aa7d2be3715a035d0).AI disclosure: Verification run by Codex (gpt-6.2-sol); report posted by orchestrator.
Imported from Marvisak/VIctory. Originally posted by futurepro62 on 2026-11-29T22:41:03Z.
NVIDIA full-suite run, to go with the reports above by oni-swr, since none of them names a GPU run. Tested exact head
7847813(on its base63bcca4).Tested
dxil.dllfrom Windows SDK 10.0.26100 (the loader's default), debug.cargo build --workspace --locked, thencargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 867 passed, 0 failed, 10 ignored.keeping_the_same_resource_retires_nothing.--skipleaves out tests that fail on main63bcca4on this card too, not because of this PR:heap_direct_texture_reads_mark_their_heap_indexends thevictory-shadertest process with0xc0000005(#2571), so without the skip the rest of that crate never reports;dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_viewsand the twostride_testshit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317);gathers_at_a_level_match_the_hardwarefails on lane 0 (#1744).Not tested
AI use
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.