GPU: the memory map tells the process heap's segments from other heaps' #459
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!459
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-459"
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?
@IxMxAMAR on GitHub · 2026-11-25 01:12 UTC · original
IxMxAMAR:gpu/memory-map-heap-owners→main· +172 −7 · 1 files · 2 commits · openThe memory map counts every private allocation of
0xFD0000bytes (an NT heap segment) as "process heap segments", andOWN's comment reads them as "ours, the graphics runtime's and the driver's alike". On an RX 9070 XT nearly all of them belonged to another heap: AMD's shader compiler (amdxc64.dll) keeps a heap of its own, and while it compiledcompute 39f0e9aeb156a61cwithout end (see #172) that heap grew to 13.8, 24.3 and 31.9 GB at 4, 6.5 and 9.5 min, until the process ran out of commit. That heap is not in the process's heap list either, so UMDH never shows it; it took an outside probe of the segment headers to find it.Change
segment_heap(base)reads a segment's header (64-bitHEAP_SEGMENT: signature0xffeeffeeat +0x10, the owning heap at +0x28) throughReadProcessMemoryon our own process, so an unreadable page fails the call instead of faulting.0xFD0000allocations whose header names the process heap keep their line; the others get a kind of their own at the end ofKINDS(segments of other heaps (private, 15.8 MB each)), so the existing kinds keep their numbers and text.memory map, heaps other than the process heap (N, the biggest first): heap 0x…: 31910 MB in 2109 segments; …(heap 0 for allocations whose header could not be read).OWN's comment says other heaps count apart.One header read per such allocation, during the walk that already runs on its own thread.
Tests
copystat::heap_tests::segments_name_their_heap: the process heap's first segment names it; a private heap (HeapCreate) filled with 20,000 blocks adds a segment whose header names that heap, not the process heap; a block address is no segment.cargo test -p victory-gpu --lib: 112 passed; with--features diagnostics: 120 passed.cargo clippy -p victory-gpu --all-targets -- -D warnings, with and without--all-features: clean.Made with the help of an AI.
@IxMxAMAR on GitHub · 2026-11-25 02:37 UTC · original
Seen in the game, same run (
c96b4f2with this PR, RX 9070 XT):with
process heap segments (private, 15.8 MB each) 2474 MBnext tosegments of other heaps (private, 15.8 MB each) 556 MBin the map line. With39f0e9aeb156a61ccompiling normally on this base, the other heaps stayed under 1 GB; on the older base, the AMD compiler's heap was the one that grew past 30 GB.@MamaLeVrai on GitHub · 2026-11-25 10:59 UTC · original
Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present. I merged this PR's head
99a7e54intomainf85101bin a throwaway tree (no conflict).cargo clippy --workspace --all-targets --locked -- -D warningsfails with exactly the errorsmainitself has on this machine (placed_filler_twins,depth_written, a sort; PR #841 fixes them); with--all-featuresit fails with the same number of errors asmain(4). This PR adds none and removes none.cargo test --workspace --locked: 555 passed, 0 failed, 11 ignored, two runs (mainalone: 555 passed, 11 ignored). The title was not run, so this says nothing about in-game effect. No game data.AI-assisted (Claude Code); no game data.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.