GPU: a released view heap takes its title memory page table with it #2232
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2234"
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 denkencar-sketch on 2026-11-25T08:31:23Z.
Summary
A view heap that is released keeps its title memory page table.
Heap::dropremoves the heap fromSHADER_HEAPSbut never frommemory::SHARED, so:Arc<Shadow>copies it names live on for the rest of the process, andShared::hostis meant to tell the two heaps apart ("a heap made later at a released one's address is another"), but it is the address of theHostHeap, which sits inline inHeap::host(OnceLock<Option<HostHeap>>), so it is the heap's address plus a constant and always equal. The old view pairs,nullslot andgenerationare then reused on the new host heap.Change
memory::release(key)drops the heap'sSHAREDentry;Heap::dropcalls it after letting go of theSHADER_HEAPSlock (bindandpreparetake the table's lock inside the heaps' lock, so it is not taken the other way round). Lists that named the table hold their own clone of it, as the existing comment inbindsays.Testing
descriptor::tests::a_released_view_heap_drops_its_page_tablecreates a shader-visible view heap, binds a list (making its table), releases the heap and checks the table is gone. It fails onmain("released with its heap") and passes with this change.cargo clippy --workspace --all-targets [--all-features] --locked -- -D warningsis clean.Not tried: a run in the game, and the address-reuse case itself (the test shows the table outliving its heap, which is what makes the reuse possible).
modules::dstorage::tests::a_page_list_filled_after_its_request_startsfails now and then onmaintoo (5 of 20 runs ofcargo test -p victory-hle --lib); it is unrelated.AI-assisted.
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T08:48:31Z.
Review: COMMENTED
A released view heap takes its title memory page table with it; lock-order comment (heaps lock → table lock) documented. Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1. Includes a host-GPU test (no-ops without one).
Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T09:02:30Z.
Review: APPROVED
Verified locally merged onto
origin/main(940d32f, Windows 11 x64, NVIDIA GeForce RTX 5090, Rust 1.98.1 MSVC):cargo test -p victory-gpu --lib a_released_view_heap_drops_its_page_table— passed on RTX 5090cargo clippy -p victory-gpu --all-targets— 0 warningscargo xtask policy— ok (183 files ok)Clean cleanup dropping a view heap's title-memory page table when the heap is released. Looks good.
AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T13:30:21Z.
Automated triage for the maintainers.
Merge candidate (worth a look).
Heap::dropindescriptor.rsnow calls a newmemory::release(key)that drops the heap'sSHAREDpage-table entry, after letting go of theSHADER_HEAPSlock (matching the heaps-then-table ordermemory::binduses). Onmainthe entry outlives its heap, and thes.hostcheck inbindcannot tell a later heap at the same address apart, since theHostHeapsits inline inHeap, so its address is the key plus a constant; lists keep their own clone of the table, so dropping the entry is safe. A test covers the release, and CIcheckpasses on this head.Generated by Claude Code
upstream-sync referenced this pull request2026-11-25 16:09:09 +00:00