Repository navigation
Conversation
vkCmdUpdateBuffer (WriteBufferImmediate) and vkCmdFillBuffer run in the synchronization2 CLEAR stage, which a transfer-only queue family supports. queue_stages_copy left CLEAR out, so restrict_to_queue cut every copy-queue barrier that named it down to COPY, and the update was no longer ordered before a later copy. Synchronization validation shows it on a transfer-only family (RTX 3060, NVIDIA 610.88): vkCmdUpdateBuffer, a barrier with src COPY, vkCmdCopyBuffer reports READ_AFTER_WRITE; with src COPY | CLEAR it is silent, and there is no stage-support VUID for CLEAR on that family. The same CLEAR bit also decided whether initialize() may zero-clear a never-used colour image with vkCmdClearColorImage, which needs a graphics or compute family. That gate now asks for COMPUTE_SHADER instead, so image clears stay off copy queues and nothing changes on compute or direct queues. replay_clear_gate_test covers both: the per-queue image-clear gate (compute clears, copy does not) and the copy-queue barrier mask (COPY | CLEAR kept, a CLEAR-only scope stays CLEAR). The two barrier checks fail on main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested on Apple M1 Max, macOS 27.2.1 arm64: built |
|
End-to-end D3D12 verification of #8870 (69e473e) on main 867d922 with #8187 (1cb2e43) and #8457 (85931f8). Windows 11 build 26200, MSVC 19.51, x64 Release, Vulkan headers 1.4.363, Khronos validation 1.4.357 and LEONIDA_VK_VALIDATION=1. Synthetic inputs only. AI-assisted. The local probe extends d3d12_write_immediate_queues_test. It records DEFAULT WriteBufferImmediate at byte 8 of a default-heap buffer, calls ID3D12GraphicsCommandList7::Barrier with SYNC_COPY on both sides (COPY_DEST to COPY_SOURCE), then uses CopyBufferRegion to copy one word to readback byte 16. Each of DIRECT, COMPUTE and COPY uses its own D3D12 allocator, list and queue.
The independently built control used byte-identical probe source. It returned the expected word on both GPUs even though synchronization validation identified vkCmdCopyBuffer reading a range previously written by vkCmdUpdateBuffer. The probe exercises COPY directly while the OPTIONS3 COPY capability bit remains clear in #8457. Seven focused CTests passed three times per GPU: replay_clear_gate, replay_write_immediate_barriers, replay_write_immediate_predication, d3d12_state_map, d3d12_write_immediate_queues, vk_command_replay and vk_sync_validation. The last test confirmed that synchronization validation was active. |
|
Tested 69e473e (merged onto main 867d922) on RTX 5070, NVIDIA 621.24, Windows 11 (build 26200), Vulkan validation layer on (
Ran the tests that belong to the test files this PR changes (ctest entries, or the test program directly when it is not registered), with no game files ( |
|
Overlap note so reviewers don't merge the same change twice: #8746 (mine, draft) makes the same production change as this PR. It adds CLEAR to The two differ only in their tests:
I'm happy to consolidate on whichever the maintainers prefer. If this one lands first, I'll close #8746 and offer its #8187-composition test as a follow-up once #8187 merges. |
Claim: #8683 (comment), a new D3D item from tupacfan04's finding on #8457. Depends on: none. It complements #8187 (
SYNC_COPY->COPY | CLEAR), which this masking would otherwise undo on copy queues.What and why
vkCmdUpdateBuffer(WriteBufferImmediate) andvkCmdFillBufferrun in the synchronization2 CLEAR stage, and a transfer-only family supports that stage.queue_stages_copy(runtime/src/vulkan_replay.h) left CLEAR out, sorestrict_to_queuecut every copy-queue barrier that named it down to COPY, and the update was no longer ordered before a later copy.The same CLEAR bit also decided whether
initialize()may zero-clear a never-used colour image withvkCmdClearColorImage, which needs a graphics or compute family. Adding CLEAR alone would have let image clears onto copy queues, so that gate now asks forCOMPUTE_SHADERinstead. Image clears stay where they were: graphics and compute, never copy. Nothing changes on compute or direct queues:queue_stages_computeis the same set as before.Measured
Standalone Vulkan probe (synthetic), RTX 3060, NVIDIA 610.88, transfer-only family 1,
VK_LAYER_KHRONOS_validationwithVK_KHRONOS_VALIDATION_VALIDATE_SYNC=1:vkCmdUpdateBuffer, barrier srcCOPY,vkCmdCopyBuffer(main's copy-queue mask)READ_AFTER_WRITEhazardvkCmdUpdateBuffer, barrier srcCOPY | CLEAR,vkCmdCopyBuffer(this PR)Tests
replay_clear_gate_test(CPU only, no GPU) gets four checks:vkCmdClearColorImage;COPY | CLEAR | COMPUTE_SHADERkeepsCOPY | CLEAR(andTRANSFER_WRITE, droppingSHADER_WRITE);ALL_COMMANDS.The two barrier checks fail with main's
vulkan_replay.h(negative control); the two gate checks pass on both, which shows the gate change keeps behaviour.Windows 11 26200, RTX 3060 (Ampere), NVIDIA 610.88, MSVC 19.44.35230, Vulkan SDK 1.4.363.1, on main
867d922:replay_clear_gate_test: pass.d3d12_vulkan_device(d3d12_vulkan_device_test: reach Device10's CreateReservedResource2 on the inner device #8496),d3d12_depth_resolve(d3d12_depth_resolve: a list whose Close failed is not executed (fails on main since #6610) #8650) andd3d12_indirect_rt(d3d12: an ARRAY_OF_POINTERS entry below the arena is not an overflow (d3d12_indirect_rt on NVIDIA) #6010 / d3d12: arena AS resources take their address from vkGetAccelerationStructureDeviceAddressKHR #8414).LEONIDA_VK_VALIDATION=1 ctest -R 'd3d12_.*(queue|copy|tile|barrier|enhanced|fence|write_immediate|uav|clear|readback)': 33/33 on both main and this branch, with 0 validation errors.scripts/check_no_game_data.pyon both files andgit diff --check: clean.Not covered here: an end-to-end D3D12 case (DEFAULT-mode WriteBufferImmediate, then an enhanced
SYNC_COPYbarrier on a COPY list) also needs #8187's mapping; with both, the copy queue is ordered like the other two. Not run on AMD or Intel.No game data. AI-assisted (Claude Code).
🤖 Generated with Claude Code