gpu: experimental write-watched heap twin (VICTORY_HEAP_TWIN, off) #120
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/ReTerryDavis--ReVIctory!120
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-119"
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?
@SovietBearz0r on GitHub · 2026-12-05 13:17 UTC · original
SovietBearz0r:longroad-heap-twin→main· +933 −3 · 13 files · 1 commits · closed without mergingExperimental, off-by-default heap twin:
VICTORY_HEAP_TWIN=1.What
Ported from longroad commit
d5207e99(from Darnerea36ba9): the title's ~185 MB graphics heap becomes private write-watched memory, its last ~174 MB get a write-only twin in a GPU upload heap, buffers/windows placed there are placed in the twin, the placed-shadow refresh is skipped, and only CPU-written 4 KiB parts are copied up before each submission. Newvictory-gpu/src/heap_twin.rs(~709 L) plus xmem/watch/port/descriptor/list/queue wiring; stats on the frame line; the source's refusals kept (no twin if the kernel does not watch the memory or the driver has no GPU-upload heaps — the heap then stays private and copies normally).Verification
heap_twin10 unit tests (dirty parts → joined copy runs, sync pieces, coverage/skip logic, placement ranges);victory-gpusubsets green (watch 66, inplace 8, port 27, descriptor host 68, list::thin 6, queue 18, land 7);cargo test -p victory-hle --lib272 passed;cargo check -p victory,cargo xtask policy, clippy: clean.Source: Lesloo/longroad
d5207e99, adapted to this tree's write-watch/port/queue machinery. Keep it opt-in; do not enable without a picture check.@ReTerryDavis on GitHub · 2026-12-05 17:37 UTC · original
Closing this one — we're trying to avoid landing large, intrusive, unverified experimental switches (
+933lines across 13 core files), andVICTORY_HEAP_TWINis hardcoded to a single magic heap allocation, untested on ReVIctory/AMD, allocates 174 MiB of unmeteredGPU_UPLOADVRAM, and has concrete correctness bugs:heap_twin.rs:360):OURS.swap(false, SeqCst)runs before acquiringSYNC_LOCK, allowing a second thread to observeours == false && covered == trueand submit GPU work before the first thread's CPU writes reach the twin.xmem.rs:1073):VirtualAlloc2(..., MEM_COMMIT | MEM_WRITE_WATCH, ...)on a reserved placeholder is invalid (MEM_WRITE_WATCHrequiresMEM_RESERVE), causing it to fail andVirtualFreethe reserved low window.Pull request closed