d3d12: check sparse buffer memory_types before sharing the tile arena #2405
Closed
pepefroge wants to merge 5 commits from
upstream-pr/2405 into main
pull from: upstream-pr/2405
merge into: ProjectLeonida:main
ProjectLeonida:main
ProjectLeonida:claude/loop-total
ProjectLeonida:claude/pops-collision-seed
ProjectLeonida:claude/dstorage-hold-page-reads
ProjectLeonida:claude/host-image-copy-switch
ProjectLeonida:feat/gdk-lifecycle-window-hook
ProjectLeonida:claude/d16s8-uav-nvidia-fallback
ProjectLeonida:feat/mfplat-offline-shim
ProjectLeonida:claude/gameinput-slow-reader
ProjectLeonida:fix/rt-null-barrier-clear
ProjectLeonida:claude/depth-resolve-sample-positions
ProjectLeonida:integration/palmetto-parity
ProjectLeonida:claude/valu-literal-sext
ProjectLeonida:claude/slot74-pool-handle
ProjectLeonida:claude/rgb9e5-uint-alias-view
ProjectLeonida:claude/fssm-root-layout-tables
ProjectLeonida:feat/gdk-speech-display-lifecycle
ProjectLeonida:asset-audio-skip-current
ProjectLeonida:qemmhd/old-9940-rectangle-quad-lists
ProjectLeonida:feat/ws2-offline-shim
ProjectLeonida:qemmhd/rt-d16-unorm-uav
ProjectLeonida:feat/xs-device-stops-7-9
ProjectLeonida:qemmhd/rt-depth-same-base-shapes
ProjectLeonida:qemmhd/rt-lazy-attachment-variant
ProjectLeonida:feat/acphal-xma2-decoder
ProjectLeonida:asset-audio-skip
ProjectLeonida:codex/coord-claim-check-20261124-7e48
ProjectLeonida:feat/xs-frame-pacing-presentx
ProjectLeonida:feat/xs-device-vm-options
ProjectLeonida:old-pr/9844
ProjectLeonida:old-pr/9978
ProjectLeonida:old-pr/9815
ProjectLeonida:old-pr/10057
ProjectLeonida:old-pr/9874
ProjectLeonida:old-pr/9965
ProjectLeonida:old-pr/9863
ProjectLeonida:old-pr/10068
ProjectLeonida:old-pr/10066
ProjectLeonida:old-pr/10067
ProjectLeonida:old-pr/10007
ProjectLeonida:old-pr/10061
ProjectLeonida:old-pr/10065
ProjectLeonida:old-pr/10059
ProjectLeonida:old-pr/10063
ProjectLeonida:old-pr/10055
ProjectLeonida:old-pr/10062
ProjectLeonida:old-pr/10042
ProjectLeonida:old-pr/10041
ProjectLeonida:old-pr/10049
ProjectLeonida:old-pr/10047
ProjectLeonida:old-pr/10046
ProjectLeonida:old-pr/10045
ProjectLeonida:old-pr/10056
ProjectLeonida:old-pr/10043
ProjectLeonida:old-pr/10036
ProjectLeonida:old-pr/10034
ProjectLeonida:old-pr/9984
ProjectLeonida:old-pr/10052
ProjectLeonida:old-pr/10038
ProjectLeonida:old-pr/10033
ProjectLeonida:old-pr/10028
ProjectLeonida:old-pr/10050
ProjectLeonida:old-pr/9891
ProjectLeonida:old-pr/9889
ProjectLeonida:old-pr/10051
ProjectLeonida:old-pr/10019
ProjectLeonida:old-pr/10027
ProjectLeonida:old-pr/10029
ProjectLeonida:old-pr/10031
ProjectLeonida:old-pr/10026
ProjectLeonida:old-pr/9941
ProjectLeonida:old-pr/10030
ProjectLeonida:old-pr/10040
ProjectLeonida:old-pr/9990
ProjectLeonida:old-pr/10021
ProjectLeonida:old-pr/9962
ProjectLeonida:old-pr/10022
ProjectLeonida:old-pr/10020
ProjectLeonida:old-pr/10015
ProjectLeonida:old-pr/10025
ProjectLeonida:old-pr/9886
ProjectLeonida:old-pr/10048
ProjectLeonida:old-pr/10014
ProjectLeonida:old-pr/10011
ProjectLeonida:old-pr/9861
ProjectLeonida:old-pr/10010
ProjectLeonida:old-pr/10008
ProjectLeonida:old-pr/9860
ProjectLeonida:old-pr/10006
ProjectLeonida:old-pr/9920
ProjectLeonida:old-pr/9995
ProjectLeonida:old-pr/10000
ProjectLeonida:old-pr/10016
ProjectLeonida:old-pr/10004
ProjectLeonida:old-pr/10023
ProjectLeonida:old-pr/9982
ProjectLeonida:old-pr/9981
ProjectLeonida:old-pr/9983
ProjectLeonida:old-pr/9970
ProjectLeonida:old-pr/9969
ProjectLeonida:old-pr/9968
ProjectLeonida:old-pr/9971
ProjectLeonida:old-pr/9972
ProjectLeonida:old-pr/9942
ProjectLeonida:old-pr/9963
ProjectLeonida:old-pr/9960
ProjectLeonida:old-pr/9964
ProjectLeonida:old-pr/9985
ProjectLeonida:old-pr/9973
ProjectLeonida:old-pr/9862
ProjectLeonida:old-pr/9953
ProjectLeonida:old-pr/10017
ProjectLeonida:old-pr/9952
ProjectLeonida:old-pr/9955
ProjectLeonida:old-pr/9946
ProjectLeonida:old-pr/9954
ProjectLeonida:old-pr/9938
ProjectLeonida:old-pr/9956
ProjectLeonida:old-pr/9856
ProjectLeonida:old-pr/9947
ProjectLeonida:old-pr/9924
ProjectLeonida:old-pr/9961
ProjectLeonida:old-pr/9927
ProjectLeonida:old-pr/9979
ProjectLeonida:old-pr/10032
ProjectLeonida:old-pr/9926
ProjectLeonida:old-pr/5237
ProjectLeonida:old-pr/9951
ProjectLeonida:old-pr/9931
ProjectLeonida:old-pr/9902
ProjectLeonida:old-pr/9921
ProjectLeonida:old-pr/9994
ProjectLeonida:old-pr/9775
ProjectLeonida:old-pr/9768
ProjectLeonida:old-pr/9905
ProjectLeonida:old-pr/9936
ProjectLeonida:old-pr/9901
ProjectLeonida:old-pr/9904
ProjectLeonida:old-pr/9906
ProjectLeonida:old-pr/9988
ProjectLeonida:old-pr/9908
ProjectLeonida:old-pr/9909
ProjectLeonida:old-pr/9911
ProjectLeonida:old-pr/9912
ProjectLeonida:old-pr/9913
ProjectLeonida:old-pr/9887
ProjectLeonida:old-pr/9916
ProjectLeonida:old-pr/9919
ProjectLeonida:old-pr/9925
ProjectLeonida:old-pr/9933
ProjectLeonida:old-pr/9935
ProjectLeonida:old-pr/9918
ProjectLeonida:old-pr/9879
ProjectLeonida:old-pr/9880
ProjectLeonida:old-pr/9881
ProjectLeonida:old-pr/9996
ProjectLeonida:old-pr/9876
ProjectLeonida:old-pr/9892
ProjectLeonida:old-pr/9899
ProjectLeonida:old-pr/9915
ProjectLeonida:old-pr/9914
ProjectLeonida:old-pr/9872
ProjectLeonida:old-pr/9869
ProjectLeonida:old-pr/9866
ProjectLeonida:old-pr/9819
ProjectLeonida:old-pr/10012
ProjectLeonida:old-pr/9857
ProjectLeonida:old-pr/9893
ProjectLeonida:old-pr/9897
ProjectLeonida:old-pr/9928
ProjectLeonida:old-pr/9868
ProjectLeonida:old-pr/9917
ProjectLeonida:old-pr/9940
ProjectLeonida:old-pr/9873
ProjectLeonida:old-pr/9816
ProjectLeonida:old-pr/10009
ProjectLeonida:old-pr/9900
ProjectLeonida:old-pr/9966
ProjectLeonida:old-pr/9859
ProjectLeonida:old-pr/9843
ProjectLeonida:old-pr/9991
ProjectLeonida:old-pr/10058
ProjectLeonida:old-pr/9883
ProjectLeonida:old-pr/9838
ProjectLeonida:old-pr/9835
ProjectLeonida:old-pr/9959
ProjectLeonida:old-pr/9895
ProjectLeonida:old-pr/9837
ProjectLeonida:old-pr/9858
ProjectLeonida:old-pr/9865
ProjectLeonida:old-pr/9864
ProjectLeonida:old-pr/9840
ProjectLeonida:old-pr/9820
ProjectLeonida:old-pr/4669
ProjectLeonida:old-pr/9848
ProjectLeonida:old-pr/9850
ProjectLeonida:old-pr/9810
ProjectLeonida:old-pr/9799
ProjectLeonida:old-pr/9853
ProjectLeonida:old-pr/9875
ProjectLeonida:old-pr/9831
ProjectLeonida:old-pr/9796
ProjectLeonida:old-pr/9801
ProjectLeonida:old-pr/9813
ProjectLeonida:old-pr/9794
ProjectLeonida:old-pr/7417
ProjectLeonida:old-pr/9781
ProjectLeonida:old-pr/9806
ProjectLeonida:old-pr/9958
ProjectLeonida:old-pr/9809
ProjectLeonida:old-pr/9791
ProjectLeonida:old-pr/9792
ProjectLeonida:old-pr/10053
ProjectLeonida:old-pr/9784
ProjectLeonida:old-pr/9789
ProjectLeonida:old-pr/9849
ProjectLeonida:old-pr/9846
ProjectLeonida:old-pr/9773
ProjectLeonida:old-pr/9785
ProjectLeonida:old-pr/9803
ProjectLeonida:old-pr/9826
ProjectLeonida:old-pr/9839
ProjectLeonida:old-pr/9922
ProjectLeonida:old-pr/9948
ProjectLeonida:old-pr/7189
ProjectLeonida:old-pr/9957
ProjectLeonida:old-pr/9823
ProjectLeonida:old-pr/9807
ProjectLeonida:old-pr/9851
ProjectLeonida:old-pr/9774
ProjectLeonida:old-pr/9830
ProjectLeonida:old-pr/9836
ProjectLeonida:old-pr/9822
ProjectLeonida:old-pr/9783
ProjectLeonida:old-pr/9833
ProjectLeonida:old-pr/9890
ProjectLeonida:old-pr/9770
ProjectLeonida:old-pr/9769
ProjectLeonida:old-pr/9772
ProjectLeonida:old-pr/9787
ProjectLeonida:old-pr/9852
ProjectLeonida:old-pr/9834
ProjectLeonida:old-pr/9845
ProjectLeonida:old-pr/9871
ProjectLeonida:old-pr/9771
ProjectLeonida:old-pr/9776
ProjectLeonida:old-pr/10005
ProjectLeonida:old-pr/9949
ProjectLeonida:old-pr/9923
ProjectLeonida:old-pr/9805
ProjectLeonida:old-pr/9829
ProjectLeonida:old-pr/9790
ProjectLeonida:old-pr/9827
ProjectLeonida:old-pr/9929
ProjectLeonida:old-pr/9855
ProjectLeonida:old-pr/9934
ProjectLeonida:old-pr/9907
ProjectLeonida:old-pr/9910
ProjectLeonida:old-pr/9779
ProjectLeonida:old-pr/9780
ProjectLeonida:old-pr/9885
ProjectLeonida:old-pr/9882
ProjectLeonida:old-pr/9877
ProjectLeonida:old-pr/9998
ProjectLeonida:old-pr/4251
ProjectLeonida:old-pr/9987
ProjectLeonida:old-pr/9989
ProjectLeonida:old-pr/9950
ProjectLeonida:old-pr/9777
ProjectLeonida:old-pr/10044
ProjectLeonida:old-pr/9884
ProjectLeonida:old-pr/2906
ProjectLeonida:old-pr/5076
ProjectLeonida:old-pr/9937
ProjectLeonida:old-pr/9986
ProjectLeonida:old-pr/3014
ProjectLeonida:old-pr/9943
ProjectLeonida:old-pr/9939
ProjectLeonida:old-pr/4682
ProjectLeonida:old-pr/4765
No reviewers
Labels
Clear labels
No items
No labels
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.
Reference
ProjectLeonida/mandy!2405
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2405"
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?
Imported from ubiquitarianism/leonida. Originally posted by pepefroge on 2026-11-26T21:26:16Z.
Claimed in the coordination issue as: https://github.com/ProjectLeonida/mandy/issues/1608#issuecomment-7230664599
Summary
Fixes D3D12→Vulkan sparse buffer tile mappings failing with
ID3D12CommandQueue::UpdateTileMappings: invalid mapping or sparse residency unavailableon Intel Arc (reported in #725).Root Cause
DeviceState::tiles_share_arena()(runtime/shims/d3d12_vulkan_device.cpp:3536) only checks whetherarena.memory_typeoverlaps the device-init probesparse_buffer_memory_types.32.0.101.9150), an actual reserved buffer'srequirements.memoryTypeBitscan excludearena.memory_type(e.g., requiring non-ReBARDEVICE_LOCALmemory rather than the arena'sDEVICE_LOCAL | HOST_VISIBLEtype).Heap::tiles()(line 9625) still took the arena fast-path, causingVulkanQueue::bind_tiles()(runtime/src/vulkan_backend.h:4164) to reject the binding (!(resource->memory_types & (1u << page.heap->memory_type))).Heap::tiles()(line 9636) previously overwrote the caller'smemory_typeswithsparse_buffer_memory_typesunconditionally instead of intersecting when overlapping.Changes
Heap::tiles()(runtime/shims/d3d12_vulkan_device.cpp:9625) with(memory_types & (1u << device_.arena.memory_type)).memory_typesvia&=(line 9636) only when it overlapsdevice_.sparse_buffer_memory_types, preserving the caller'smemoryTypeBitsotherwise.Verification (Intel Arc Pro B60, BMG-G21, Driver
32.0.101.9150)d3d12_buffer_tiles_testfailedUpdateTileMappingson every mapped buffer tile (0/12tiles).f0b86e1): (Note: the subsequent native D3D12 comparison pass ind3d12_buffer_tiles_teststill hits Intel's native D3D12 driverCopyTilesbehavior noted in #725, while the Vulkan replay side now passes 12/12 tiles).Tested on Intel Arc Pro B60 (
0xe211, Windows 11, driver32.0.101.9150); root-cause trace assisted locally via Hermes + Qwen 3.8 27B.Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-26T22:48:12Z.
There is one same-heap case where
Heap::tiles()rejects a compatible second buffer atf0b86e1938.0x02)0x12), arena type 4CPU check. I compiled the PR’s
Heap::tiles()method with a mock allocator and a device probe mask of0x12. The second call enters the arena branch and returns atif (tile_allocation_) return {};. Checking for an existing buffer tile allocation whose memory type is in the caller’s mask before considering the arena made the second call return the same allocation. All seven cases then matched expectations, including incompatible masks and buffer/image separation. It would be worth adding the two-call sequence above as a regression test.RTX 4090 check. The unmodified PR passed
d3d12_buffer_tileson Windows 11, NVIDIA 616.64. Vulkan matched all 12 expected tiles and native D3D12 on the same card matched all three readbacks. This driver reported0x02for both sparse buffers and the initialization probe, with arena type 4, so it exercised the dedicated-only path. The mixed-mask finding above comes from the CPU fixture. AI-assisted verification.Imported from ubiquitarianism/leonida. Originally posted by BadgersMC on 2026-11-27T01:23:27Z.
Independent native Windows check (Profile M): RTX 3060 Ti desktop, 8 GB VRAM, NVIDIA 610.88, 16 GB RAM, MSVC 19.44. Compared the GitHub target base
fac8b4bbwith only the PR diff fromf0b86e19applied to that base. Samed3d12_buffer_tilesfixture, default 256 MiB arena, and Vulkan validation in both builds.VK_LAYER_KHRONOS_validationwas loaded and passed.Imported from ubiquitarianism/leonida. Originally posted by akimfomin on 2026-11-27T03:29:22Z.
Your B60 result and BadgersMC’s NVIDIA result leave a useful independent comparison: does the same public fixture recover Vulkan tile mapping on the Alchemist A770 from #725? I opened one pinned Test Lab request and offered that specific pair to the A770 reporter. The request keeps Vulkan replay and native D3D12 outcomes separate and leaves the reported second-buffer/same-heap case for its own fixture. I’ll link any completed A770 result here with its original author.
Imported from ubiquitarianism/leonida. Originally posted by djrolfes on 2026-11-27T19:24:47Z.
Single-variable A/B game-run check on Linux + Wine 11.22 + NVIDIA RTX 3070 Ti 8 GB (Profile M), per #2464 ("Start-up on NVIDIA and Intel"). Both arms started from the exact same byte-for-byte warm cache and overlay snapshot (cloned post-cold-baseline), with identical recipe and hands-free input script (
0env differences apart from the per-run capture folder;runtime_sha256differs as expected). All numbers independently recomputed from raw logs and resource samples by a second agent (codex/gpt-6-luna) before posting.PROVISIONAL (n=1 per side).Reading:
n=1per side, PROVISIONAL): No NVIDIA start-up or sparse-tile regression on RTX 3070 Ti 8 GB (NVIDIA 620.73.04, Linux + Wine 11.22): both arms recorded 0UpdateTileMappings/ sparse-residency / tile errors, 0 device losses, and identical16small-BAR fallback allocations, reaching world load (7.17–7.63 GiBGPU memory, >15,000 watched geometry tiles) and stopping at the same clean-mainmissing-shader world-entry exception (174.33 sA vs162.18 sB).playstage past world entry, or the same-heap two-buffer edge case noted earlier in this thread (would be refuted by a tile-mapping error or device loss on repeated runs or inplay).AI-assisted: Antigravity (Gemini 4 Neon) + Codex (
gpt-6-lunaindependent verification); no game data.Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-27T22:43:21Z.
Hi @pepefroge, thanks for this pull request.
CONTRIBUTING.md asks contributors to claim their work in the coordination issue ("Coordinating who works on what", currently #1608) before opening a pull request: post
claiming: <ID>there, or a one-line description if the item is not listed yet, and put the ID in the pull request. I could not find a claim from you for this one.The claim matters because "it is claimed in the coordination issue by the pull request's author" is the first item on the maintainers' checklist for a mergeable pull request, and because it lets others see that the work is taken before they write it a second time.
Could you post the claim in #1608 and put its ID (or a link to it) on the pull request's "Claimed in the coordination issue as:" line? If you already claimed it in another form, a link to your comment is enough.
AI-assisted (Claude Code, Claude Opus 5.5).
Imported from ubiquitarianism/leonida. Originally posted by akimfomin on 2026-11-27T23:14:42Z.
An incompatible companion case for ecox982745’s compatible-reuse regression: set the probe mask to
0b111, arena type to 0, A’s mask to0b010and B’s to0b100. Both pass reserved-resource creation. Atf0b86e1, A gets dedicated type 1 and B reaches the queue validation check, which rejects it beforevkQueueBindSparse. B succeeds in the model with a separate heap. With the proposed reuse-first guard, the compatible request reuses backing and the incompatible request is rejected at the heap. I’d put both in the same test and verify that A still reads back correctly after the rejection. Khronos confirms the sparse memory-type requirement.PortBridge cross-checked the public code and ran the mask model with Codex. The additional case is CPU-modeled. The Arc A770 hardware check in the Lab remains open.
Imported from ubiquitarianism/leonida. Originally posted by pepefroge on 2026-11-28T00:13:50Z.
@MoonEyes Thanks for the reminder! I've posted the claim (
D3D12-SPARSE-BUFFER-HEAP) in #1608 and added it to the "Claimed in the coordination issue as:" line in the PR description.Imported from ubiquitarianism/leonida. Originally posted by pepefroge on 2026-11-28T00:53:58Z.
@akimfomin Good point — I checked
create_sparse_buffer(d3d12_vulkan_device.cpp:9105) andupdate_tiles(vulkan_backend.h:2683), and because everyCreateReservedResourcebuffer gets the driver's singlerequirements.memoryTypeBitsmask, a disjoint buffer memory-type mask isn't reachable through the public D3D12 API (unlike the image-on-buffer-heap rejection check right below it).I extended
mixed_maskind3d12_buffer_tiles_test.cpp(148996716) to map and read back a third reserved bufferconto the same reused heap allocation (verifying third-buffer aliasing alongside the image-separation rejection check) and pushed the updated branch.Imported from ubiquitarianism/leonida. Originally posted by Tyrannys on 2026-11-28T02:56:44Z.
#2405 | head
148996716b| ctest -C RelWithDebInfo -R "^d3d12_buffer_tiles$" (MSVC RelWithDebInfo, GPU test) | red: with only the test file on main it does not compile (it uses the PR's two new test hooks); with those two read-only hooks added to main and the fix left out, it fails on the "Mixed mask" check | green: FAILS. main02f71ccfemerged into the head, and the head alone too: 3 of 3 and 2 of 2 runs fail with "Mixed mask: buffer B tile reads 0000000000, want the reused allocation's 0x23456789" and "dedicated type 1, arena type 4, device mask 0x2, mixed mask 0x12". So on this NVIDIA card the mixed-mask case does not reuse the dedicated allocation (the PR was tested on an Intel Arc Pro B60) | full suite: not run (a game boot was using the machine) | Windows 11, RTX 4070 SUPER, NVIDIA 621.01, Python 3.14 | AI-assisted: yes, Claude CodeImported from ubiquitarianism/leonida. Originally posted by pepefroge on 2026-11-28T03:13:38Z.
@Tyrannys Huge thanks for running this on your RTX 4070 SUPER and catching that! Look at what happened in
mixed_mask:Awas mapped tooffsets(heap tile 0), whileBandCwere mapped tooffsets + 1(heap tile 1). On NVIDIA (device mask 0x2), tile 0 and tile 1 of the reused 128 KiBtile_allocation_are distinct 64 KiB pages, soBat tile 1 legitimately read0x00000000instead ofA's pattern at tile 0.CreateReservedResourceassignsdevice mask(0x2, excluding arena bit4), whereas on Intel Arc (0x12),CreateReservedResourceincludes arena bit4(0x12) — which was the exact bug onmainwhere Intel refused reuse while NVIDIA didn't hit it.I've updated
mixed_mask(cf30c0a1f) soA,B, andCall map tooffsets(heap tile 0) of the reused allocation (leaving the image-refusal check onoffsets + 1) and pushed the branch. Whenever your machine is free, a quick re-run ofd3d12_buffer_tilesoncf30c0a1fshould now pass cleanly on RTX 4070 SUPER as well!Imported from ubiquitarianism/leonida. Originally posted by timbot103 on 2026-11-28T14:36:42Z.
Review: COMMENTED
Static code audit against
cf30c0a1f+ec740bcc3(AI-assisted).runtime/test/d3d12_buffer_tiles_test.cpp:302— The mixed mask is printed only. A, B and C use the same description. With identical masks, the test can pass on both revisions through either arena backing or dedicated backing. Please add a deterministic heap case with probe0x12, arena type 4, A0x02and B0x12, and assert that B returns A's type-1 allocation. Include a request that excludes type 1 and check that A remains mapped.runtime/test/d3d12_buffer_tiles_test.cpp:463—CreateReservedResourcerejectsD3D12_TEXTURE_LAYOUT_UNKNOWN, so the texture check always skips. Please use a valid sparse texture and check its mapping or readback directly. A successful device-status check and an unchanged buffer at a different heap offset cannot establish that the texture map was refused.The earlier Arc result is promising. An exact-head run with the probe, resource and chosen backing types logged would establish which path the driver took.
Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-28T15:34:57Z.
Review: COMMENTED
Tested
cf30c0a1fmerged locally withmainc1ecf04edcon Windows 11, MSVC 19.44, RTX 5070 (610.88).d3d12_buffer_tilespassed with 12 tile readbacks and all three native D3D12 comparisons. The image-on-buffer-heap subcase skipped on this GPU because it could not create the reserved image. The driver returned the same0x2mask for A/B/C, so this run does not cover a mixed mask.I separately compiled the actual
Heap::tiles()body from each tree against a mock allocator. With an arena of type 4, a probe mask of0x12, and resource masks0x02,0x12, then0x10, main chose the arena for the first request. The PR allocated type 1, reused the same allocation for the mixed mask, and refused the disjoint request. That is a red/green check for the gap timbot103 noted. A small CPU fixture for those mask transitions would pin the branch even on systems where reserved buffers all have the same mask.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by Maticcm on 2026-11-28T20:45:51Z.
I retested the corrected
mixed_maskfixture atcf30c0a1f8e89d4eaecfe92b6039714c7a488f61on an RTX 3080 desktop (10 GiB, driver 630.20), native Windows 11 build 26340, MSVC 19.50.35717, Vulkan SDK 1.4.363.1, with Khronos validation enabled.d3d12_buffer_tilespassed at the PR head and at common ancestorcf1c34128a78c47451ecf3e8acf1943f6ca560ac(1/1 each). The head exercised mixed-mask reuse of the dedicated allocation and aliasing by the third same-mask buffer. Vulkan replay matched all 12 tiles. The reserved-image separation subcase skipped because the selected device could not create the required reserved texture. No Vulkan validation errors were reported. Synthetic fixtures only. AI-assisted (Codex).Imported from ubiquitarianism/leonida. Originally posted by bobcatchris on 2026-11-29T12:14:18Z.
Native Windows 11 + AMD Radeon RX 7900 XTX 24 GB A/B game-run check (
main791899f65vsmain+#2405cf30c0a1f), per#2464.d3d12_buffer_tiles_testpassed on AMD Radeon RX 7900 XTX (12/12 Vulkan replay tiles across aliased/skipped/unmapped/reused/remapped ranges + 3/3 native D3D12 GPU readbacks).first-run UI/menu, unattended): 0 faults, 0VK_ERROR_DEVICE_LOST, 0 regressions (30.00 fpslocked,60.01 subs/s, GPU direct latency0.71 msavg,6.1%busy, VRAM4,982 MiB— identical tomain).Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-29T12:25:45Z.
I reproduced the two fixture gaps from the review above on Linux. Exact head
cf30c0a1fmerged cleanly withcc0f662a. The unchangedd3d12_buffer_tilespassed 3/3 on each of RTX 4070 SUPER 12 GiB (620.73.04) and AMD Raphael (RADV Mesa 26.3.1), with all 12 Vulkan replay tiles matching each time. CachyOS, Wine 11.22, synthetic inputs. The optional host D3D12 comparison did not run. Host Khronos validation was active and emitted the Wine DMA-BUF extension diagnostic01387.Heap::tileswith0x02for A/B/C and reused dedicated type 1. RADV used0x2dfor A/B/C and took arena type 3 starting at A. Restoring current main's heap-policy body also passed on both. As a GPU-backed complement to the CPU check, I locally exposed the extra arena bit to the heap policy only for B/C on NVIDIA after A had taken dedicated type 1. The real Vulkan requirements stayed unchanged. B read the expected pattern with early reuse in 3/3 runs and read zero with only that branch disabled in 3/3 runs.D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE, the image reachedHeap::tileson both GPUs. I observed the mapping rejected at the buffer-only heap and B's pattern intact. The local test also moved allocator/list reset after the fence wait, in line with the allocator reset contract.AI-assisted with OpenAI Codex.
Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-11-29T15:30:51Z.
Run on
cf30c0a1f(PR head), merged locally withmain50d09b373. Prep notes by TheGeogeo's review session.git merge --no-ff pr-2405; auto-mergedd3d12_com.h,d3d12_vulkan_device.cpp,d3d12_buffer_tiles_test.cpp). Merged commitf3d6c66cf, local only.cmake -S runtime -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLEONIDA_REQUIRE_VULKAN=ON, thencmake --build build --target d3d12_buffer_tiles_test d3d12_texture_tiles_test d3d12_sparse_queue_family_test gta6rt -j 6.Green (merged build)
ctest -R "^d3d12_buffer_tiles$" --output-on-failure -j1: passed (not skipped; sparse buffer residency is available on this GPU). The run prints "Vulkan replay: 12 full tiles matched across aliased, skipped, unmapped, reused and remapped ranges", "A rejected update left all tile mappings intact" and "Native D3D12 matched all three GPU readbacks".0x2and excludes the arena bit (type 5), so the mixed mask0x22is not a real mixed case here. The image-on-buffer-heap subcase prints "device cannot create a reserved texture; image separation skipped".d3d12_texture_tiles,d3d12_sparse_queue_family,d3d12_sparse_queue_family_contract: 3/3 passed.Red
d3d12_vulkan_device.cppandd3d12_com.htomain, test kept): does not build, the test uses the newdevice_sparse_buffer_memory_typesanddevice_arena_memory_typeaccessors (C2039/C3861 at test lines 283 and 292). This only shows the test needs the new API.Heap::tiles()put back tomain's code): no red on this GPU.d3d12_buffer_tilesstill passes with the same output, because the device's sparse mask excludes the arena type, somain's arena path is never taken. The Arc failure from the description (and the open points in timbot103's review about a deterministic mixed-mask case) cannot be reproduced on NVIDIA with this test; I am not claiming a red.Link: gta6rt.exe of the merged build: no new imports vs main (703 imports, identical lists with
dumpbin /imports).Machine: RTX 3090 24 GB, NVIDIA 621.40, Windows 11 Pro 10.0.26300, MSVC 19.44, Vulkan SDK 1.4.363.1. One run each.
AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by pepefroge on 2026-11-29T15:37:31Z.
Thanks everyone for the thorough multi-GPU testing!
I've shifted focus to another project (VIctory-Intel-Arc), so feel free to adopt/push those two test-fixture tweaks (D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE + CPU mock mask fixture) directly onto this branch to get it merged."
Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-29T15:55:03Z.
@pepefroge I don't have push access to your fork, so I pushed the two requested test-fixture updates to my fork branch
lixonik/leonida:review/2405-sparse-heap-fixturesat commit30e245bd16(merged withmainc22a0a7322, and cleanly mergeable againstmain1d3da5ebc7viagit merge-tree):leonida::sparse_buffer_backing(runtime/src/sparse_buffer_backing.h), called byHeap::tiles()inruntime/shims/d3d12_vulkan_device.cpp, and registered a deterministic CPU CTestd3d12_buffer_tiles_heap_policy(d3d12_buffer_tiles_test --heap-policy) covering the Intel Arc mixed-mask case (0x12reusing dedicated type 1 instead of rejecting).runtime/test/d3d12_buffer_tiles_test.cppto use a 2D reserved texture withD3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLEso it actually reachesHeap::tiles(), asserts the mapping is rejected, and verifies via readback that B's tile remains intact.Local verification (Windows 10 22H2, MSVC 19.44, RTX 5070,
LEONIDA_VK_VALIDATION=1,VK_VALIDATE_SYNC=1):ctest --output-on-failure -R "^d3d12_(buffer_tiles|buffer_tiles_heap_policy|texture_tiles)$": 3/3 passed (d3d12_buffer_tilesprintedMixed mask: an image on the buffer-only heap was refused and B's tile is unchanged,Mixed mask: live buffers reused the same tile,Native D3D12 matched all three GPU readbacks).heap_policy: reverting the reuse-before-arena ordering fails onsparse_buffer_backing(0x12, dedicated_type, arena_available, arena_type) == SparseBufferBacking::reuse(red=1,green=0).python -I scripts/check_no_game_data.pyon all 4 changed files: passed.You (or a maintainer) can cherry-pick
30e245bd16onto this branch directly.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by pepefroge on 2026-11-29T16:42:03Z.
Thanks @lixonik! I no longer have that repo cloned locally, so feel free to open a fresh PR with
30e245bd16or have a maintainer cherry-pick it directly into main—I'll close this one or leave it to be superseded.Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-29T21:04:38Z.
@pepefroge Thanks for the handoff. The replacement is #2645. It preserves your original commits and Arc verification, includes the two fixture changes, and passes all three focused tests after merging
main7bbc1d22. This PR can now be closed as superseded.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by pepefroge on 2026-11-29T21:07:51Z.
Closing in favor of #2645, which carries forward the original commits and Intel Arc Pro B60 verification along with the updated test fixtures. Thanks again to @lixonik and everyone who tested and reviewed!
Pull request closed