GPU: verify host heap coherency before enabling in-place memory (#500) #569
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/Belobug--VIctory-Belobug-AMD!569
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-569"
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?
@BlueCatsz on GitHub · 2026-11-27 11:55 UTC · original
BlueCatsz:fix/inplace-verify-host-heap-coherency→a-publier· +206 −0 · 2 files · 1 commits · openAddresses #500.
Problem
Under Linux/Wine +
vkd3d-proton(RADV), enablingVICTORY_PORT_CONSTANTS=1(Renderer Port 1, e.g.--ports12) causes a black screen from frame 1 (even on menus), whileVICTORY_PORT_DESCRIPTORS=1(Port 2) alone renders normally.Probing on RX 9070 XT / CachyOS Linux with
VKD3D_DEBUG=warnandVICTORY_INPLACE_PROBE=1showed why:port::open_regionmaps a second view viaMapViewOfFile(a file-backedMAP_SHAREDmapping under Wine) and callsOpenExistingHeapFromAddress1.amdgpurejects importing file-backedMAP_SHAREDuserptr mappings),vkd3d_import_host_memorylogsFailed to import host memory, hr 0x8007000eand then silently returnsS_OKwith a disconnected, zero-filled host-visible allocation (privateVirtualAllocreportsreads true, writes true, whereas section views reportreads false, writes false).port::place_forandinplace::place_fortrustedOk(heap)without checking CPU↔GPU coherency, Port 1 stopped copying the title's 32-bit graphics heap (refused: 0 by the host) and the GPU read all zeros.Change
crates/victory-gpu/src/inplace.rs:verify_buffer_coherent,verify_part_coherent,verify_private_part_coherent, andverify_section_view_coherentto test CPU→GPU (initial + updated bytes) and GPU→CPU coherency once against a temporary 64 KiB allocation/section view (dropping GPU objects before freeing/unmapping).inplace::place_forwith a cachedOnceLockcoherency check so non-coherent heaps log a single warning, incrementSTATS[5](refused by the host), and fall back to host copies.warp_verify_buffer_coherent_rejects_disconnected_buffer), private parts (warp_verify_private_part_coherent_succeeds), and section views (warp_verify_section_view_coherent_succeeds).crates/victory-gpu/src/port.rs:port::place_forwith a cachedOnceLockcheck viaverify_section_view_coherent(&host.device)so disconnected section-view heaps log a single warning, incrementSTATS[5](refused by the host), and fall back cleanly to host copies.No Wine version checks are used—native Windows (and any future Linux/driver configuration with coherent section-view import) passes automatically.
Verification
windows-latestCI on fork (run45992434821):Clippy(default &--all-features,-D warnings): passedDefault tests(cargo test --workspace --locked,399 passedincluding all 3 new WARP tests andpolicy::tests::repository_passes_policy): passedDiagnostics tests(cargo test --workspace --all-features --locked -- --test-threads=1): passedcheck: passeddiagbuild, Mesa RADV 26.3.1,proton-cachyos-slr+ patchedwineserver(CachyOS/wine-cachyos#50) +vkd3d-proton71cae09, retail 1.0.2.1):VICTORY_PORT_CONSTANTS=1 VICTORY_PORT_DESCRIPTORS=1: previously 100% black screen (refused: 0 by the host); now logs one coherency warning, falls back cleanly (0 regions,refused: 2 by the host), Port 2 stays active, and menus + opening scene render normally (13.2–16.3 fps).VICTORY_INPLACE=1: private memory coherency check passes on RADV (0 refused by the host,74 windows / 340 MBplaced in place).AI assistance disclosure: analysis, implementation, and verification summaries were drafted with AI assistance; all code changes, CI runs, and hardware test runs were reviewed and verified locally.
@gw1337x on GitHub · 2026-11-27 13:09 UTC · original
Windows check on RDNA 3, with
VICTORY_PORT_CONSTANTS=1on (part of the setting I test with). Memory Integrity was off.PC: Ryzen 7 9800X3D, RX 7800 XT, 32 GB. Test: 270 s hands-off boat scene, RT off, Belobug launcher settings plus the 5 port switches, warm caches. #569 (
ec93791) on4eb6cfdvs4eb6cfd, interleaved (PR, base, PR, base).The port 1 region is placed only after
section_view_coherent()returnsOk, so the section-view probe ran and passed on this card and driver, and port 1 keeps working as before. No change in fps or card time.Not covered: the private-memory probe in
inplace::place_for(I didn't check whether my setting reaches that path), and Linux/Wine, which I can't test here.AI-assisted (Claude Code); numbers from the run logs.
@lvndrpup on GitHub · 2026-11-27 14:15 UTC · original · reviewed
Tested on an RTX 3060 Ti (Windows 11, debug build), head
ec93791on base4eb6cfd. The bug needs Wine's file-backed mappings, so there's nothing to compare on the base here. What I checked is that the new checks don't turn port 1 orVICTORY_INPLACEoff on NVIDIA.ec93791verify_private_part_coherentandverify_section_view_coherenton the card (adapter 0, NVIDIA GeForce RTX 3060 Ti), from the test belowOkfor both, 3 of 3 runscargo test -p victory-gpu --lib inplace::,port::cargo test -p victory-gpu --lib, one runcargo clippy -p victory-gpu --all-targets -- -D warnings, with and without--all-featuresBoth checks pass on this card and driver, so both paths keep placing memory as before. With gw1337x's RX 7800 XT run, that covers the section-view check on both vendors on Windows, and the private check on NVIDIA. I can't run the Wine/RADV case.
The test I added to
inplace.rs, in case someone wants it on another card (the PR's tests use WARP):Run it with
cargo test -p victory-gpu --lib card_probe -- --nocapture. It merges cleanly with #421, the other open PR oninplace.rsthat still merges witha-publier.@MamaLeVrai on GitHub · 2026-11-27 15:56 UTC · original
Tested on an RX 6950 XT (RDNA 2), driver 32.0.21045.29003, Windows 11 build 26300, Rust 1.98.1, release. At
ec93791:victory-gpu399 passed, 0 failed, 34 ignored.AI-assisted (Claude Code); no game data.
@DecayingEagle on GitHub · 2026-11-27 17:13 UTC · original
Second Linux confirmation on RX 7900 XT / RADV Mesa 26.3.1 / Wine 11.22, vkd3d-proton
71cae09, DXVK's DXGI, Rust 1.98.1 MSVC cross-target. Testedec937910ona-publier@4eb6cfd; the reporting guard from #586 was also present.The WARP-only helper returns
Noneunder DXVK because its WARP request returns a hardware adapter. The new tests therefore initially reported success without executing their assertions. For hardware validation I added a local, test-only opt-in toinplace::tests::warp: retain its software-only default, accept hardware only when explicitly requested, print the actual adapter and assert Device13. The real run named RX 7900 XT,software=false.VICTORY_PORT_CONSTANTS=1 VICTORY_PORT_DESCRIPTORS=1logged the section-coherency warning and fell back to copies. Menus and opening scenes rendered instead of a black window; I inspected the captures locally. The 180-second run ended at its planned limit with no recorded title/device/kernel fault. The normal-profile 180-second control also completed.No FPS gain or later-mission crash fix is claimed. The local default keeps Port 1 disabled; the opt-in run verifies its fallback. No game assets or captures attached. Testing, the test-helper adaptation and this report assisted by OpenAI Codex.
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.