GPU: forget descriptor range caches when their heap is destroyed #1372

Closed
spk-c wants to merge 1 commit from upstream-pr/1372 into main
spk-c commented 2026-11-26 19:23:50 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by spk-c on 2026-11-26T19:23:50Z.


Problem

Both the regular and marked buffer-view passes keep process-wide caches keyed by HostHeap addresses. A destroyed heap can leave cached shadow references behind; a new heap reusing that address can inherit stale cache state.

Change

Use upstream's existing monotonic heap ID (#1324) for both caches and remove both entries at title heap destruction, after releasing the shader-heap registry lock. Drop cached resource references after the cache locks have been released. Keep marked-pass forgotten-entry propagation, alt-mode reset, and the original full-scan cadence unchanged. This is a narrow alternative to the older fork's per-heap cache approach, adapted for current upstream.

Verification

Direct base 52ac4ec. Clean isolated workspace all-target/all-feature cargo check and Clippy -D warnings passed. Synthetic regression heap_range_cache_forgets_both_passes passed (only the specified heap's entries removed). Staged asset policy and diff checks passed. The regression does not exercise a live COM heap destruction or GPU race. Upstream full policy still has the pre-existing source-size issue addressed by #1357. CI/review pending.

AI-assisted, inspired by fork b5cbfbc; no title assets.

<!-- greyfinch-sync:fxceless/victory-fork:issue:5515948317 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1372). Originally posted by [spk-c](https://github.com/spk-c) on 2026-11-26T19:23:50Z. --- ## Problem Both the regular and marked buffer-view passes keep process-wide caches keyed by HostHeap addresses. A destroyed heap can leave cached shadow references behind; a new heap reusing that address can inherit stale cache state. ## Change Use upstream's existing monotonic heap ID (#1324) for both caches and remove both entries at title heap destruction, after releasing the shader-heap registry lock. Drop cached resource references after the cache locks have been released. Keep marked-pass forgotten-entry propagation, alt-mode reset, and the original full-scan cadence unchanged. This is a narrow alternative to the older fork's per-heap cache approach, adapted for current upstream. ## Verification Direct base 52ac4ec. Clean isolated workspace all-target/all-feature cargo check and Clippy -D warnings passed. Synthetic regression heap_range_cache_forgets_both_passes passed (only the specified heap's entries removed). Staged asset policy and diff checks passed. The regression does not exercise a live COM heap destruction or GPU race. Upstream full policy still has the pre-existing source-size issue addressed by #1357. CI/review pending. AI-assisted, inspired by fork b5cbfbc; no title assets.
Filip722 commented 2026-11-27 09:42:08 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Filip722 on 2026-11-27T09:42:08Z.


I cherry-picked 9aac3495 unchanged onto my 4c60466-based Proton integration (3fd5af9). The Windows MSVC diagnostics build passed the heap-destruction regression, all four heap planner tests and the concurrent registration/cache-generation test under GE-Proton11-14.

I also replayed the same early world view on the physical RTX 5060 Laptop GPU with both the plain and marked scan, keeping the executable and initial cache/checkpoint fixed. Both rendered the room and responded to camera input. In the matched 54-second windows, throughput was 5.94 and 6.38 FPS and the median heap preparation time was 63.8 and 68.3 ms respectively. This exercises both cache variants and the teardown fix on Proton. The two short replays leave the long-session memory effect open.

NVIDIA 615.78.08, vkd3d-proton 3.2.0. Assisted by Codex (GPT-6.2-Sol High).

<!-- greyfinch-sync:fxceless/victory-fork:comment:7214992215 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1372#issuecomment-7214992215). Originally posted by [Filip722](https://github.com/Filip722) on 2026-11-27T09:42:08Z. --- I cherry-picked `9aac3495` unchanged onto my `4c60466`-based Proton integration (`3fd5af9`). The Windows MSVC diagnostics build passed the heap-destruction regression, all four heap planner tests and the concurrent registration/cache-generation test under GE-Proton11-14. I also replayed the same early world view on the physical RTX 5060 Laptop GPU with both the plain and marked scan, keeping the executable and initial cache/checkpoint fixed. Both rendered the room and responded to camera input. In the matched 54-second windows, throughput was 5.94 and 6.38 FPS and the median heap preparation time was 63.8 and 68.3 ms respectively. This exercises both cache variants and the teardown fix on Proton. The two short replays leave the long-session memory effect open. NVIDIA 615.78.08, vkd3d-proton 3.2.0. Assisted by Codex (GPT-6.2-Sol High).

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
fxceless/victory-fork!1372
No description provided.