Repository navigation
d3d12/xs: guard 48-bit host-import VAs and sync title-written descriptor heaps (D3D-RTX5070-HOST-HEAP-SYNC) - #644
Conversation
|
Independent Windows review of exact head A test-only extension uses real, writable CPU storage behind the console heap descriptor and obtains two distinct, valid CBVs from the layer. The ordinary heap copy control passes. The device-write mirror and a direct CPU write made after creation both reach the new shader-visible backing at submission. Two other paths differ, in three runs with validation active and zero validation errors:
All inputs were synthetic. AI-assisted. |
lixonik
left a comment
There was a problem hiding this comment.
One additional coverage gap on 23872cc from code review. The existing-heap fixture leaves VulkanDeviceInfo::buffer_device_address unset. The device only calls create_arena() when that flag is enabled, so this fixture cannot exercise the new condition that requires both an arena address and an imported buffer address.
Could the 48-bit check get a deterministic regression case? The boundary inputs are a buffer address just below the arena, offsets of 0 and 2^48 - 1, and an offset of 2^48. The valid offsets should still be accepted and the out-of-range ones should take the shadow path.
AI-assisted static review. No GPU run for this observation.
|
Follow-up hardware Vulkan smoke test on Windows using the CI runtime artifact for this PR at
AI-assisted. Synthetic inputs only. Vulkan validation layers were not enabled. Update: the matching base artifact at |
Independent regression verification — Turing and BlackwellBaseline: PR head: Environment
LEONIDA_VK_VALIDATION=1 and ResultsThree repetitions per revision on each GPU.
36/36 test executions passed. Additional observations
Scope and limitationsNo regressions were observed in the selected tests. BASE already passes all selected cases, so these The console heap test logs indicate a heap not Synchronization validation was requested, but Synthetic fixtures only. No game files used. |
|
Thanks @sodove, @lixonik, and @Timon360SB for the thorough reviews and hardware checks! Rebased onto \main\ (\d0da7dade) and pushed a follow-up commit addressing every review finding:
|
23872cc to
2c13600
Compare
|
Thanks for adding the deterministic boundary cases and the live BDA fixture. One static follow-up on Could the buffer be scoped so it is destroyed before AI-assisted static follow-up. No GPU run on this head yet. |
2c13600 to
c4b11a8
Compare
|
Good catch @lixonik — scoped \Ref buffer\ inside a block before \VirtualFree(pages, 0, MEM_RELEASE)\ in \check_title_placed_with_bda\ so any imported host-memory object is always released before the host pages are freed. Re-verified \d3d12_existing_heap_test\ on RTX 5070 (Driver 591.74, Windows 11, \LEONIDA_VK_VALIDATION=1, \VK_VALIDATION_VALIDATE_SYNC=1): PASS with 0 validation errors. |
|
Tested c4b11a8 applied on
The new cases in The guard is what answers in the BDA fixture on this driver: the layer logs What keeps the test red is not from this pull request. In the existing That is the finding in #14 (comment). It passed on the RTX 4060 Laptop GPU of the same machine earlier today on Not run: the layer on the NVIDIA GPU (its driver was being updated during this run). Built with MSVC 19.50 + Ninja, RelWithDebInfo; the change applies cleanly on current AI-assisted: this run was made with a coding agent. |
|
Independent test of head
I'm leaving the merge decision to the owner rather than merging it myself, because it changes runtime behaviour beyond a fix. Some notes for whoever decides:
AI-assisted (Claude Code, Claude Opus 5.5). |
|
A data point from another project for whoever decides on this. fxceless/victory-fork (a VIctory fork that renders gameplay on an RTX 4070) just landed the same idea in its commit a26859f, "The first room renders right": descriptor records the title copies into its heap as bytes are mirrored before each submission, with a per-slot fingerprint so only changed records are copied. They count about 40,000 records a frame in the first gameplay room, and that change is what made the room render correctly there. That supports #644's direction (title-written descriptors synced per ExecuteCommandLists). It also suggests the per-submit cost note from my earlier test can be addressed with a per-slot fingerprint or dirty tracking rather than a full memcmp. AI-assisted (Claude Code, Claude Opus 5.5). |
|
Update for when you rebase: this head (c4b11a8, based on d0da7da) no longer merges onto current main. A test merge onto c7e82e2 conflicts in AI-assisted (Claude Code, Claude Opus 5.5). |
…scriptor heaps Rebased onto upstream main on top of ProjectLeonida#939 (LEONIDA_DESC_MIRROR) and the below-arena guard: - d3d12_com.h / d3d12_vulkan_device.cpp: add rt::d3d12::host_import_va_in_vsharp_range() so positive offsets >= 2^48 above heap_base also fall back to the arena shadow while preserving LEONIDA_IMPORT_BELOW_ARENA=1 for below-arena imports; add deterministic 48-bit boundary + BDA arena tests in d3d12_existing_heap_test.cpp. - d3d12_xs_device.cpp: layer two missing sync paths directly on top of LEONIDA_DESC_MIRROR and local_accessible(): 1) local_sync_source() before CopyDescriptors / CopyDescriptorsSimple so direct CPU writes to custom-backed source heaps reach destinations immediately on the CPU timeline. 2) Per-slot 64-bit fingerprint sync (local_sync_shader_visible_heaps) before queue ExecuteCommandLists (slots 10/35) for shader-visible custom-backed heaps, picking up pre-filled slots on first submit and title-byte-copied descriptors outside 64-slot root-table binds without copying unchanged slots. - d3d12_console_descriptor_heap_test.cpp: add unit coverage for pre-filled first-submit sync, post-creation direct writes, and CopyDescriptorsSimple / CopyDescriptors from custom-backed heaps.
c4b11a8 to
2ec2ca4
Compare
|
Rebased cleanly onto What this adds on top of current
Verified locally (Windows 11, NVIDIA GeForce RTX 5070, MSVC RelWithDebInfo,
AI-assisted. |
|
Retested exact head The two cases from my earlier review are now covered by the stock console descriptor heap test and passed here. A valid descriptor placed in slot 0 before heap creation reached the real backing on the first submit. Both Synthetic inputs only. This verifies those regressions on Blackwell. AI-assisted: yes (OpenAI Codex). |
Claimed in the coordination issue as: D3D-RTX5070-HOST-HEAP-SYNC
AI-assisted.
Summary
runtime/shims/d3d12_vulkan_device.cpp)VK_EXT_external_memory_hostplaces a title-backed host import belowheap_base,address - heap_basewraps in 64-bit unsigned arithmetic (bits 48..63 = 0xFFFF), corrupting 48-bit V# buffer descriptors.va >= (1ull << 48)after subtractingheap_baseand falls back to the existing in-arena shadow buffer path cleanly.runtime/shims/d3d12_xs_device.cpp)ExecuteCommandLists/ExecuteCommandListsX.Testing & Verification
main@21625bca8)d3d12_existing_heap,d3d12_descriptor, andd3d12_console_descriptor_heapCTests underLEONIDA_VK_VALIDATION=1andVK_VALIDATION_VALIDATE_SYNC=1(3/3 passed, 0 validation errors).python -I scripts/check_no_game_data.py runtime/shims/d3d12_vulkan_device.cpp runtime/shims/d3d12_xs_device.cppexited 0.