vulkan: depth24 scratch and the device marker buffer are shared across queue families (RT-QUEUE-FAMILY-SHARING-DEPTH24-MARKERS) #2489
Closed
leonida/mandy
Tyrannys wants to merge 0 commits from
rt-queue-family-sharing-depth24-markers into main
pull from: rt-queue-family-sharing-depth24-markers
merge into: leonida:main
leonida:main
leonida:github-pr/3295
leonida:beta
leonida:docs/changelog-3483-3500
leonida:github-pr/3294
leonida:github-pr/2975
leonida:github-pr/2815
leonida:feat/gate-driver-start
leonida:feat/skip-pipelines-release
leonida:perf/lazy-compare
leonida:perf/mwaitx-wait
leonida:test/prio-ceiling-main
leonida:fix/ab-cpu-stdout
leonida:fix/gate-old-crashes
leonida:diag/ab-cpu
leonida:test/main-0312
leonida:github-pr/3291
leonida:diag/indirect-clamp-census
leonida:feat/barrier-enhanced
leonida:perf/texture-frame-ceiling
leonida:perf/dstorage-threads
leonida:fix/console-queue-dma-tables
leonida:fix/port-descriptors-record-parts
leonida:fix/frame-waits-fence
leonida:fix/console-sampler-words
leonida:fix/graphics-userdata-spill
leonida:fix/xg-reserved-layout-rotation
leonida:fix/barrier-console-flags
leonida:fix/switches-wait-test-child
leonida:test/list-value-waits
leonida:test/lot-gxdk-0412
leonida:fix/bvh-compacted-size
leonida:docs/i18n-quickstarts
leonida:feat/native-pipeline-slots
leonida:fix/clippy-leonida-gpu
leonida:fix/list-value-producers
leonida:fix/descriptor-page-straddle
leonida:fix/xmem-low-window
leonida:fix/ffx-jitter-never-zero
leonida:fix/run-stdout-closed
leonida:github-pr/2892
leonida:github-pr/2896
leonida:feat/warm-save-every
leonida:github-pr/2980
leonida:github-pr/2994
leonida:github-pr/3005
leonida:github-pr/3010
leonida:github-pr/3136
leonida:github-pr/3303
leonida:github-pr/3220
leonida:github-pr/3143
leonida:github-pr/3330
leonida:github-pr/3226
leonida:github-pr/3187
leonida:carry/3395
leonida:github-pr/2946
leonida:github-pr/2947
leonida:github-pr/2945
leonida:github-pr/2983
leonida:github-pr/3001
leonida:github-pr/3372
leonida:github-pr/3128
leonida:github-pr/3296
leonida:github-pr/2588
leonida:github-pr/3119
leonida:github-pr/3378
leonida:fix/crash-diagnostics
leonida:feat/dlss-mip-bias
leonida:fix/retired-out-of-order
leonida:fix/dxr-postbuild-barrier
leonida:fix/amd-relay-default
leonida:fix/removed-report-wait
leonida:feat/heap-twin
leonida:feat/vram-margin
leonida:github-pr/2472
leonida:github-pr/3123
leonida:github-pr/3088
leonida:assets/annonce-v1
leonida:github-pr/2794
leonida:github-pr/3300
leonida:github-pr/3304
leonida:github-pr/3308
leonida:github-pr/3367
leonida:github-pr/3369
leonida:fix/launcher-dlss-diagnostics
leonida:github-pr/3269
leonida:github-pr/2957
leonida:github-pr/3205
leonida:fix/crash-zero-guard
leonida:github-pr/3185
leonida:github-pr/3099
leonida:github-pr/3104
leonida:github-pr/3348
leonida:github-pr/3379
leonida:github-pr/3377
leonida:perf/darner-title-priority-ceiling
leonida:github-pr/3376
leonida:gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
leonida:gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
leonida:gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
leonida:github-pr/3373
leonida:github-pr/3368
leonida:github-pr/3198
leonida:gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
leonida:gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
leonida:gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
leonida:gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
leonida:github-pr/3346
leonida:github-pr/3375
leonida:github-pr/2958
leonida:github-pr/3151
leonida:github-pr/3307
leonida:github-pr/3278
leonida:github-pr/3374
leonida:fix/runtime-test-conservative-fixtures
leonida:github-pr/3366
leonida:ci/shard-semantic-linux
leonida:github-pr/3354
leonida:docs/fg-limit-fps-switch
leonida:github-pr/3365
leonida:fix/read-file-hard-link
leonida:github-pr/3364
leonida:fix/book-slot-heap-never-read
leonida:github-pr/3361
leonida:github-pr/3263
leonida:github-pr/3360
leonida:github-pr/3353
leonida:github-pr/3331
leonida:fix/alias-later-queued-submissions
leonida:github-pr/3352
leonida:github-pr/3228
leonida:github-pr/3349
leonida:claude/gallant-sagan-aamatr
leonida:github-pr/3200
leonida:github-pr/3132
leonida:github-pr/3323
leonida:github-pr/3332
leonida:github-pr/3340
leonida:github-pr/3311
leonida:github-pr/3334
leonida:github-pr/3297
leonida:github-pr/3256
leonida:github-pr/2567
leonida:github-pr/2851
leonida:d3d12/agility-sdk-621
leonida:github-pr/3164
leonida:github-pr/3114
leonida:github-pr/3050
leonida:github-pr/3113
leonida:github-pr/3326
leonida:github-pr/3144
leonida:github-pr/2642
leonida:github-pr/3072
leonida:github-pr/2789
leonida:github-pr/2643
leonida:github-pr/3009
leonida:github-pr/3035
leonida:github-pr/3031
leonida:github-pr/2686
leonida:github-pr/2834
leonida:github-pr/3321
leonida:github-pr/3325
leonida:github-pr/3290
leonida:github-pr/3324
leonida:github-pr/3130
leonida:claude/fervent-curie-m19lnr
leonida:github-pr/3309
leonida:github-pr/3305
leonida:github-pr/3306
leonida:github-pr/3302
leonida:github-pr/3301
leonida:github-pr/3345
leonida:github-pr/3211
leonida:github-pr/3027
leonida:github-pr/3286
leonida:github-pr/3235
leonida:github-pr/3265
leonida:github-pr/3275
leonida:codex/skip-no-hit-ray-passes
leonida:github-pr/2823
leonida:github-pr/2911
leonida:github-pr/3262
leonida:github-pr/3125
leonida:github-pr/3206
leonida:github-pr/3250
leonida:github-pr/3238
leonida:github-pr/3188
leonida:github-pr/2952
leonida:github-pr/3217
leonida:github-pr/3168
leonida:t3/preserve-fsr-sdk-restart-path
leonida:t3/propagate-host-failure-hresult
leonida:github-pr/3209
leonida:t3/launcher-custom-parameters
leonida:github-pr/3207
leonida:github-pr/3183
leonida:github-pr/3160
leonida:github-pr/3201
leonida:ci/less-to-run
leonida:github-pr/2930
leonida:github-pr/2797
leonida:github-pr/2999
leonida:perf/native-compute-shader-forms
leonida:github-pr/3191
leonida:github-pr/3011
leonida:github-pr/3019
leonida:github-pr/2996
leonida:gh-readonly-queue/main/pr-2789-45dc41f95c1cd0dcc29c2c50582e0e9af8a77259
leonida:claude/blissful-franklin-ukp7ag
leonida:github-pr/3141
leonida:github-pr/3156
leonida:github-pr/3150
leonida:github-pr/3153
leonida:github-pr/3163
leonida:github-pr/3142
leonida:github-pr/3139
leonida:github-pr/2841
leonida:github-pr/3069
leonida:github-pr/3098
leonida:github-pr/3107
leonida:github-pr/3071
leonida:github-pr/2774
leonida:github-pr/2889
leonida:github-pr/3075
leonida:github-pr/2661
leonida:github-pr/3064
leonida:github-pr/3054
leonida:github-pr/3049
leonida:github-pr/2855
leonida:github-pr/2943
leonida:github-pr/3016
leonida:github-pr/2887
leonida:github-pr/3006
leonida:github-pr/3003
leonida:github-pr/2993
leonida:notes/card-time-and-plant-flicker
leonida:github-pr/2989
leonida:feat/vulkan-rs
leonida:github-pr/2985
leonida:github-pr/2951
leonida:github-pr/2982
leonida:github-pr/752
leonida:github-pr/792
leonida:github-pr/2877
leonida:github-pr/2654
leonida:github-pr/2893
leonida:github-pr/2948
leonida:github-pr/2944
leonida:github-pr/2919
leonida:github-pr/2915
leonida:archive/ci/less-to-run/20261202T1121Z
leonida:github-pr/2800
leonida:github-pr/2822
leonida:github-pr/2833
leonida:github-pr/2840
leonida:github-pr/2831
leonida:github-pr/2832
leonida:github-pr/2801
leonida:github-pr/2890
leonida:github-pr/2891
leonida:github-pr/2664
leonida:github-pr/2807
leonida:rt-call-trace
leonida:github-pr/2755
leonida:perf/ahead-split
leonida:github-pr/2587
leonida:github-pr/2698
leonida:github-pr/2609
leonida:github-pr/3219
leonida:docs/readme-runtime-proposal
leonida:github-pr/2017
leonida:github-pr/1741
leonida:github-pr/1667
leonida:codex/coord-claim-check-20261124-7e48
No reviewers
Assignees
Clear assignees
No assignees
Labels
Clear labels
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
enhancement
New feature or request
missing claim
Needs a claim in #14
needs rebase
Conflicts with the base branch: rebase it on main
needs-triage
Needs maintainer evaluation before the next triage state
question
Further information is requested
ready-for-agent
Fully specified and ready for an AFK agent
submodules
Pull requests that update submodules code
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
Projects
Clear projects
No items
No project
Milestone
Clear milestone
No items
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
leonida/mandy!2489
Loading…
Reference in a new issue
No description provided.
Delete branch "rt-queue-family-sharing-depth24-markers"
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?
Pull request closed
This pull request cannot be reopened because the branch was deleted.
Claimed in the coordination issue as: RT-QUEUE-FAMILY-SHARING-DEPTH24-MARKERS (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7225241757)
What and why
Items 1 and 2 of @kevincommits' finding in #1608 (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7224895432). Thanks for the audit.
The device's other shared pools get
state_.familiesand callshare_across_queue_families:ScratchBuffers,IndirectArgumentClampandBindlessSet. Two buffers that every queue uses were stillVK_SHARING_MODE_EXCLUSIVE, with no queue-family ownership transfer. On a GPU with separate graphics, async-compute and copy families, that use is invalid (Vulkan "Resource Sharing Mode").Depth24Converterscratch chunks (vulkan_depth24.h).spare_after its submission and is handed to the next copy, on whichever D3D12 queue that copy runs: direct, compute, or a compute-backed copy queue (#2469).enable_depth24and the converter now take the device's families.make_chunkcallsshare_across_queue_families(info, families_).d3d12_vulkan_device.cpppassesstate_.families, asenable_copy_scratchandenable_indirect_clampalready do just above it.LEONIDA_DEVICE_MARKERSbuffer (vulkan_device_markers.h).vkCmdWriteBufferMarker[2]AMD.configure_device_fault,DeviceFaultDiagnosticsandDeviceMarkers::createnow take the families, and the buffer is shared across them.The new parameters are optional and default to no families. With one family, or none given, both buffers stay
EXCLUSIVE, as before (share_across_queue_familiesneeds two or more). Callers and tests that construct these classes directly are unchanged.Separate from #2469 (the depth24 barriers on a copy queue). This PR does not depend on it. Overlap, checked with
git merge-tree:vulkan_depth24.h) or #2469.vulkan_device_markers.hand its test, on adjacent lines only: itsif (!get)check goes right below the newcreatesignature, and its test additions sit next to the new case. Whichever lands second keeps both sides.Not included: the early return before the query pool is destroyed in
depth24_convert_test.cpp, which kevincommits also noted. That file is #2469's.Tested
Windows 11, MSVC (VS 18), RelWithDebInfo, on
main43a9d562d.New
depth24_scratch_sharing_test(CPU, faked driver).prepare()makes one scratch chunk, and itsVkBufferCreateInfois checked:CONCURRENTover them;EXCLUSIVE.With
main'svulkan_depth24.hthe converter has no families parameter, so the test does not compile. With only the parameter threaded through andmake_chunkleft as onmain, it fails on the first case.vulkan_device_markers_testgainsqueue_family_sharing. ThroughDeviceFaultDiagnosticsand throughDeviceMarkers::create, the marker buffer isCONCURRENTover {0, 1, 2}, {0, 2} and {3, 1}, andEXCLUSIVEwith {0}. Withmake_chunk's andcreate'sEXCLUSIVElines as onmain, the new checks fail.ctest -R "^(depth24_scratch_sharing|vulkan_device_markers|vulkan_device_fault|depth24_convert|vk_device_markers|vk_semaphore_lifetime|d3d12_depth24_draw)$": 7/7 pass. The GPU tests among them (depth24_convert,vk_device_markers,vk_semaphore_lifetime,d3d12_depth24_draw) run on the RTX 4070 SUPER, which has separate graphics, compute and transfer families; together they take about 12 s.scripts/check_no_game_data.py: clean.GPUs tested: profile M: NVIDIA GeForce RTX 4070 SUPER, 12 GB, desktop, driver 621.01, Windows 11
AI-assisted: yes (Claude Code)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code
Reviewed
9df6b03cc(vulkan_depth24.h,vulkan_device_markers.h,vulkan_device_fault.h,vulkan_backend.h,d3d12_vulkan_device.cpp, tests) and tested:state_.familiesintoenable_depth24andconfigure_device_fault->DeviceMarkers::createand applyingshare_across_queue_familiescleanly matchesScratchBuffers,IndirectArgumentClamp, andBindlessSetfor multi-family devices (while keepingVK_SHARING_MODE_EXCLUSIVEwhen there is only one family).vulkan_device_markerspassed (0.04 s) anddepth24_scratch_sharingpassed (0.03 s).Looks good to merge.
AI-assisted (Antigravity, Gemini).
Reviewed at head
9df6b03ccon Windows 11 (MSVC 202219.44).Verification
depth24_scratch_sharing_test,vulkan_device_markers_test, andgta6rt.depth24_scratch_sharing_test: passed.vulkan_device_markers_test: passed.Notes
VK_SHARING_MODE_EXCLUSIVEvsVK_SHARING_MODE_CONCURRENTcleanly satisfiesVkBufferCreateInfosharing rules for both the depth24/RGB96 scratch pool and the AMD device-marker buffer (d3d12_vulkan_device.cpp:14601-15054,vulkan_depth24.h:153-174,vulkan_device_markers.h:171-212).Approve.
AI-assisted review + local MSVC verification.
@Tyrannys — thanks for catching the MSVC C2397 in our marker test. I checked
9df6b03ccmerged with2d4735682on physical gfx906 / RADV Mesa 26.0.8, then tested that tree withccaad2ddadded.Sharing works on two real queue families. I recorded the create infos passed to the driver: both the marker buffer and converter-owned depth scratch stayed
EXCLUSIVEfor one family. For families 0 and 1, main still created both asEXCLUSIVE; #2489 created both asCONCURRENTover exactly those two families. I did not submit cross-family work on the exclusive main buffers.On both the PR merge and the combination, graphics family 0 converted 64 D24 words into scratch; family 1 copied the float payload and converted it back using the same retired/reused scratch handle and range. 64/64 float words and 64/64 returned D24 words matched, and each queue’s own marker pair read back correctly. The copy used the compute-capable family, not a third DMA family. Zero Khronos validation errors or sync hazards in this cross-family check.
Separate same-slot regression:
depth24_scratch_sharing(mock create-info checks), the CPU marker tests,depth24_convertandvk_semaphore_lifetimepassed. The stockvk_device_markersCTest uses a single family: main and #2489 alone both reported 10 write-after-write hazards (the layer’s cap) despite correct readbacks. Withccaad2dd, the marker CTest passed with zero validation errors on the legacy and synchronization2 marker paths, reading 5/5 then 8/8. Queue-family sharing and ordering repeated writes are distinct fixes.AI-assisted.
Tested 9df6b03cc merged (no commit) with main 8fb974878: MSVC 19.52, Windows 11 10.0.26300.
GPUs tested: NVIDIA GeForce RTX 3080, driver 621.40.
vulkan_device_markersanddepth24_scratch_sharingpass. The 295 relinked CTests pass, exceptxbox_present, which fails on main too (its resize case).vulkan_device_markers_test.cpp(303):C2661, noDeviceFaultDiagnosticsconstructor takes 6 arguments). No runtime red was shown here, because the test needs the new parameter.gta6rtlinks with nothing new over main: no new unresolved symbol, same imports.runtime/src/vulkan_device_markers.hand its test). Whichever lands second needs a rebase.AI-assisted (Claude Code).
RTX 3090 (621.40), validation on: 9df6b03cc merged onto main 4364a4fa6, 7/7 of the PR's depth24/marker/fault/semaphore ctest set pass, 0 validation errors. Plain main: the same 6 pre-existing tests pass.
Independent native Linux cross-family check of
9df6b03ccmerged onto878b024f4(tree75e9d6379), extending the earlier two-family RADV check to a dedicated transfer family. CachyOS, clang 23.1.5, RTX 4070 SUPER / NVIDIA 620.73.04 and Radeon 610M / RADV Mesa 26.3.1. Khronos validation 1.4.363, including synchronization validation.VkBufferin both batches. On NVIDIA, sharing covered graphics/compute/transfer0/2/1; the second readback followed a compute-to-transfer semaphore handoff and ran on family 1. RADV used0/1/1, with sharing over the two distinct families. Both patterns matched all 256 reference words on both GPUs, with zero validation errors.mainand the PR. A variant using distinct graphics and compute queues on the PR left the graphics marker slot at 5/5 and the compute slot at 8/8 on both GPUs, with zero validation errors. The two stock CPU sharing tests also passed.Synthetic fixtures only. AI-assisted with OpenAI Codex.
Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (
d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools,d3d12/, or general docs), please feel free to reopen it.