Repository navigation
Runtime: capture full 64-bit GPU predicates (D3D-18 follow-up) - #856
Conversation
|
On I also generated the predicate via rendering on the GPU. Two RGBA8_UINT texels formed the predicate: the first stayed zero, and the second was cleared to encode high dwords 1, 0 and 0x80000000. CopyTextureRegion wrote the pair to offset 512 of the same default-heap buffer. One direct command list performed the clears, copies, transitions, captures and five column markers. Native D3D12/WARP ran the same sequence against independent resources.
This exercises capture after an RTV-authored write and copy, distinct from the ResolveQueryData barrier under review in #858. |
|
Tested
Code read, as the author of #258:
AI-assisted (Claude Code). |
|
@Parakeet-Wheat Thanks for the hardware validation and code review. Added the requested integration note in docs/d3d12_vulkan.md section 4.7, commit fc15d78: #291 must restore/rebind compute pipeline, set 0 and push constants after the helper; D3D-27 must capture outside dynamic rendering while preserving SetPredication snapshot timing. The note explicitly limits these to future integration requirements; this update adds no dispatch or render-pass implementation. Documentation only (five lines); git diff --check passed. |
quackottu
left a comment
There was a problem hiding this comment.
Tested fc15d78 on NVIDIA GeForce RTX 5070, driver 621.24, Windows 11 Pro (26300), VS 2022 Build Tools, Vulkan SDK 1.4.363.0, with LEONIDA_VK_VALIDATION=1 and LEONIDA_D3D12=vulkan: pass
ctest -C RelWithDebInfo: 100% tests passed, 0 tests failed out of 32d3d12_typeless_rtv_test(changed here): exit=0 validation=0 | [rt] d3d12: unsupported RGBA8 RTV format/subresource: 30typeless_rtv_test(changed here): exit=0 validation=0 | typeless_rtv_test: 64 format, snapshot, whole/rectangle and rejection scenarios passedvk_command_replay_test(changed here): exit=0 validation=0 | F: immediate writes in three modes, UINT and UINT64 atomic copies, buffer and texture discardsvk_predicate_capture_test(changed here): exit=0 validation=0 | predicate capture: 32 gated + 32 reused submissions, 192 snapshots, offset rebinding and reset passed- 33 test programs in the build pass with 0 validation errors
d3d12_clear_testfails (R8G8B8A8_UNORM/SNORM 0.5 ties and a D16 clear byte differ from WARP) exactly as onmain4a36bb1 here, so not from this PR; #521 addresses it
Implicit Vulkan layers (overlays) were off through an empty VK_IMPLICIT_LAYER_PATH.
|
Retested after the merge:
What changed since my last run: AI-assisted (Claude Code). |
|
Tested 5c76c9e on RTX 4090 (driver 621.14), Windows 11 26200, MSVC 19.44: pass (no regression against main).
The |
|
carve_all.ps1 and runtime/README.md are easy to resolve. vulkan_backend.h isn't, so it needs your call. main's VulkanQueue now has a QueueKind (direct/compute/copy) with queue_supported_stages, and its submit loop emits into context_.tracker_ under tracker_lock while collecting wrote_readback/readback_src_stages; this PR emits into a copy (next_tracker) and keeps family_. Please rebase so the copy-then-commit tracker keeps main's readback-stage collection and QueueKind. I'll merge it once ctest and vk_predicate_capture_test pass. |
Inject a failed submit to verify the speculative tracker is not committed. Exercise direct, compute and copy queue readbacks, verify their host barrier source stages, omit host barriers for batches without readback writes, and reject predicate capture on copy queues.
d46f25e to
f3b9c00
Compare
|
@ItsNotRexed Rebased onto main
Extended Full runtime build passes. Local CTest: 58 passed, 1 failed; GameInput remains disabled because SDL3 is unavailable. The sole failure is Update: all 12 CI checks have now completed successfully on f3b9c00, including Windows, linux-gpu-tools and both Wine jobs. GitHub reports the PR as mergeable. |
Build on the full 64-bit predicate snapshots from #856. Replay predicated buffer copies through a storage8 compute helper, retain descriptor batches through timeline completion, and reject missing capabilities or active statistics queries before submitting work. Validate byte offsets, high predicate words, bounds, skipped destinations and pending descriptor lifetimes with CPU checks, 180 native WARP comparisons and 64 gated/reused GPU submissions. The existing OPTIONS19 host-capability mismatch also reproduces on base 4a36bb1; no tests are disabled.
Verify compute and transfer readback-stage collection, descriptor cleanup after failed submits and gated/reused batches. Extend binary and overlapping occlusion fixtures with independent destinations to check skipped-copy preservation and copying after predicate reset. Document the command-slot lifetime and queue integration. Local RX 5700 XT validation: 180 exact WARP comparisons, 64 gated/reused copy submissions, both occlusion controls, 192 predicate captures, replay A-G and 1663 existing WARP readbacks passed. CTest: 59/60 active tests passed; the six stencil CopyResource mismatch reports exactly match the tested #856 baseline. Shader source and embedded SPIR-V match after Vulkan 1.2 validation.
Problem and behavior
D3D-18 follow-up to merged #258: the Vulkan replay reads only the low 32 bits of D3D12's predicate. For
0x0000000100000000, EQUAL_ZERO incorrectly skips a clear and NOT_EQUAL_ZERO incorrectly executes it. This was a documented limitation; the WARP reproduction and claim are here:#313 (comment)
D3D12 also captures the predicate when SetPredication executes on the GPU, so subsequent writes to the source must not change that condition (Microsoft contract).
Each active SetPredication now snapshots eight bytes through an internal copy and reduces both dwords with a one-invocation compute shader. Conditional rendering reads the private four-byte result. Rebinding ends the previous scope before the helper dispatch, so a false earlier predicate cannot suppress its replacement. A null buffer disables predication. Preparation validates all eight bytes, including the underlying buffer offset.
Implementation and boundaries
Validation
Exact head
e246323f0f91a1f2ac4d67b1eec0d95111502b89, based on main4a36bb19979b611f525d027f92e0fefad1626546. Windows build 26200, MSVC 19.44, RX 5700 XT driver 32.0.21045.5002. Synthetic fixtures only; no game data.vk_predicate_capture_testpasses 32 gated + 32 reused submissions / 192 snapshots, offset rebinding, reset and literal pixel checks, plus unavailable-entry-point, arena-limit and allocation-failure controls. The first 32 submissions are held behind a host-signalled timeline gate, preventing early arena retirement. The test is built and run on llvmpipe in CI.vk_command_replay_testsuites A-F pass. No validation errors in these scoped GPU runs.Vulkan 11, WARP 64for the high-only predicate and exits 1. The complete reduction was restored before the final build/tests.--spirv-valvalidates the synthetic shader for Vulkan 1.1; the embedded words match a fresh validated build byte-for-byte. CI also runs standalonespirv-valover the embedded module. Normal builds need no shader compiler.d3d12_vulkan_device, atOPTIONS19.SupportedSampleCountsWithNoOutputs(ours 0xf, host0x1d). The exact untouched main 4a36bb1 independently reproduces that same mismatch and exit 1. No test was disabled to hide it.git diff --checkpasses. Independent hardware review is welcome, particularly another Vulkan driver and the submission-lifetime test.