d3d12/xs: guard 48-bit host-import VAs and sync title-written descriptor heaps (D3D-RTX5070-HOST-HEAP-SYNC) #644
Open
github-bot
wants to merge 1 commit from
github-bot/gh-644 into main
AGit
pull from: github-bot/gh-644
merge into: github:main
github:main
github:docs/animation-merge-remnants
github:docs/story-dedup-and-cli
github:docs/restofworld-merge-remnants
github:docs/gamedata-dedup-tables
github:docs/textures-bcpack-tables-and-cli
github:docs/exe-fail-fast-shims-sync
github:fix/address-guard-wraparound-parity
github:fix/cvt-f16-denorm-and-clamp
github:docs/pso-cache-scope-note
github:docs/viewer-readme
github:docs/textures-arrays-dds-preview
github:docs/conformance-readme-status
github:fix/docs-validators-fences-urls
github:claude/loop-total
github:claude/pops-collision-seed
github:claude/dstorage-hold-page-reads
github:claude/host-image-copy-switch
github:feat/gdk-lifecycle-window-hook
github:claude/d16s8-uav-nvidia-fallback
github:feat/mfplat-offline-shim
github:claude/gameinput-slow-reader
github:fix/rt-null-barrier-clear
github:claude/depth-resolve-sample-positions
github:integration/palmetto-parity
github:claude/valu-literal-sext
github:claude/slot74-pool-handle
github:claude/rgb9e5-uint-alias-view
github:claude/fssm-root-layout-tables
github:feat/gdk-speech-display-lifecycle
github:asset-audio-skip-current
github:qemmhd/old-9940-rectangle-quad-lists
github:feat/ws2-offline-shim
github:qemmhd/rt-d16-unorm-uav
github:feat/xs-device-stops-7-9
github:qemmhd/rt-depth-same-base-shapes
github:qemmhd/rt-lazy-attachment-variant
github:feat/acphal-xma2-decoder
github:asset-audio-skip
github:codex/coord-claim-check-20261124-7e48
github:feat/xs-frame-pacing-presentx
github:feat/xs-device-vm-options
github:old-pr/9844
github:old-pr/9978
github:old-pr/9815
github:old-pr/10057
github:old-pr/9874
github:old-pr/9965
github:old-pr/9863
github:old-pr/10068
github:old-pr/10066
github:old-pr/10067
github:old-pr/10007
github:old-pr/10061
github:old-pr/10065
github:old-pr/10059
github:old-pr/10063
github:old-pr/10055
github:old-pr/10062
github:old-pr/10042
github:old-pr/10041
github:old-pr/10049
github:old-pr/10047
github:old-pr/10046
github:old-pr/10045
github:old-pr/10056
github:old-pr/10043
github:old-pr/10036
github:old-pr/10034
github:old-pr/9984
github:old-pr/10052
github:old-pr/10038
github:old-pr/10033
github:old-pr/10028
github:old-pr/10050
github:old-pr/9891
github:old-pr/9889
github:old-pr/10051
github:old-pr/10019
github:old-pr/10027
github:old-pr/10029
github:old-pr/10031
github:old-pr/10026
github:old-pr/9941
github:old-pr/10030
github:old-pr/10040
github:old-pr/9990
github:old-pr/10021
github:old-pr/9962
github:old-pr/10022
github:old-pr/10020
github:old-pr/10015
github:old-pr/10025
github:old-pr/9886
github:old-pr/10048
github:old-pr/10014
github:old-pr/10011
github:old-pr/9861
github:old-pr/10010
github:old-pr/10008
github:old-pr/9860
github:old-pr/10006
github:old-pr/9920
github:old-pr/9995
github:old-pr/10000
github:old-pr/10016
github:old-pr/10004
github:old-pr/10023
github:old-pr/9982
github:old-pr/9981
github:old-pr/9983
github:old-pr/9970
github:old-pr/9969
github:old-pr/9968
github:old-pr/9971
github:old-pr/9972
github:old-pr/9942
github:old-pr/9963
github:old-pr/9960
github:old-pr/9964
github:old-pr/9985
github:old-pr/9973
github:old-pr/9862
github:old-pr/9953
github:old-pr/10017
github:old-pr/9952
github:old-pr/9955
github:old-pr/9946
github:old-pr/9954
github:old-pr/9938
github:old-pr/9956
github:old-pr/9856
github:old-pr/9947
github:old-pr/9924
github:old-pr/9961
github:old-pr/9927
github:old-pr/9979
github:old-pr/10032
github:old-pr/9926
github:old-pr/5237
github:old-pr/9951
github:old-pr/9931
github:old-pr/9902
github:old-pr/9921
github:old-pr/9994
github:old-pr/9775
github:old-pr/9768
github:old-pr/9905
github:old-pr/9936
github:old-pr/9901
github:old-pr/9904
github:old-pr/9906
github:old-pr/9988
github:old-pr/9908
github:old-pr/9909
github:old-pr/9911
github:old-pr/9912
github:old-pr/9913
github:old-pr/9887
github:old-pr/9916
github:old-pr/9919
github:old-pr/9925
github:old-pr/9933
github:old-pr/9935
github:old-pr/9918
github:old-pr/9879
github:old-pr/9880
github:old-pr/9881
github:old-pr/9996
github:old-pr/9876
github:old-pr/9892
github:old-pr/9899
github:old-pr/9915
github:old-pr/9914
github:old-pr/9872
github:old-pr/9869
github:old-pr/9866
github:old-pr/9819
github:old-pr/10012
github:old-pr/9857
github:old-pr/9893
github:old-pr/9897
github:old-pr/9928
github:old-pr/9868
github:old-pr/9917
github:old-pr/9940
github:old-pr/9873
github:old-pr/9816
github:old-pr/10009
github:old-pr/9900
github:old-pr/9966
github:old-pr/9859
github:old-pr/9843
github:old-pr/9991
github:old-pr/10058
github:old-pr/9883
github:old-pr/9838
github:old-pr/9835
github:old-pr/9959
github:old-pr/9895
github:old-pr/9837
github:old-pr/9858
github:old-pr/9865
github:old-pr/9864
github:old-pr/9840
github:old-pr/9820
github:old-pr/4669
github:old-pr/9848
github:old-pr/9850
github:old-pr/9810
github:old-pr/9799
github:old-pr/9853
github:old-pr/9875
github:old-pr/9831
github:old-pr/9796
github:old-pr/9801
github:old-pr/9813
github:old-pr/9794
github:old-pr/7417
github:old-pr/9781
github:old-pr/9806
github:old-pr/9958
github:old-pr/9809
github:old-pr/9791
github:old-pr/9792
github:old-pr/10053
github:old-pr/9784
github:old-pr/9789
github:old-pr/9849
github:old-pr/9846
github:old-pr/9773
github:old-pr/9785
github:old-pr/9803
github:old-pr/9826
github:old-pr/9839
github:old-pr/9922
github:old-pr/9948
github:old-pr/7189
github:old-pr/9957
github:old-pr/9823
github:old-pr/9807
github:old-pr/9851
github:old-pr/9774
github:old-pr/9830
github:old-pr/9836
github:old-pr/9822
github:old-pr/9783
github:old-pr/9833
github:old-pr/9890
github:old-pr/9770
github:old-pr/9769
github:old-pr/9772
github:old-pr/9787
github:old-pr/9852
github:old-pr/9834
github:old-pr/9845
github:old-pr/9871
github:old-pr/9771
github:old-pr/9776
github:old-pr/10005
github:old-pr/9949
github:old-pr/9923
github:old-pr/9805
github:old-pr/9829
github:old-pr/9790
github:old-pr/9827
github:old-pr/9929
github:old-pr/9855
github:old-pr/9934
github:old-pr/9907
github:old-pr/9910
github:old-pr/9779
github:old-pr/9780
github:old-pr/9885
github:old-pr/9882
github:old-pr/9877
github:old-pr/9998
github:old-pr/4251
github:old-pr/9987
github:old-pr/9989
github:old-pr/9950
github:old-pr/9777
github:old-pr/10044
github:old-pr/9884
github:old-pr/2906
github:old-pr/5076
github:old-pr/9937
github:old-pr/9986
github:old-pr/3014
github:old-pr/9943
github:old-pr/9939
github:old-pr/4682
github:old-pr/4765
No reviewers
Labels
Clear labels
accessibility
Barrier affecting people with disabilities
bug
Something isn't working
documentation
Improvements or additions to documentation
duplicate
This issue or pull request already exists
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
invalid
This doesn't seem right
missing claim
Needs a claim in #14
needs rebase
Conflicts with the base branch: rebase it on main
question
Further information is requested
wontfix
This will not be worked on
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
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.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!644
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-644"
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?
@TanmaySatyam on GitHub · 2026-11-24 10:49 UTC · original
TanmaySatyam:feature/rtx5070-fixes→main· +339 −10 · 5 files · 1 commits · openClaimed 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.@sodove on GitHub · 2026-11-24 11:27 UTC · original
Independent Windows review of exact head
23872ccon RTX 5070 Ti (610.74), MSVC 19.44 Release, and Khronos Vulkan validation 1.4.369. The stock existing-heap, descriptor, console-heap, xmem-placement and compute tests pass (5/5), with zero validation errors.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:
register_descriptor_rangeinitializeslast_syncedfrom the supplied CPU range without initializing the real backing, so the first diff treats those existing bytes as already copied.CopyDescriptorsSimplenorCopyDescriptorscopies the new descriptor to an ordinary destination. Recreating those same source CBVs via the proxy API makes both copies pass. The proxy translates the source handle to the real backing, which has not received the CPU-side write. These copy calls run immediately on the CPU timeline, as documented in Copying Descriptors.All inputs were synthetic. AI-assisted.
@lixonik on GitHub · 2026-11-24 11:28 UTC · original · reviewed
One additional coverage gap on
23872ccfrom code review. The existing-heap fixture leavesVulkanDeviceInfo::buffer_device_addressunset. The device only callscreate_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 of2^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.
@lixonik on GitHub · 2026-11-24 12:26 UTC · original · edited 2026-11-24 12:55 UTC
Follow-up hardware Vulkan smoke test on Windows using the CI runtime artifact for this PR at
23872cc. I ran the test executables in an AppContainer without network capabilities. With the packaged synthetic shader fixtures in place,d3d12_descriptor_testandd3d12_console_descriptor_heap_testboth exited 0.d3d12_existing_heap_testterminated with0xC0000008in that restricted environment. I do not have a matching main artifact to compare, so that outcome is inconclusive. The console-heap smoke test exercises the fixed-address fixture and does not verify the new mapped-heap branch. The 48-bit guard observation in the earlier review still needs a focused case.AI-assisted. Synthetic inputs only. Vulkan validation layers were not enabled.
Update: the matching base artifact at
21625bcais available now. With the same AppContainer setup and packaged synthetic fixtures, both descriptor tests also exit 0 on the base, andd3d12_existing_heap_testterminates with the identical0xC0000008. All three outcomes match between base and PR in this harness. This comparison does not establish the cause of the existing-heap failure.@Timon360SB on GitHub · 2026-11-24 13:35 UTC · original
Independent regression verification — Turing and Blackwell
Baseline:
21625bca8cPR head:
23872cc5495d914d044ebc7ad8ef9422b3e5c357
Environment
LEONIDA_VK_VALIDATION=1 and
VK_VALIDATION_VALIDATE_SYNC=1 were set.
GPU-assisted validation was also enabled.
Results
Three repetitions per revision on each GPU.
36/36 test executions passed.
No skipped tests or reported Vulkan validation errors.
Additional observations
cases matched both native hardware D3D12 and WARP.
fallback checks passed on both revisions.
18, 19, 21, 22, 23 and 24 now execute
the CPU-handle translation handlers.
Scope and limitations
No regressions were observed in the selected tests.
BASE already passes all selected cases, so these
results do not independently reproduce or prove
the fix for the original 48-bit VA underflow.
The console heap test logs indicate a heap not
backed by title memory. Full title-written
descriptor synchronization is therefore not
established by these results.
Synchronization validation was requested, but
the dedicated positive-control test was not run.
Synthetic fixtures only. No game files used.
AI-assisted test automation and result analysis.
@TanmaySatyam on GitHub · 2026-11-24 14:34 UTC · original
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:egister_descriptor_range\ now seeds \last_synced\ from
eal_start\ instead of \custom_start, so valid descriptors already sitting in title memory before \CreateDescriptorHeap\ are detected as dirty and synced on the very first \ExecuteCommandLists.
t::d3d12::host_import_va_in_vsharp_range(arena_address, buffer_va)\ in
untime/shims/d3d12_com.h\ and added deterministic boundary checks in \d3d12_existing_heap_test\ (zero guards, \rena - 1, low VA \
@lixonik on GitHub · 2026-11-24 15:24 UTC · original
Thanks for adding the deterministic boundary cases and the live BDA fixture. One static follow-up on
2c136008: incheck_title_placed_with_bda,VirtualFree(pages, ...)runs before the localRef<ID3D12Resource> bufferdestructor releases the resource. On a successful direct import, the Vulkan memory object can still refer to those pages. The spec requires the host range to remain valid for the lifetime of the imported memory object.Could the buffer be scoped so it is destroyed before
VirtualFree, as in the existing placed-buffer checks? Fixture · Vulkan host-pointer lifetimeAI-assisted static follow-up. No GPU run on this head yet.
@TanmaySatyam on GitHub · 2026-11-24 15:31 UTC · original
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.
@MalexAson on GitHub · 2026-11-24 19:52 UTC · original
Tested c4b11a8c32 applied on
main6293c1c4f, on Intel Iris Xe (Raptor Lake-P, 8086:a7a0), Intel 32.0.101.7092, Windows 11 24H2 (26100.6584): this pull request's own cases pass;d3d12_existing_heapas a whole is red on this GPU before and after, for a reason that is already onmain.ctest -R "^(d3d12_existing_heap|d3d12_descriptor|d3d12_console_descriptor_heap)$", layer on the Iris Xe (the NVIDIA driver was kept out of the process withVK_LOADER_DRIVERS_SELECT):main6293c1c4fd3d12_descriptord3d12_console_descriptor_heapd3d12_existing_heapThe new cases in
d3d12_existing_heaprun here and pass:The guard is what answers in the BDA fixture on this driver: the layer logs
title-placed host import lies outside V# 48-bit range above heap_base; using arena shadow instead; bits 48-63: 65535. So on this Intel driver a host import does land belowheap_base, the case the guard is for.What keeps the test red is not from this pull request. In the existing
check_title_placedcases (no BDA arena) the import succeeds and the copy out of the buffer is then refused, three times, identically with and without the change:That is the finding in #14. It passed on the RTX 4060 Laptop GPU of the same machine earlier today on
main.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
main.AI-assisted: this run was made with a coding agent.
@QemmHD on GitHub · 2026-11-24 21:20 UTC · original
Independent test of head
c4b11a8c3on Windows 11 / RTX 4070 SUPER (NVIDIA 621.24, VS 2022, Ninja, RelWithDebInfo), merged alone onto main66d4f5aa3:LEONIDA_VK_VALIDATION=1(0 VUIDs).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:
readable_rangecheck. A writable check, or catching the write fault, would be safer.AI-assisted (Claude Code, Claude Opus 5.5).
@QemmHD on GitHub · 2026-11-25 07:08 UTC · original
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).
@QemmHD on GitHub · 2026-11-25 07:52 UTC · original
Update for when you rebase: this head (c4b11a8c3, based on
d0da7dade) no longer merges onto current main. A test merge ontoc7e82e26econflicts ind3d12_vulkan_device.cpp,d3d12_xs_device.cppand both test files. Also, main now has an overlapping mechanism from #939:LEONIDA_DESC_MIRROR(on by default) stores descriptor writes to a title-backed heap at the title's address as well, and list slots 35/36 pull the title's descriptors into the bound table. It would help reviewers if the rebased PR says what it adds on top of that, e.g. picking up records the title byte-copies itself, which is the case the VIctory fork commit I mentioned covers.AI-assisted (Claude Code, Claude Opus 5.5).
@TanmaySatyam on GitHub · 2026-11-25 09:07 UTC · original
Rebased cleanly onto
main(3f81d46ac) on top of #939 (LEONIDA_DESC_MIRROR) and the below-arena host-import guard, addressing @sodove's findings and @QemmHD's review notes:What this adds on top of current
main:d3d12_com.h,d3d12_vulkan_device.cpp,d3d12_existing_heap_test.cpp): Main now catchesbuffer_va < arena.address(unlessLEONIDA_IMPORT_BELOW_ARENA=1), but not positive offsets>= 2^48aboveheap_base.rt::d3d12::host_import_va_in_vsharp_range()guards both bounds while preservingLEONIDA_IMPORT_BELOW_ARENA=1for below-arena imports, with deterministic boundary and BDA-arena tests.CopyDescriptors/CopyDescriptorsSimplesource sync (d3d12_xs_device.cpplocal_sync_source): Main'sLEONIDA_DESC_MIRRORmirrors writes out to the title's backing (local_write_through) and pulls 64-slot tables on list slots 35/36, but does not pull direct CPU writes from a custom-backed source heap beforeCopyDescriptors*reads the real heap (addressing @sodove's finding #2).ExecuteCommandLists(local_sync_shader_visible_heaps): Layered directly ontoDescriptorRange,local_desc_mirror()(LEONIDA_DESC_MIRROR=0disables it too), andlocal_accessible()(writable/readable checks, addressing @QemmHD's note #4). Uses 8-byte per-slot fingerprints (4x smaller than a full 32-byte shadow copy, skipping unchanged/empty slots on submit, addressing @QemmHD's note #3), initialized to 0 so pre-filled slots sync on the first submit (@sodove's finding #1), and picks up title-byte-copied descriptors across the whole shader-visible custom heap rather than only 64-slot root-table binds.Verified locally (Windows 11, NVIDIA GeForce RTX 5070, MSVC RelWithDebInfo,
LEONIDA_VK_VALIDATION=1, 0 VUIDs):ctest -R "^(d3d12_existing_heap|d3d12_console_descriptor_heap|d3d12_descriptor|xs_proxy_mock|device_proxy|queue_proxy)$"-> 6/6 passed.python -I scripts/check_no_game_data.pyon all 5 changed files -> exit 0.AI-assisted.
@sodove on GitHub · 2026-11-25 10:54 UTC · original
Retested exact head
2ec2ca450on native Windows 11 build 26100, RTX 5070 Ti (610.74), MSVC 19.44 RelWithDebInfo. All six requested CTest cases passed, with zero VUIDs and Khronos validation 1.4.369 active on the GPU tests.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
CopyDescriptorsSimpleandCopyDescriptorsobserved a direct CPU write to a custom-backed source heap. The existing-heap test also passed its deterministic 48-bit boundary cases.Synthetic inputs only. This verifies those regressions on Blackwell. AI-assisted: yes (OpenAI Codex).
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.