d3d12: SYNC_COPY waits for the CLEAR stage too, ordering WriteBufferImmediate before copies (OLD-10048) #751
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!751
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/751/head"
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?
@abnalstlll-byte on GitHub · 2026-11-24 13:29 UTC · original
abnalstlll-byte:restore/old-10048-sync-copy-clear-stage→main· +91 −5 · 4 files · 1 commits · merged 2026-11-24 18:38 UTCRestore old upstream PR 10048 (OLD-10048 / D3D-838).
An enhanced barrier's D3D12_BARRIER_SYNC_COPY mapped to VK_PIPELINE_STAGE_2_COPY_BIT only. Two D3D12 copy-scope commands are not Vulkan copies: WriteBufferImmediate is recorded as vkCmdUpdateBuffer and ResolveQueryData's never-written queries as vkCmdFillBuffer, and synchronization2 runs both in the CLEAR stage. A SYNC_COPY barrier after either therefore did not order it, and a copy after the barrier could read the word before the write landed.
vulkan_sync now maps SYNC_COPY to COPY | CLEAR. vk_command_replay_test part K records WriteBufferImmediate, a SYNC_COPY -> SYNC_COPY buffer barrier and a CopyBufferRegion of the written word; under LEONIDA_VK_VALIDATION=1 it is a read-after-write hazard without this change. d3d12_state_map_test and docs/d3d12_vulkan.md follow the new mapping.
Clean-room verified; zero game data.
@moffington on GitHub · 2026-11-24 14:13 UTC · original
Independently reviewed
a744fa8abagainst merge base2d73c242fon Linux with an RTX 3060 and Vulkan synchronization validation enabled.Applying the new part K regression test to the base reproduces the
READ_AFTER_WRITEhazard betweenvkCmdUpdateBufferandvkCmdCopyBuffer. On the PR head, all parts A–K pass with zero validation errors, including the 360 sync/access combinations.The updated stage mapping is consistent across global, buffer and texture barriers, and the transfer-only queue mask remains intact.
Full suite: 70 passed, 1 skipped, 1 failed. The
vk_queuefailure produces the same 10 WAW validation errors on both revisions.No regressions found. LGTM.
@Timon360SB on GitHub · 2026-11-24 14:21 UTC · original
Independent verification — Turing and Blackwell
Baseline:
2d73c242fddfe26d57b52ee150704e6c3b23cff4PR head:
a744fa8ab150c120babdbade56da470291d070cdEnvironment
Synchronization validation enabled. Three repetitions per revision on each GPU.
Results
vk_command_replayd3d12_state_mapvk_sync_validationTotal: 36 CTest executions — 24 passed, 12 failed, 0 skipped.
Part K results are included in the
vk_command_replayexecutions, not counted as separate CTests.Targeted verification
All six HEAD executions successfully completed the new part K:
The updated state-map checks also passed on both architectures.
All 12 synchronization validation positive controls passed.
Existing failures
The overall
vk_command_replaytest fails on both revisions and both GPUs with the same reported depth-copy validation error:Each execution reports 10 instances, subject to the validation layer's duplicate message limit. Parts H and I report validation errors on both revisions.
Conclusion
WriteBufferImmediateregression scenario succeeds on Turing and Blackwell, with no new validation errors in part K.Synthetic fixtures only. No game files used.
AI-assisted test automation and result analysis.
@SweatierKey on GitHub · 2026-11-24 14:33 UTC · original · approved these changes
Independent Windows 11 + NVIDIA GeForce RTX 5070 Ti (driver 616.92) verification applied cleanly on
main@d0da7dade(portableclang-cl 23.1.6+ Windows SDK 10.0.26100):d3d12_state_map_test.exe: PASS (RC=0, confirmsSYNC_COPYmaps toCOPY | CLEAR).vk_command_replay_test.exeon RTX 5070 Ti: PASS (RC=0, Parts A–K including new Part K orderingWriteBufferImmediate/vkCmdUpdateBufferbeforeCopyBufferRegion).python3 -I scripts/check_no_game_data.py: PASS.Clean, minimal fix; no game data. AI-assisted: yes.
@QemmHD on GitHub · 2026-11-24 18:38 UTC · original
Merging.
Why merged: OLD-10048: SYNC_COPY maps to COPY|CLEAR, so WriteBufferImmediate (vkCmdUpdateBuffer) and the query zero-fill are ordered before later copies. moffington reproduced the read-after-write hazard on the base, and Timon360SB and SweatierKey checked it independently. Part K of vk_command_replay_test covers it.
Why it's good: vk_command_replay, d3d12_state_map and replay_query_edges pass both plain and under validation.
Tested on Windows 11 / RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0. Merged alone onto main
32950551e, its ctests pass both plain and with LEONIDA_VK_VALIDATION=1. Cumulative: #516, #535, #751, #935 and #662 merged onto main955d9be34. There the repo-consistency set gives 571 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 307/309. The 2 failures are the same pre-existing ones as main (d3d12_execute_indirect_validation, d3d12_depth_resolve), with the same 11 skips. git merge-tree against current main71f99e224: no conflicts, and none of these touch the files #891/#882 changed. Security read of the three-dot diff: no binaries, game data, downloads, network calls or CI changes.AI-assisted (Claude Code, Claude Opus 5.5).